libOGC
1.0
|
ASND library. More...
#include <gctypes.h>
Defines | |
#define | __SNDLIB_H__ |
#define | ASND_LIB 0x100 |
#define | F44100HZ_PITCH 44100 |
#define | INIT_RATE_48000 |
#define | MAX_PITCH 144000 |
#define | MAX_VOLUME 255 |
#define | MID_VOLUME 127 |
#define | MIN_PITCH 1 |
#define | MIN_VOLUME 0 |
#define | NOTE(note, octave) (note+(octave<<3)+(octave<<2)) |
#define | Note2Freq ANote2Freq |
#define | SND_AddVoice ASND_AddVoice |
#define | SND_BUSY 1 |
#define | SND_ChangePitchVoice ASND_ChangePitchVoice |
#define | SND_ChangeVolumeVoice ASND_ChangeVolumeVoice |
#define | SND_ChangeVolumeVoice ASND_ChangeVolumeVoice |
#define | SND_End ASND_End |
#define | SND_GetAudioRate ASND_GetAudioRate |
#define | SND_GetFirstUnusedVoice ASND_GetFirstUnusedVoice |
#define | SND_GetSampleCounter ASND_GetSampleCounter |
#define | SND_GetSamplesPerTick ASND_GetSamplesPerTick |
#define | SND_GetTickCounterVoice ASND_GetTickCounterVoice |
#define | SND_GetTime ASND_GetTime |
#define | SND_GetTimerVoice ASND_GetTimerVoice |
#define | SND_Init ASND_Init |
#define | SND_INVALID -1 |
#define | SND_Is_Paused ASND_Is_Paused |
#define | SND_ISNOTASONGVOICE -2 |
#define | SND_LIB (ASND_LIB+2) |
#define | SND_OK 0 |
#define | SND_Pause ASND_Pause |
#define | SND_PauseVoice ASND_PauseVoice |
#define | SND_SetCallback ASND_SetCallback |
#define | SND_SetTime ASND_SetTime |
#define | SND_SetVoice ASND_SetVoice |
#define | SND_StatusVoice ASND_StatusVoice |
#define | SND_StopVoice ASND_StopVoice |
#define | SND_TestPointer ASND_TestPointer |
#define | SND_UNUSED 0 |
#define | SND_WAITING 2 |
#define | SND_WORKING 1 |
#define | VOICE_MONO_16BIT 1 |
#define | VOICE_MONO_16BIT_BE 1 |
#define | VOICE_MONO_16BIT_LE 5 |
#define | VOICE_MONO_8BIT 0 |
#define | VOICE_MONO_8BIT_U 4 |
#define | VOICE_STEREO_16BIT 3 |
#define | VOICE_STEREO_16BIT_BE 3 |
#define | VOICE_STEREO_16BIT_LE 7 |
#define | VOICE_STEREO_8BIT 2 |
#define | VOICE_STEREO_8BIT_U 6 |
Typedefs | |
typedef void(* | ASNDVoiceCallback )(s32 voice) |
Callback type for ASND_SetVoice(). | |
Enumerations | |
enum | { NOTE_DO = 0, NOTE_DOs, NOTE_REb = NOTE_DOs, NOTE_RE, NOTE_REs, NOTE_MIb = NOTE_REs, NOTE_MI, NOTE_FA, NOTE_FAs, NOTE_SOLb = NOTE_FAs, NOTE_SOL, NOTE_SOLs, NOTE_LAb = NOTE_SOLs, NOTE_LA, NOTE_LAs, NOTE_SIb = NOTE_LAs, NOTE_SI } |
enum | { NOTE_C = 0, NOTE_Cs, NOTE_Db = NOTE_Cs, NOTE_D, NOTE_Ds, NOTE_Eb = NOTE_Ds, NOTE_E, NOTE_F, NOTE_Fs, NOTE_Gb = NOTE_Fs, NOTE_G, NOTE_Gs, NOTE_Ab = NOTE_Gs, NOTE_A, NOTE_As, NOTE_Bb = NOTE_As, NOTE_B } |
Functions | |
int | ANote2Freq (int note, int freq_base, int note_base) |
Initializes the SND lib and fixes the hardware sample rate. | |
s32 | ASND_AddVoice (s32 voice, void *snd, s32 size_snd) |
Adds a PCM voice to play from the second buffer. | |
s32 | ASND_ChangePitchVoice (s32 voice, s32 pitch) |
Changes the voice pitch in real-time. | |
s32 | ASND_ChangeVolumeVoice (s32 voice, s32 volume_l, s32 volume_r) |
Changes the voice volume in real-time. | |
void | ASND_End () |
De-initializes the ASND lib. | |
s32 | ASND_GetAudioRate () |
Returns the current audio rate. | |
u32 | ASND_GetDSP_PercentUse () |
Returns the DSP usage. | |
u32 | ASND_GetDSP_ProcessTime () |
s32 | ASND_GetFirstUnusedVoice () |
Returns the first unused voice. | |
u32 | ASND_GetSampleCounter () |
Retrieves the global sample counter. | |
u32 | ASND_GetSamplesPerTick () |
Retrieves the samples sent from the IRQ in one tick. | |
u32 | ASND_GetTickCounterVoice (s32 voice) |
Returns the voice tick counter. | |
u32 | ASND_GetTime () |
Returns the global time. | |
u32 | ASND_GetTimerVoice (s32 voice) |
Returns the voice playback time. | |
void | ASND_Init () |
Initializes the ASND lib and fixes the hardware sample rate to 48000. | |
s32 | ASND_Is_Paused () |
Returns sound paused status. | |
void | ASND_Pause (s32 paused) |
Used to pause (or unpause) the sound. | |
s32 | ASND_PauseVoice (s32 voice, s32 pause) |
Pauses the selected voice. | |
void | ASND_SetCallback (void(*callback)()) |
Sets a global callback for general purposes. | |
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. | |
void | ASND_SetTime (u32 time) |
Set the global time. | |
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. | |
s32 | ASND_StatusVoice (s32 voice) |
Returns the status of the selected voice. | |
s32 | ASND_StopVoice (s32 voice) |
Stops the selected voice. | |
s32 | ASND_TestPointer (s32 voice, void *pointer) |
Tests if pointer is in use by voice as a buffer. | |
s32 | ASND_TestVoiceBufferReady (s32 voice) |
Tests to determine if the voice is ready to receive a new buffer sample with ASND_AddVoice(). |
ASND library.
int ANote2Freq | ( | int | note, |
int | freq_base, | ||
int | note_base | ||
) |
Initializes the SND lib and fixes the hardware sample rate.
[in] | note | Note codification to play. for example: NOTE(C,4) for note C and octave 4. |
[in] | freq_base | Frequency base of the sample. For example 8000Hz. |
[in] | note_base | Note codification of the sample. For example: NOTE(L, 3) for note L and octave 3 (LA 3). |