Sound and MP3 functions


Structures de données

struct  SoundInfo
 sound info Plus de détails...
struct  SoundChannel
 sound channel info Plus de détails...
struct  MP3Player
 MP3 player info. Plus de détails...
struct  IPC_SoundSystem
 IPC structure for the sound system. Plus de détails...

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

Énumérations

enum  MP3Command {
  MP3CMD_ARM9ALLOCDONE = 256, MP3CMD_NONE = 0, MP3CMD_MIX = 1, MP3CMD_MIXING = 2,
  MP3CMD_WAITING = 4, MP3CMD_INIT = 8, MP3CMD_STOP = 16, MP3CMD_PLAY = 32,
  MP3CMD_PAUSE = 64, MP3CMD_SETRATE = 128
}
 mp3 commands Plus de détails...
enum  SoundCommand {
  SNDCMD_ARM7READY = 128, SNDCMD_NONE = 0, SNDCMD_DELAY = 1, SNDCMD_STOP = 2,
  SNDCMD_PLAY = 4, SNDCMD_SETVOLUME = 8, SNDCMD_SETPAN = 16, SNDCMD_SETRATE = 32,
  SNDCMD_SETMASTERVOLUME = 64
}
 sound commands Plus de détails...
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 Plus de détails...
enum  AS_MODE { AS_MODE_MP3 = 1, AS_MODE_SURROUND = 2, AS_MODE_16CH = 4, AS_MODE_8CH = 8 }
 ASlib modes. Plus de détails...
enum  AS_DELAY { AS_NO_DELAY = 0, AS_SURROUND = 1, AS_REVERB = 4 }
 delay values Plus de détails...
enum  AS_SOUNDFORMAT { AS_PCM_8BIT = 0, AS_PCM_16BIT = 1, AS_ADPCM = 2 }
 sound formats Plus de détails...

Fonctions

void AS_Init (u8 mode)
 initialize the ASLib
void AS_ReserveChannel (u8 channel)
 reserve a particular DS channel (so it won't be used for the sound pool)
void AS_SetMasterVolume (u8 volume)
 set the master volume (0..127)
void AS_SetDefaultSettings (u8 format, s32 rate, u8 delay)
 set the default sound settings
int AS_SoundPlay (SoundInfo sound)
int AS_SoundDefaultPlay (u8 *data, u32 size, u8 volume, u8 pan, u8 loop, u8 prio)
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
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 an mp3 directly from memory
void AS_MP3StreamPlay (char *path)
 play an mp3 stream
void AS_MP3Pause ()
 pause an mp3
void AS_MP3Unpause ()
 unpause an mp3
void AS_MP3Stop ()
 stop an mp3
int AS_GetMP3Status ()
 get the current mp3 status
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)
void AS_SetMP3Delay (u8 delay)
 set the default mp3 delay mode (warning: high values can cause glitches)
void AS_SetMP3Loop (u8 loop)
 set the mp3 loop mode (false = one shot, true = loop indefinitely)
void AS_SetMP3Rate (s32 rate)
 set the mp3 sample rate
void AS_SoundVBL ()
void AS_MP3FillBuffer (u8 *buffer, u32 bytes)
 private functions, defined in as_lib9.cpp

Variables

MP3FILE * mp3file
 variables defined in as_lib9.cpp
u8 as_default_format
s32 as_default_rate
u8 as_default_delay

Description détaillée

Functions to play sounds and mp3s.

Documentation des 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


Documentation du type de l'énumération

enum AS_DELAY

delay values

Valeurs énumérées:
AS_NO_DELAY 
AS_SURROUND  0 ms delay
AS_REVERB  16 ms delay

enum AS_MODE

ASlib modes.

Valeurs énumérées:
AS_MODE_MP3 
AS_MODE_SURROUND  use mp3
AS_MODE_16CH  use surround
AS_MODE_8CH  use all DS channels

sound formats

Valeurs énumérées:
AS_PCM_8BIT 
AS_PCM_16BIT 
AS_ADPCM 

enum MP3Command

mp3 commands

