Mixer
Portable sound mixing library
Operations
- Close
- CloseAudio
- FadeOutChannel
- GetVolume
- HaltChannel
- Init
- ListRecordingDevices
- OpenAudio
- PlayPcm
- Playing
- Quit
- RecordPcm
- Volume
FadeOutChannel
Gradually fade out which channel over ms milliseconds starting from now.
function : FadeOutChannel(which:Int, ms:Int) ~ IntParameters
| 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) ~ IntParameters
| 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) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| channel | Int | to stop playing, or -1 for all channels |
Return
| Type | Description |
|---|---|
| Int | always returns zero |
Init
Initialize the audio mixer
function : Init(flags:Int) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| flags | Int | OR'd values refer to MixerInitFlags |
Return
| Type | Description |
|---|---|
| Int | status code |
ListRecordingDevices
List available recording devices
function : ListRecordingDevices() ~ String[]Return
| Type | Description |
|---|---|
| String | available recording devices |
OpenAudio
Initialize the mixer API
function : OpenAudio(frequency:Int, format:Int, channels:Int, chunksize:Int) ~ BoolParameters
| 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 |
PlayPcm
Play a PCM audio file
function : PlayPcm(bytes:Byte[], sample_rate:Int, audio_format:Int, channels:Int) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| bytes | Byte | bytes to be played |
| sample_rate | Int | playback sample rate |
| audio_format | Int | playback audio format see, AudioFormat |
| channels | Int | number of playback channels |
Playing
Tells you if music is actively playing, or not
function : Playing(channel:Int) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| channel | Int | music channel |
Return
| Type | Description |
|---|---|
| Bool | true if music is playing, false otherwise |
RecordPcm
Records a PCM audio stream
function : RecordPcm(dev_id:Int, sample_rate:Int, audio_format:Int, channels:Int, time_secs:Int) ~ Byte[]Parameters
| Name | Type | Description |
|---|---|---|
| dev_id | Int | recording device ID |
| sample_rate | Int | playback sample rate |
| audio_format | Int | playback audio format see, AudioFormat |
| channels | Int | number of playback channels |
| time_secs | Int | number seconds to record playback |
RecordPcm
Play a PCM audio file
function : RecordPcm(sample_rate:Int, audio_format:Int, channels:Int, time_secs:Int) ~ Byte[]Parameters
| Name | Type | Description |
|---|---|---|
| sample_rate | Int | playback sample rate |
| audio_format | Int | playback audio format see, AudioFormat |
| channels | Int | number of playback channels |
| time_secs | Int | number seconds to record playback |