libOGC  1.0
 All Data Structures Files Functions Variables Typedefs Macros Modules Pages
Macros | Typedefs | Functions
audio.h File Reference

AUDIO subsystem. More...

#include <gctypes.h>

Macros

#define AI_SAMPLERATE_32KHZ   0x00000000
 
#define AI_SAMPLERATE_48KHZ   0x00000001
 
#define AI_STREAM_START   0x00000001
 
#define AI_STREAM_STOP   0x00000000
 

Typedefs

typedef void(* AIDCallback )(void)
 function pointer typedef for the user's Audio DMA interrupt callback More...
 
typedef void(* AISCallback )(u32 smp_cnt)
 function pointer typedef for the user's Audio Streaming interrupt callback More...
 

Functions

u32 AUDIO_GetDMABytesLeft ()
 Get the count of bytes, left to play, from the audio DMA interface. More...
 
u16 AUDIO_GetDMAEnableFlag ()
 Get the audio DMA flag. More...
 
u32 AUDIO_GetDMALength ()
 Get the DMA transfer length configured in the audio DMA interface. More...
 
u32 AUDIO_GetDMAStartAddr ()
 Get the main memory address for the DMA operation. More...
 
u32 AUDIO_GetDSPSampleRate ()
 Get the sampling rate for the DSP interface. More...
 
u32 AUDIO_GetStreamPlayState ()
 Get the play state from the streaming audio interface. More...
 
u32 AUDIO_GetStreamSampleRate ()
 Get streaming sample rate. More...
 
u8 AUDIO_GetStreamVolLeft ()
 Get streaming volume of the left channel. More...
 
u8 AUDIO_GetStreamVolRight ()
 Get streaming volume of the right channel. More...
 
void AUDIO_Init (u8 *stack)
 Initialize the AUDIO subsystem. More...
 
void AUDIO_InitDMA (u32 startaddr, u32 len)
 Initialize an audio DMA transfer. More...
 
AIDCallback AUDIO_RegisterDMACallback (AIDCallback callback)
 Register a user callback function for the audio DMA interface. More...
 
AISCallback AUDIO_RegisterStreamCallback (AISCallback callback)
 Register a user callback function for the AUDIO streaming interface. More...
 
void AUDIO_ResetStreamSampleCnt ()
 Reset the stream sample count register. More...
 
void AUDIO_SetDSPSampleRate (u8 rate)
 Set the sampling rate for the DSP interface. More...
 
void AUDIO_SetStreamPlayState (u32 state)
 Set the play state for the streaming audio interface. More...
 
void AUDIO_SetStreamSampleRate (u32 rate)
 Set streaming sample rate. More...
 
void AUDIO_SetStreamTrigger (u32 cnt)
 Set the sample count for the stream trigger. More...
 
void AUDIO_SetStreamVolLeft (u8 vol)
 Set streaming volume on the left channel. More...
 
void AUDIO_SetStreamVolRight (u8 vol)
 set streaming volume of the right channel. More...
 
void AUDIO_StartDMA ()
 Start the audio DMA operation. More...
 
void AUDIO_StopDMA ()
 Stop the previously started audio DMA operation. More...
 

Detailed Description

AUDIO subsystem.

Typedef Documentation

void(* AIDCallback)(void)

function pointer typedef for the user's Audio DMA interrupt callback

Parameters
none
void(* AISCallback)(u32 smp_cnt)

function pointer typedef for the user's Audio Streaming interrupt callback

Parameters
smp_cntAI sample count

Function Documentation

u32 AUDIO_GetDMABytesLeft ( )

Get the count of bytes, left to play, from the audio DMA interface.

Returns
count of bytes left to play.
u16 AUDIO_GetDMAEnableFlag ( )

Get the audio DMA flag.

Returns
state of the current DMA operation.
u32 AUDIO_GetDMALength ( )

Get the DMA transfer length configured in the audio DMA interface.

Returns
length of data loaded into the audio DMA interface.
u32 AUDIO_GetDMAStartAddr ( )

Get the main memory address for the DMA operation.

Returns
start address of mainmemory loaded into the audio DMA interface.
u32 AUDIO_GetDSPSampleRate ( )

Get the sampling rate for the DSP interface.

Returns
DSP sampling rate (AI_SAMPLERATE_32KHZ,AI_SAMPLERATE_48KHZ)
u32 AUDIO_GetStreamPlayState ( )

Get the play state from the streaming audio interface.

Returns
playstate (AI_STREAM_STOP,AI_STREAM_START)
u32 AUDIO_GetStreamSampleRate ( )

Get streaming sample rate.

Returns
sample rate
u8 AUDIO_GetStreamVolLeft ( )

Get streaming volume of the left channel.

Returns
level of volume.
u8 AUDIO_GetStreamVolRight ( )

Get streaming volume of the right channel.

Returns
level of volume.
void AUDIO_Init ( u8 stack)

Initialize the AUDIO subsystem.

Parameters
[in]stackpointer to a memory area to work as stack when calling the callbacks. May be NULL
Returns
none
void AUDIO_InitDMA ( u32  startaddr,
u32  len 
)

Initialize an audio DMA transfer.

Parameters
[in]startaddrstart address of the memory region to load into the audio DMA. NOTE: Has to be aligned on a 32byte boundery!
[in]lenlenght of data to load into the audio DMA. NOTE: Should be a multiple of 32
Returns
none
AIDCallback AUDIO_RegisterDMACallback ( AIDCallback  callback)

Register a user callback function for the audio DMA interface.

This callback will be called whenever the audio DMA requests new data.
Internally the DMA buffers are double buffered.

Parameters
[in]callbackpointer to the function which to call when AID interrupt has triggered.
Returns
pointer to old callback function or NULL respectively.
AISCallback AUDIO_RegisterStreamCallback ( AISCallback  callback)

Register a user callback function for the AUDIO streaming interface.

Parameters
[in]callbackpointer to the function which to call when AIS interrupt has triggered.
Returns
pointer to old callback function or NULL respectively.
void AUDIO_ResetStreamSampleCnt ( )

Reset the stream sample count register.

Returns
none
void AUDIO_SetDSPSampleRate ( u8  rate)

Set the sampling rate for the DSP interface.

Parameters
[in]ratesampling rate to set for the DSP (AI_SAMPLERATE_32KHZ,AI_SAMPLERATE_48KHZ)
Returns
none
void AUDIO_SetStreamPlayState ( u32  state)

Set the play state for the streaming audio interface.

Parameters
[in]stateplaystate of the streaming audio interface (AI_STREAM_STOP,AI_STREAM_START)
Returns
none
void AUDIO_SetStreamSampleRate ( u32  rate)

Set streaming sample rate.

Parameters
[in]ratestreaming sample rate
Returns
none
void AUDIO_SetStreamTrigger ( u32  cnt)

Set the sample count for the stream trigger.

Parameters
[in]cntcount of samples when to trigger the audio stream.
Returns
none
void AUDIO_SetStreamVolLeft ( u8  vol)

Set streaming volume on the left channel.

Parameters
[in]vollevel of volume 0<= vol <=255
Returns
none
void AUDIO_SetStreamVolRight ( u8  vol)

set streaming volume of the right channel.

Parameters
[in]vollevel of volume 0<= vol <=255
Returns
none
void AUDIO_StartDMA ( )

Start the audio DMA operation.

Starts to transfer the data from main memory to the audio interface thru DMA.
This call should follow the call to AUDIO_InitDMA() which is used to initialize DMA transfers.

Returns
none
void AUDIO_StopDMA ( )

Stop the previously started audio DMA operation.

Returns
none