audio.h File Reference

AUDIO subsystem. More...

#include <gctypes.h>

Defines

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

Typedefs

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

Functions

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


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_cnt AI 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] stack pointer 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] startaddr start address of the memory region to load into the audio DMA. NOTE: Has to be aligned on a 32byte boundery!
[in] len lenght of data to load into the audio DMA. NOTE: Sould 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] callback pointer 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] callback pointer 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] rate sampling 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] state playstate of the streaming audio interface (AI_STREAM_STOP,AI_STREAM_START)
Returns:
none

void AUDIO_SetStreamSampleRate ( u32  rate  ) 

Set streaming sample rate.

Parameters:
[in] rate streaming sample rate
Returns:
none

void AUDIO_SetStreamTrigger ( u32  cnt  ) 

Set the sample count for the stream trigger.

Parameters:
[in] cnt count of samples when to trigger the audio stream.
Returns:
none

void AUDIO_SetStreamVolLeft ( u8  vol  ) 

Set streaming volume on the left channel.

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

void AUDIO_SetStreamVolRight ( u8  vol  ) 

set streaming volume of the right channel.

Parameters:
[in] vol level 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


Generated on Sun Feb 4 18:14:34 2007 for libOGC by  doxygen 1.4.7