libnds
|
A simple sound playback library for the DS. Provides functionality for starting and stopping sound effects from the ARM9 side as well as access to PSG and noise hardware. Maxmod should be used in most music and sound effect situations. More...
#include <nds/ndstypes.h>
Enumerations |
Functions | |
void | soundDisable (void) |
Disables Sound on the DS. | |
void | soundEnable (void) |
Enables Sound on the DS. Should be called prior to attempting sound playback. | |
void | soundKill (int soundId) |
Stops the sound specified by soundId and frees any resources allocated. More... | |
void | soundMicOff (void) |
Stops the microphone from recording. | |
int | soundMicRecord (void *buffer, u32 bufferLength, MicFormat format, int freq, MicCallback callback) |
Starts a microphone recording to a double buffer specified by buffer. More... | |
void | soundPause (int soundId) |
Pause the sound specified by soundId. More... | |
int | soundPlayNoise (u16 freq, u8 volume, u8 pan) |
Plays white noise with the specified parameters. More... | |
int | soundPlayPSG (DutyCycle cycle, u16 freq, u8 volume, u8 pan) |
Pause a tone with the specified properties. More... | |
int | soundPlaySample (const void *data, SoundFormat format, u32 dataSize, u16 freq, u8 volume, u8 pan, bool loop, u16 loopPoint) |
Plays a sound in the specified format at the specified frequency. More... | |
void | soundResume (int soundId) |
Resumes a paused sound. More... | |
void | soundSetFreq (int soundId, u16 freq) |
Sets the sound frequency. More... | |
void | soundSetPan (int soundId, u8 pan) |
Sets the sound pan. More... | |
void | soundSetVolume (int soundId, u8 volume) |
Sets the sound volume. More... | |
void | soundSetWaveDuty (int soundId, DutyCycle cycle) |
Sets the Wave Duty of a PSG sound. More... | |
A simple sound playback library for the DS. Provides functionality for starting and stopping sound effects from the ARM9 side as well as access to PSG and noise hardware. Maxmod should be used in most music and sound effect situations.
enum DutyCycle |
enum MicFormat |
enum SoundFormat |
void soundKill | ( | int | soundId | ) |
Stops the sound specified by soundId and frees any resources allocated.
soundId | The sound ID returned by play sound |
int soundMicRecord | ( | void * | buffer, |
u32 | bufferLength, | ||
MicFormat | format, | ||
int | freq, | ||
MicCallback | callback | ||
) |
Starts a microphone recording to a double buffer specified by buffer.
buffer | A pointer to the start of the double buffer |
bufferLength | The length of the buffer in bytes (both halfs of the double buffer) |
format | Microphone can record in 8 or 12 bit format. 12 bit is shifted up to 16 bit pcm |
freq | The sample frequency |
callback | This will be called every time the buffer is full or half full |
void soundPause | ( | int | soundId | ) |
Pause the sound specified by soundId.
soundId | The sound ID returned by play sound |
Plays white noise with the specified parameters.
freq | The frequency in Hz of the sample |
volume | The channel volume. 0 to 127 (min to max) |
pan | The channel pan 0 to 127 (left to right with 64 being centered) |
Pause a tone with the specified properties.
cycle | The DutyCycle of the sound wave |
freq | The frequency in Hz of the sample |
volume | The channel volume. 0 to 127 (min to max) |
pan | The channel pan 0 to 127 (left to right with 64 being centered) |
int soundPlaySample | ( | const void * | data, |
SoundFormat | format, | ||
u32 | dataSize, | ||
u16 | freq, | ||
u8 | volume, | ||
u8 | pan, | ||
bool | loop, | ||
u16 | loopPoint | ||
) |
Plays a sound in the specified format at the specified frequency.
data | A pointer to the sound data |
format | The format of the data (only 16-bit and 8-bit pcm and ADPCM formats are supported by this function) |
dataSize | The size in bytes of the sound data |
freq | The frequency in Hz of the sample |
volume | The channel volume. 0 to 127 (min to max) |
pan | The channel pan 0 to 127 (left to right with 64 being centered) |
loop | If true, the sample will loop playing once then repeating starting at the offset stored in loopPoint |
loopPoint | The offset for the sample loop to restart when repeating |
void soundResume | ( | int | soundId | ) |
Resumes a paused sound.
soundId | The sound ID returned by play sound |
void soundSetFreq | ( | int | soundId, |
u16 | freq | ||
) |
Sets the sound frequency.
soundId | The sound ID returned by play sound |
freq | The frequency in Hz |
void soundSetPan | ( | int | soundId, |
u8 | pan | ||
) |
Sets the sound pan.
soundId | The sound ID returned by play sound |
pan | The new pan value (0 to 127 left to right (64 = center)) |
void soundSetVolume | ( | int | soundId, |
u8 | volume | ||
) |
Sets the sound volume.
soundId | The sound ID returned by play sound |
volume | The new volume (0 to 127 min to max) |
void soundSetWaveDuty | ( | int | soundId, |
DutyCycle | cycle | ||
) |
Sets the Wave Duty of a PSG sound.
soundId | The sound ID returned by play sound |
cycle | The DutyCycle of the sound wave |