Defines | Functions

audio.c File Reference

Audio Subsystem. More...

#include <stdio.h>
#include <string.h>
#include <malloc.h>
#include "libdragon.h"
#include "regsinternal.h"

Defines

#define TV_TYPE_LOC   0x80000300
 Memory location to read which determines the TV type.
#define NUM_BUFFERS   4
 Number of buffers the audio subsytem allocates and manages.
#define CALC_BUFFER(x)   ( ( ( ( x ) / 25 ) >> 3 ) << 3 )
 Macro that calculates the size of a buffer based on frequency.
DAC rates for different regions

#define AI_NTSC_DACRATE   48681812
 NTSC DAC rate.
#define AI_PAL_DACRATE   49656530
 PAL DAC rate.
#define AI_MPAL_DACRATE   48628316
 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_close ()
 Close the audio subsystem.
void audio_write (const short *const buffer)
 Write a chunk of audio data.
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_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.

Detailed Description

Audio Subsystem.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines