All Bundles
Mixer
Portable sound mixing library
Operations
FadeOutChannel
Gradually fade out which channel over ms milliseconds starting from now.
function : FadeOutChannel(which:Int, ms:Int) ~ Int
Parameters
Name | Type | Description |
---|
which | Int | channel to fade out, or -1 to fade all channels out. |
ms | Int | milliseconds of time that the fade-out effect should take to go to silence, starting now. |
Return
Type | Description |
---|
Int | the number of channels set to fade out |
GetVolume
Gets the current volume
function : GetVolume(channel:Int) ~ Int
Parameters
Name | Type | Description |
---|
channel | Int | Channel to set mix volume for. -1 will set the volume for all allocated channels. |
Return
Type | Description |
---|
Int | current volume of the channel |
HaltChannel
Halt channel playback, or all channels
function : HaltChannel(channel:Int) ~ Int
Parameters
Name | Type | Description |
---|
channel | Int | to stop playing, or -1 for all channels |
Return
Type | Description |
---|
Int | always returns zero |
OpenAudio
Initialize the mixer API
function : OpenAudio(frequency:Int, format:Int, channels:Int, chunksize:Int) ~ Bool
Parameters
Name | Type | Description |
---|
frequency | Int | output sampling frequency in samples per second (Hz). you might use MIX_DEFAULT_FREQUENCY(22050) since that is a good value for most games. |
format | Int | output sample format. |
channels | Int | Number of sound channels in output. Set to 2 for stereo, 1 for mono. This has nothing to do with mixing channels. |
chunksize | Int | bytes used per output sample. |
Return
Type | Description |
---|
Bool | 0 on success, -1 on errors |
Playing
Tells you if music is actively playing, or not
function : Playing(channel:Int) ~ Bool
Parameters
Name | Type | Description |
---|
channel | Int | music channel |
Return
Type | Description |
---|
Bool | true if music is playing, false otherwise |
Quit
Shutdown and cleanup the mixer API
function : Quit() ~ Nil
Volume
Sets the current volume
function : Volume(channel:Int, volume:Int) ~ Int
Parameters
Name | Type | Description |
---|
channel | Int | Channel to set mix volume for. -1 will set the volume for all allocated channels. |
volume | Int | the volume to use from 0 to 128 |
Return
Type | Description |
---|
Int | current volume of the channel |