SDL Mixer Chunk encapsulation class.
class MixChunk
Play() | Play a sound on a given channel |
Volume() | Sets the mixing volume for a loaded chunk. |
SDL Mixer Chunk encapsulation class.
This class is used to store chunks created by MIX_LoadWAV* functions. It contains chunk opaque data and it is mainly used as an input for MIX.Channel* methods.
Play a sound on a given channel
MixChunk.Play( channel, [loops], [time], [fadeIn] )
channel | Target channel ID (-1 to select the first available channel). | ||
loops | Numbers of repetitions; 1 means repeat once, -1 repeat forever. | ||
time | Seconds and fractions during which music will play. | ||
fadeIn | Seconds and fractions for the fade-in effect. | ||
Returns: | The channel on which the sound is played. | ||
Raises: |
|
This method plays a previously loaded sound onto one channel.
If the loops parameter is not given, the chunk will play just once.
If fadeIn parameter is not given, nil or <=0, the sample will play immediately at full volume without fade-in.
If time parameter is not given, nil or -1, the sample will play forever, until the channel is stopped, while if it's a value, it will play for the given amount of seconds.
Note: This method encapsulates the functions of Mix_PlayChannel, Mix_PlayChannelTimed, Mix_FadeInChannel and Mix_FadeInChannelTimed in the SDL_Mixere API.
Sets the mixing volume for a loaded chunk.
MixChunk.Volume( [volume] )
volume | Volume level between 0 and MIX.MAX_VOLUME (128). |
Returns: | Previous setting for volume. |
If volume is set to a less than zero integer, or if its not given, the previous value for this setting is returned and the value is not changed.