libnds
|
Functions to use the audio channels and microphone from the ARM7. More...
Typedefs | |
typedef void(* | MIC_BUF_SWAP_CB) (u8 *completedBuffer, int length) |
Callback called whenever one buffer used micStartRecording() is full. | |
Functions | |
void | disableSound (void) |
Disable sound hardware. | |
void | enableSound (void) |
Enable sound hardware and clear sound registers. | |
void | installSoundFIFO (void) |
Install the libnds sound FIFO handler. | |
static void | micOff (void) |
Turn the microphone OFF. | |
static void | micOn (void) |
Turn the microphone ON. | |
u16 | micReadData12 (void) |
Read a 12-bit unsigned value from the microphone. | |
s16 | micReadData16 (void) |
Read a 16-bit signed value from the microphone. | |
u8 | micReadData8 (void) |
Read a 8-bit unsigned value from the microphone. | |
void | micSetAmp (u8 control, u8 gain) |
Turn amplifier on or off and set the gain in db. | |
void | micStartRecording (u8 *buffer, int length, int freq, int timer, bool eightBitSample, MIC_BUF_SWAP_CB bufferSwapCallback) |
Start recording data from the microphone. | |
int | micStopRecording (void) |
Stop recording data, and return the length of data recorded. | |
void | micTimerHandler (void) |
Routine that must be called from a timer interrupt to get samples from the microphone. | |
bool | soundExtSetFrequencyTWL (unsigned int freq_khz) |
Set extended sound hardware frequency. | |
Functions to use the audio channels and microphone from the ARM7.
typedef void(* MIC_BUF_SWAP_CB) (u8 *completedBuffer, int length) |
Callback called whenever one buffer used micStartRecording() is full.
completedBuffer | Pointer to the buffer that has been filled. |
length | Size of the buffer in bytes. |
u16 micReadData12 | ( | void | ) |
Read a 12-bit unsigned value from the microphone.
s16 micReadData16 | ( | void | ) |
Read a 16-bit signed value from the microphone.
u8 micReadData8 | ( | void | ) |
Read a 8-bit unsigned value from the microphone.
Turn amplifier on or off and set the gain in db.
control | Use PM_AMP_ON or PM_AMP_OFF. |
gain | Use one of PM_GAIN_20, PM_GAIN_40, PM_GAIN_80 or PM_GAIN_160. |
void micStartRecording | ( | u8 * | buffer, |
int | length, | ||
int | freq, | ||
int | timer, | ||
bool | eightBitSample, | ||
MIC_BUF_SWAP_CB | bufferSwapCallback | ||
) |
Start recording data from the microphone.
Fills the buffer with data from the microphone. The buffer will be signed sound data at 16 kHz. Once the length of the buffer is reached, no more data will be stored. It uses the specified ARM7 timer.
buffer | Destination buffer. |
length | Destination buffer length in bytes. |
freq | Frequency of the recording. |
timer | Hardware timer to use to get samples from the microphone. |
eightBitSample | Set to true to record 8 bit samples instead of 12 bit. |
bufferSwapCallback | Callback called whenver the buffer is filled. |
int micStopRecording | ( | void | ) |
Stop recording data, and return the length of data recorded.
bool soundExtSetFrequencyTWL | ( | unsigned int | freq_khz | ) |
Set extended sound hardware frequency.
freq_khz | Frequency in KHz. The default is 32, but 47 is allowed too. |