libogc  v2.5.0
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 (void)
 Get the count of bytes, left to play, from the audio DMA interface. More...
 
u16 AUDIO_GetDMAEnableFlag (void)
 Get the audio DMA flag. More...
 
u32 AUDIO_GetDMALength (void)
 Get the DMA transfer length configured in the audio DMA interface. More...
 
u32 AUDIO_GetDMAStartAddr (void)
 Get the main memory address for the DMA operation. More...
 
u32 AUDIO_GetDSPSampleRate (void)
 Get the sampling rate for the DSP interface. More...
 
u32 AUDIO_GetStreamPlayState (void)
 Get the play state from the streaming audio interface. More...
 
u32 AUDIO_GetStreamSampleRate (void)
 Get streaming sample rate. More...
 
u8 AUDIO_GetStreamVolLeft (void)
 Get streaming volume of the left channel. More...
 
u8 AUDIO_GetStreamVolRight (void)
 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 (void)
 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 (void)
 Start the audio DMA operation. More...
 
void AUDIO_StopDMA (void)
 Stop the previously started audio DMA operation. More...
 

Detailed Description

AUDIO subsystem.

Typedef Documentation

◆ AIDCallback

void(* AIDCallback)(void)

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

Parameters
none

◆ AISCallback

void(* AISCallback)(u32 smp_cnt)

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

Parameters
smp_cntAI sample count

Function Documentation

◆ AUDIO_GetDMABytesLeft()

u32 AUDIO_GetDMABytesLeft ( void  )

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

Returns
count of bytes left to play.

◆ AUDIO_GetDMAEnableFlag()

u16 AUDIO_GetDMAEnableFlag ( void  )

Get the audio DMA flag.

Returns
state of the current DMA operation.

◆ AUDIO_GetDMALength()

u32 AUDIO_GetDMALength ( void  )

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

Returns
length of data loaded into the audio DMA interface.

◆ AUDIO_GetDMAStartAddr()

u32 AUDIO_GetDMAStartAddr ( void  )

Get the main memory address for the DMA operation.

Returns
start address of mainmemory loaded into the audio DMA interface.

◆ AUDIO_GetDSPSampleRate()

u32 AUDIO_GetDSPSampleRate ( void  )

Get the sampling rate for the DSP interface.

Returns
DSP sampling rate (AI_SAMPLERATE_32KHZ,AI_SAMPLERATE_48KHZ)

◆ AUDIO_GetStreamPlayState()

u32 AUDIO_GetStreamPlayState ( void  )

Get the play state from the streaming audio interface.

Returns
playstate (AI_STREAM_STOP,AI_STREAM_START)

◆ AUDIO_GetStreamSampleRate()

u32 AUDIO_GetStreamSampleRate ( void  )

Get streaming sample rate.

Returns
sample rate

◆ AUDIO_GetStreamVolLeft()

u8 AUDIO_GetStreamVolLeft ( void  )

Get streaming volume of the left channel.

Returns
level of volume.

◆ AUDIO_GetStreamVolRight()

u8 AUDIO_GetStreamVolRight ( void  )

Get streaming volume of the right channel.

Returns
level of volume.

◆ AUDIO_Init()

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

◆ AUDIO_InitDMA()

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

◆ AUDIO_RegisterDMACallback()

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.<br>
   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.

◆ AUDIO_RegisterStreamCallback()

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.

◆ AUDIO_ResetStreamSampleCnt()

void AUDIO_ResetStreamSampleCnt ( void  )

Reset the stream sample count register.

Returns
none

◆ AUDIO_SetDSPSampleRate()

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

◆ AUDIO_SetStreamPlayState()

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

◆ AUDIO_SetStreamSampleRate()

void AUDIO_SetStreamSampleRate ( u32  rate)

Set streaming sample rate.

Parameters
[in]ratestreaming sample rate
Returns
none

◆ AUDIO_SetStreamTrigger()

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

◆ AUDIO_SetStreamVolLeft()

void AUDIO_SetStreamVolLeft ( u8  vol)

Set streaming volume on the left channel.

Parameters
[in]vollevel of volume 0<= vol <=255
Returns
none

◆ AUDIO_SetStreamVolRight()

void AUDIO_SetStreamVolRight ( u8  vol)

set streaming volume of the right channel.

Parameters
[in]vollevel of volume 0<= vol <=255
Returns
none

◆ AUDIO_StartDMA()

void AUDIO_StartDMA ( void  )

Start the audio DMA operation.

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

◆ AUDIO_StopDMA()

void AUDIO_StopDMA ( void  )

Stop the previously started audio DMA operation.

Returns
none