libogc  v2.6.0
Macros | Typedefs | Enumerations | Functions
asndlib.h File Reference

ASND library. More...

#include <gctypes.h>

Macros

#define __SNDLIB_H__
 
#define ASND_LIB   0x100
 
#define F44100HZ_PITCH   44100
 
#define INIT_RATE_48000
 
#define MAX_PITCH   144000
 
#define MAX_SND_VOICES   16
 
#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. More...
 
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...
 
void ASND_End (void)
 De-initializes the ASND lib. More...
 
s32 ASND_GetAudioRate (void)
 Returns the current audio rate. More...
 
u32 ASND_GetDSP_PercentUse (void)
 Returns the DSP usage. More...
 
u32 ASND_GetDSP_ProcessTime (void)
 
s32 ASND_GetFirstUnusedVoice (void)
 Returns the first unused voice. More...
 
u32 ASND_GetSampleCounter (void)
 Retrieves the global sample counter. More...
 
u32 ASND_GetSamplesPerTick (void)
 Retrieves the samples sent from the IRQ in one tick. More...
 
u32 ASND_GetTickCounterVoice (s32 voice)
 Returns the voice tick counter. More...
 
u32 ASND_GetTime (void)
 Returns the global time. More...
 
u32 ASND_GetTimerVoice (s32 voice)
 Returns the voice playback time. More...
 
void ASND_Init (void)
 Initializes the ASND lib and fixes the hardware sample rate to 48000. More...
 
s32 ASND_Is_Paused (void)
 Returns sound paused status. More...
 
void ASND_Pause (s32 paused)
 Used to pause (or unpause) the sound. More...
 
s32 ASND_PauseVoice (s32 voice, s32 pause)
 Pauses the selected voice. More...
 
void ASND_SetCallback (void(*callback)(void))
 Sets a global callback for general purposes. 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...
 
void ASND_SetTime (u32 time)
 Set the global time. 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...
 

Detailed Description

ASND library.

Function Documentation

◆ ANote2Freq()

int ANote2Freq ( int  note,
int  freq_base,
int  note_base 
)

Initializes the SND lib and fixes the hardware sample rate.

Parameters
[in]noteNote codification to play. for example: NOTE(C,4) for note C and octave 4.
[in]freq_baseFrequency base of the sample. For example 8000Hz.
[in]note_baseNote codification of the sample. For example: NOTE(L, 3) for note L and octave 3 (LA 3).
Returns
Frequency, in Hz.