libdragon
|
Audio Subsystem. More...
Macros | |
#define | NUM_BUFFERS 4 |
Number of buffers the audio subsytem allocates and manages. | |
#define | BUFFERS_PER_SECOND 25 |
How many different audio buffers we want to schedule in one second. | |
#define | CALC_BUFFER(x) ( ( ( ( x ) / BUFFERS_PER_SECOND ) >> 3 ) << 3 ) |
Macro that calculates the size of a buffer based on frequency. | |
DAC rates for different regions | |
#define | AI_NTSC_DACRATE 48681818 |
NTSC DAC rate. | |
#define | AI_PAL_DACRATE 49656530 |
PAL DAC rate. | |
#define | AI_MPAL_DACRATE 48628322 |
MPAL DAC rate. | |
AI Status Register Values | |
#define | AI_STATUS_BUSY ( 1 << 30 ) |
Bit representing that the AI is busy. | |
#define | AI_STATUS_FULL ( 1 << 31 ) |
Bit representing that the AI is full. | |
Functions | |
void | audio_init (const int frequency, int numbuffers) |
Initialize the audio subsystem. | |
void | audio_set_buffer_callback (audio_fill_buffer_callback fill_buffer_callback) |
Install a audio callback to fill the audio buffer when required. | |
void | audio_close () |
Close the audio subsystem. | |
void | audio_pause (bool pause) |
Pause or resume audio playback. | |
void | audio_write (const short *const buffer) |
Write a chunk of audio data. | |
short * | audio_write_begin (void) |
Start writing to the first free internal buffer. | |
void | audio_write_end (void) |
Complete writing to an internal buffer. | |
void | audio_write_silence () |
Write a chunk of silence. | |
volatile int | audio_can_write () |
Return whether there is an empty buffer to write to. | |
int | audio_push (const short *buffer, int nsamples, bool blocking) |
Push a chunk of audio data (high-level function) | |
int | audio_get_frequency () |
Return actual frequency of audio playback. | |
int | audio_get_buffer_length () |
Get the number of stereo samples that fit into an allocated buffer. | |
Audio Subsystem.
#define CALC_BUFFER | ( | x | ) | ( ( ( ( x ) / BUFFERS_PER_SECOND ) >> 3 ) << 3 ) |
Macro that calculates the size of a buffer based on frequency.
[in] | x | Frequency the AI is running at |