Valeurs énumérées:
MP3CMD_ARM9ALLOCDONE  internal commands
MP3CMD_NONE 
MP3CMD_MIX 
MP3CMD_MIXING 
MP3CMD_WAITING 
MP3CMD_INIT  user commands
MP3CMD_STOP 
MP3CMD_PLAY 
MP3CMD_PAUSE 
MP3CMD_SETRATE 

enum MP3Status

mp3 states

Valeurs énumérées:
MP3ST_STOPPED 
MP3ST_PLAYING 
MP3ST_PAUSED 
MP3ST_OUT_OF_DATA 
MP3ST_DECODE_ERROR 
MP3ST_INITFAILED 

sound commands

Valeurs énumérées:
SNDCMD_ARM7READY  internal commands
SNDCMD_NONE 
SNDCMD_DELAY 
SNDCMD_STOP  user commands
SNDCMD_PLAY 
SNDCMD_SETVOLUME 
SNDCMD_SETPAN 
SNDCMD_SETRATE 
SNDCMD_SETMASTERVOLUME 


Documentation des fonctions

int AS_GetMP3Status (  )  [inline]

get the current mp3 status

void AS_Init ( u8  mode  ) 

initialize the ASLib

void AS_MP3DirectPlay ( u8 *  buffer,
u32  size 
)

play an mp3 directly from memory

void AS_MP3FillBuffer ( u8 *  buffer,
u32  bytes 
)

private functions, defined in as_lib9.cpp

void AS_MP3Pause (  )  [inline]

pause an mp3

void AS_MP3Stop (  )  [inline]

stop an mp3

void AS_MP3StreamPlay ( char *  path  ) 

play an mp3 stream

void AS_MP3Unpause (  )  [inline]

unpause an mp3

void AS_ReserveChannel ( u8  channel  )  [inline]

reserve a particular DS channel (so it won't be used for the sound pool)

void AS_SetDefaultSettings ( u8  format,
s32  rate,
u8  delay 
) [inline]

set the default sound settings

void AS_SetMasterVolume ( u8  volume  )  [inline]

set the master volume (0..127)

void AS_SetMP3Delay ( u8  delay  )  [inline]

set the default mp3 delay mode (warning: high values can cause glitches)

void AS_SetMP3Loop ( u8  loop  )  [inline]

set the mp3 loop mode (false = one shot, true = loop indefinitely)

void AS_SetMP3Pan ( u8  pan  ) 

set the mp3 panning (0=left, 64=center, 127=right)

void AS_SetMP3Rate ( s32  rate  )  [inline]

set the mp3 sample rate

void AS_SetMP3Volume ( u8  volume  )  [inline]

set the mp3 volume (0..127)

void AS_SetSoundPan ( u8  chan,
u8  pan 
)

set the panning of a sound (0=left, 64=center, 127=right)

void AS_SetSoundRate ( u8  chan,
u32  rate 
)

set the sound sample rate

void AS_SetSoundVolume ( u8  chan,
u8  volume 
)

set the volume of a sound (0..127)

int AS_SoundDefaultPlay ( u8 *  data,
u32  size,
u8  volume,
u8  pan,
u8  loop,
u8  prio 
) [inline]

play a sound using the priority system with the default settings return the sound channel allocated or -1 if the sound was skipped

void AS_SoundDirectPlay ( u8  chan,
SoundInfo  sound 
)

play a sound directly using the given channel

int AS_SoundPlay ( SoundInfo  sound  ) 

play a sound using the priority system return the sound channel allocated or -1 if the sound was skipped

void AS_SoundStop ( u8  chan  )  [inline]

stop playing a sound

void AS_SoundVBL (  ) 

regenerate buffers for mp3 stream must be called each VBlank (only needed if mp3 is used)


Documentation des variables

MP3FILE* mp3file

variables defined in as_lib9.cpp

------------------------------------------------------------------------------- definition of inlined functions -------------------------------------------------------------------------------


Généré le Sat Jun 13 12:57:00 2009 pour PAlib - Programmer's Arsenal par  doxygen 1.5.8