OldSchool Library
General Audio Tasks

Functions for general audio management tasks. More...

Macros

#define OSL_NUM_AUDIO_CHANNELS   8
 
#define OSL_VOLUME_MAX   0x8000
 
#define oslAudioSetDefaultSampleNumber(num)
 Sets the default number of samples per audio buffer read.
 

Functions

int oslInitAudio ()
 Initializes the audio system.
 
void oslDeinitAudio ()
 Deinitializes the audio system.
 
void oslInitAudioME (int formats)
 Initializes Media Engine audio support.
 

Variables

int osl_audioDefaultNumSamples
 Default number of samples per buffer, initialized to 512.
 

Detailed Description

Functions for general audio management tasks.

Macro Definition Documentation

◆ OSL_NUM_AUDIO_CHANNELS

#define OSL_NUM_AUDIO_CHANNELS   8

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

◆ OSL_VOLUME_MAX

#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.

◆ oslAudioSetDefaultSampleNumber

#define oslAudioSetDefaultSampleNumber ( num)
Value:
int osl_audioDefaultNumSamples
Default number of samples per buffer, initialized to 512.

Sets the default number of samples per audio buffer read.

Increasing this number reduces CPU usage but can cause longer blocks of audio processing.

Parameters
numNew default number of samples per buffer.

Function Documentation

◆ oslInitAudio()

int oslInitAudio ( )
extern

Initializes the audio system.

This function must be called before any other audio-related functions to ensure proper operation.

◆ oslDeinitAudio()

void oslDeinitAudio ( )
extern

Deinitializes the audio system.

Call this function to stop all audio output and free resources. Make sure to delete all sound objects before calling this function.

◆ oslInitAudioME()

void oslInitAudioME ( int formats)
extern

Initializes Media Engine audio support.

This function is required for playing AT3 and MP3 files and may need additional privileges depending on the firmware version.

Parameters
formatsBitmask of formats to initialize, see oslInitAudioME_formats.