libdragon
Typedefs | Functions
audio.h File Reference

Audio Subsystem. More...

Go to the source code of this file.

Typedefs

typedef void(* audio_fill_buffer_callback) (short *buffer, size_t numsamples)
 Will be called periodically when more sample data is needed. More...
 

Functions

void audio_init (const int frequency, int numbuffers)
 Initialize the audio subsystem. More...
 
void audio_set_buffer_callback (audio_fill_buffer_callback fill_buffer_callback)
 Install a audio callback to fill the audio buffer when required. More...
 
void audio_pause (bool pause)
 Pause or resume audio playback. More...
 
void audio_write (const short *const buffer)
 Write a chunk of audio data. More...
 
volatile int audio_can_write ()
 Return whether there is an empty buffer to write to. More...
 
void audio_write_silence ()
 Write a chunk of silence. More...
 
void audio_close ()
 Close the audio subsystem. More...
 
int audio_get_frequency ()
 Return actual frequency of audio playback. More...
 
int audio_get_buffer_length ()
 Get the number of stereo samples that fit into an allocated buffer. More...
 
short * audio_write_begin (void)
 Start writing to the first free internal buffer. More...
 
void audio_write_end (void)
 Complete writing to an internal buffer. More...
 

Detailed Description

Audio Subsystem.

Typedef Documentation

◆ audio_fill_buffer_callback

typedef void(* audio_fill_buffer_callback) (short *buffer, size_t numsamples)

Will be called periodically when more sample data is needed.

Parameters
[in]bufferThe address to write the sample data to
[in]numsamplesThe number of samples to write to the buffer Note: this is the number of samples per channel, so clients should write twice this number of samples (interleaved).