General

Macros

#define OSL_NUM_AUDIO_CHANNELS   8
 
#define OSL_VOLUME_MAX   0x8000
 
#define oslAudioSetDefaultSampleNumber(num)   (osl_audioDefaultNumSamples = num)
 

Functions

int oslInitAudio ()
 
void oslDeinitAudio ()
 
void oslInitAudioME (int formats)
 

Detailed Description

General tasks for audio.

Macro Definition Documentation

#define OSL_NUM_AUDIO_CHANNELS   8

Number of audio channels. No more than 8 sounds can be played at once!

#define OSL_VOLUME_MAX   0x8000

This is the default volume for audio channels. Though the real maximum value is 0xffff, this value is the maximum value before distorsion may happen.

#define oslAudioSetDefaultSampleNumber (   num)    (osl_audioDefaultNumSamples = num)

Sets the default number of samples per read. If you generate more samples at once, OSLib will need less calls, making it faster. But more data will be read at once, and the CPU will be blocked for a longer time, which may be too much and cause screen tearing. It's only an advanced command, let it to default (512) if you don't know exactly what you are doing.

Function Documentation

int oslInitAudio ( )

Initializes the audio system. Don't forget to call this before trying to play any song. Maybe your application will not crash if you forget it, but weird things can happen randomly!

void oslDeinitAudio ( )

Deinitializes the audio system. No sound will output anymore. Call this for clean-up (saves memory).

However, before deinitializing audio, you should delete all sounds by yourself (oslDeleteSound).

void oslInitAudioME ( int  formats)

Initializes Media Engine audio (need to call this before loading an at3 or mp3 file).

\params formats
        One or more of the #oslInitAudioME_formats values, added together.

Note: Might require a HEN/CFW to work on firmware older than version 2.0! See the source code for more info.