PAlib
Data Structures | Macros | Enumerations | Functions
ASlib functions

Data Structures

struct  SoundInfo
 Sound info. More...
 

Macros

#define AS_SoundQuickPlay(name)   AS_SoundDefaultPlay((u8*)name, (u32)name##_size, 127, 64, false, 0)
 Easiest way to play a sound, using default settings.
 

Enumerations

enum  MP3Command {
}
 MP3 commands. More...
 
enum  SoundCommand {
}
 Sound commands. More...
 
enum  MP3Status {
  MP3ST_STOPPED = 0 , MP3ST_PLAYING = 1 , MP3ST_PAUSED = 2 , MP3ST_OUT_OF_DATA = 4 ,
  MP3ST_DECODE_ERROR = 8 , MP3ST_INITFAILED = 16
}
 MP3 states. More...
 
enum  AS_MODE { AS_MODE_MP3 = 1 , AS_MODE_SURROUND = 2 , AS_MODE_16CH = 4 , AS_MODE_8CH = 8 }
 ASlib modes. More...
 
enum  AS_DELAY { AS_NO_DELAY = 0 , AS_SURROUND = 1 , AS_REVERB = 4 }
 Delay values. More...
 
enum  AS_SOUNDFORMAT { AS_PCM_8BIT = 0 , AS_PCM_16BIT = 1 , AS_ADPCM = 2 }
 Sound formats. More...
 

Functions

bool AS_Init (u8 mode)
 Initialize ASlib Returns true on success, false on failure.
 
static void AS_ReserveChannel (u8 channel)
 Reserve a particular DS channel (so it won't be used for the sound pool)
 
static void AS_SetMasterVolume (u8 volume)
 Set the master volume (0..127)
 
static void AS_SetDefaultSettings (u8 format, s32 rate, u8 delay)
 Set the default sound settings.
 
int AS_SoundPlay (SoundInfo sound)
 Play a sound using the priority system. Returns the sound channel allocated or -1 if the sound was skipped.
 
static int AS_SoundDefaultPlay (u8 *data, u32 size, u8 volume, u8 pan, u8 loop, u8 prio)
 Play a sound using the priority system with the default settings. Returns the sound channel allocated or -1 if the sound was skipped.
 
void AS_SetSoundPan (u8 chan, u8 pan)
 Set the panning of a sound (0=left, 64=center, 127=right)
 
void AS_SetSoundVolume (u8 chan, u8 volume)
 Set the volume of a sound (0..127)
 
void AS_SetSoundRate (u8 chan, u32 rate)
 Set the sound sample rate.
 
static void AS_SoundStop (u8 chan)
 Stop playing a sound.
 
void AS_SoundDirectPlay (u8 chan, SoundInfo sound)
 Play a sound directly using the given channel.
 
void AS_MP3DirectPlay (u8 *buffer, u32 size)
 Play a MP3 directly from memory.
 
bool AS_MP3StreamPlay (const char *path)
 Play a MP3 stream.
 
static void AS_MP3Pause ()
 Pause a MP3.
 
static void AS_MP3Unpause ()
 Unpause a MP3.
 
void AS_MP3Stop ()
 Stop a MP3.
 
static int AS_GetMP3Status ()
 Get the current MP3 status.
 
static void AS_SetMP3Volume (u8 volume)
 Set the MP3 volume (0..127)
 
void AS_SetMP3Pan (u8 pan)
 Set the MP3 panning (0=left, 64=center, 127=right)
 
static void AS_SetMP3Delay (u8 delay)
 Set the default MP3 delay mode (warning: high values can cause glitches)
 
static void AS_SetMP3Loop (u8 loop)
 Set the MP3 loop mode (false = one shot, true = loop indefinitely)
 
static void AS_SetMP3Rate (s32 rate)
 Set the MP3 sample rate.
 
void AS_SoundVBL ()
 Regenerate buffers for MP3 stream. Must be called each VBlank (only needed if mp3 is used)
 

Detailed Description

Functions to play RAW sounds and shrug MP3s.

Enumeration Type Documentation

◆ MP3Command

enum MP3Command

MP3 commands.

Enumerator
MP3CMD_INIT 

Initialize.

MP3CMD_STOP 

Stop.

MP3CMD_PLAY 

Play.

MP3CMD_PAUSE 

Pause.

MP3CMD_SETRATE 

Set rate.

◆ SoundCommand

Sound commands.

Enumerator
SNDCMD_STOP 

Stop.

SNDCMD_PLAY 

Play.

SNDCMD_SETVOLUME 

Set volume.

SNDCMD_SETPAN 

Set pan.

SNDCMD_SETRATE 

Set rate.

SNDCMD_SETMASTERVOLUME 

Set master volume.

◆ MP3Status

enum MP3Status

MP3 states.

Enumerator
MP3ST_STOPPED 

Stopped.

MP3ST_PLAYING 

Playing.

MP3ST_PAUSED 

Paused.

MP3ST_OUT_OF_DATA 

Out of data.

MP3ST_DECODE_ERROR 

Decoding error.

MP3ST_INITFAILED 

Initialization failed.

◆ AS_MODE

enum AS_MODE

ASlib modes.

Enumerator
AS_MODE_MP3 

use mp3

AS_MODE_SURROUND 

use surround

AS_MODE_16CH 

use all DS channels

AS_MODE_8CH 

use DS channels 1-8 only

◆ AS_DELAY

enum AS_DELAY

Delay values.

Enumerator
AS_NO_DELAY 

0 ms delay

AS_SURROUND 

16 ms delay

AS_REVERB 

66 ms delay

◆ AS_SOUNDFORMAT

Sound formats.

Enumerator
AS_PCM_8BIT 

8-bit PCM

AS_PCM_16BIT 

16-bit PCM

AS_ADPCM 

4-bit ADPCM