Class MixChunk[in SDL Audio Mixer]

SDL Mixer Chunk encapsulation class.

class MixChunk

more...

Summary

Play()Play a sound on a given channel
Volume()Sets the mixing volume for a loaded chunk.

Detailed description

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.

Methods

Play()

Play a sound on a given channel

MixChunk.Play( channel, [loops], [time], [fadeIn] )

channelTarget channel ID (-1 to select the first available channel).
loopsNumbers of repetitions; 1 means repeat once, -1 repeat forever.
timeSeconds and fractions during which music will play.
fadeInSeconds and fractions for the fade-in effect.
Returns:The channel on which the sound is played.
Raises:
SDLErroron playback error.

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.

Volume()

Sets the mixing volume for a loaded chunk.

MixChunk.Volume( [volume] )

volumeVolume 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.


Made with faldoc 2.0.0