libogc
v2.9.0
|
Functions | |
s32 | ASND_AddVoice (s32 voice, void *snd, s32 size_snd) |
Adds a PCM voice to play from the second buffer. More... | |
s32 | ASND_ChangePitchVoice (s32 voice, s32 pitch) |
Changes the voice pitch in real-time. More... | |
s32 | ASND_ChangeVolumeVoice (s32 voice, s32 volume_l, s32 volume_r) |
Changes the voice volume in real-time. More... | |
s32 | ASND_GetFirstUnusedVoice (void) |
Returns the first unused voice. More... | |
u32 | ASND_GetTickCounterVoice (s32 voice) |
Returns the voice tick counter. More... | |
u32 | ASND_GetTimerVoice (s32 voice) |
Returns the voice playback time. More... | |
s32 | ASND_PauseVoice (s32 voice, s32 pause) |
Pauses the selected voice. More... | |
s32 | ASND_SetInfiniteVoice (s32 voice, s32 format, s32 pitch, s32 delay, void *snd, s32 size_snd, s32 volume_l, s32 volume_r) |
Sets a PCM voice to play infinitely. More... | |
s32 | ASND_SetVoice (s32 voice, s32 format, s32 pitch, s32 delay, void *snd, s32 size_snd, s32 volume_l, s32 volume_r, ASNDVoiceCallback callback) |
Sets a PCM voice to play. More... | |
s32 | ASND_StatusVoice (s32 voice) |
Returns the status of the selected voice. More... | |
s32 | ASND_StopVoice (s32 voice) |
Stops the selected voice. More... | |
s32 | ASND_TestPointer (s32 voice, void *pointer) |
Tests if pointer is in use by voice as a buffer. More... | |
s32 | ASND_TestVoiceBufferReady (s32 voice) |
Tests to determine if the voice is ready to receive a new buffer sample with ASND_AddVoice(). More... | |
Adds a PCM voice to play from the second buffer.
[in] | voice | Voice slot to attach this buffer to; value must be 0 to (MAX_SND_VOICES-1). |
[in] | snd | Buffer containing the samples; it must be aligned and padded to 32 bytes AND have the same sample format as the first buffer. |
[in] | size_snd | Size of the buffer samples, in bytes. |
Changes the voice pitch in real-time.
This function can be used to create audio effects such as Doppler effect emulation.
[in] | voice | Voice to change the pitch of, from 0 to (MAX_SND_VOICES-1). |
Changes the voice volume in real-time.
This function can be used to create audio effects like distance attenuation.
[in] | voice | Voice to change the volume of, from 0 to (MAX_SND_VOICES-1). |
[in] | volume_l | Voice volume to set the left channel to, from 0 to 255. |
[in] | volume_r | Voice volume to set the right channel to, from 0 to 255. |
s32 ASND_GetFirstUnusedVoice | ( | void | ) |
Returns the first unused voice.
Returns the voice tick counter.
This value represents the number of ticks since this voice started to play, sans delay time. It uses the same resolution as the internal sound buffer. For example, if the lib is initialized with INIT_RATE_48000, a return value of 24000 is equal to 0.5 seconds. This value can be used, for example, to synchronize audio and video.
[in] | voice | Voice to retrieve the counter value from, from 0 to (MAX_SND_VOICES-1). |
Returns the voice playback time.
This value represents the time, in milliseconds, since this voice started playing, sans delay time. This value can be used, for example, to synchronize audio and video.
[in] | voice | Voice to retrieve the time value from, from 0 to (MAX_SND_VOICES-1). |
Pauses the selected voice.
[in] | voice | Voice to pause, from 0 to (MAX_SND_VOICES-1). |
s32 ASND_SetInfiniteVoice | ( | s32 | voice, |
s32 | format, | ||
s32 | pitch, | ||
s32 | delay, | ||
void * | snd, | ||
s32 | size_snd, | ||
s32 | volume_l, | ||
s32 | volume_r | ||
) |
Sets a PCM voice to play infinitely.
s32 ASND_SetVoice | ( | s32 | voice, |
s32 | format, | ||
s32 | pitch, | ||
s32 | delay, | ||
void * | snd, | ||
s32 | size_snd, | ||
s32 | volume_l, | ||
s32 | volume_r, | ||
ASNDVoiceCallback | callback | ||
) |
Sets a PCM voice to play.
This function stops one previous voice. Use ASND_StatusVoice() to test the status condition.
void callback (s32 voice)
to call ASND_AddVoice() and add one voice to the second buffer. When the callback is non-NULL the, the voice never stops and returns SND_WAITING if successful on timeout condition. [in] | voice | Voice slot to use for this sound; valid values are 0 to (MAX_SND_VOICES-1). |
[in] | format | Voice format to use for this sound. |
[in] | pitch | Frequency to use, in Hz. |
[in] | delay | Delay to wait before playing this voice; value is in milliseconds. |
[in] | snd | Buffer containing samples to play back; the buffer must be aligned and padded to 32 bytes! |
[in] | size_snd | Size of the buffer samples, in bytes. |
[in] | volume_l | Voice volume of the left channel; value can be 0 - 255 inclusive. |
[in] | volume_r | Voice volume of the right channel; value can be 0 - 255 inclusive. |
[in] | callback | Optional callback function to use; set to NULL for no callback. See the note above for details. |
Returns the status of the selected voice.
[in] | voice | Voice slot to get the status from, from 0 to (MAX_SND_VOICES-1). |
Stops the selected voice.
If the voice is used in song mode, you need to assign the samples with ASND_SetSongSampleVoice() again. In this case, use ANS_PauseSongVoice() to stop the voice without loss of samples.
[in] | voice | Voice to stop, from 0 to (MAX_SND_VOICES-1). |
Tests if pointer is in use by voice as a buffer.
[in] | voice | Voice to test, from 0 to (MAX_SND_VOICES-1). |
[in] | pointer | Address to test. This must be the same pointer sent to ASND_AddVoice() or ASND_SetVoice(). |
Tests to determine if the voice is ready to receive a new buffer sample with ASND_AddVoice().
You can use this function to block a reader when double buffering is used. It works similarly to ASND_TestPointer() without needing to pass a pointer.
[in] | voice | Voice to test, from 0 to (MAX_SND_VOICES-1). |