Polygon Dash
Loading...
Searching...
No Matches
AudioManager Class Reference

Manages playing/combining audio effects and background music. More...

Public Member Functions

 this ()
 Initialize SDL_Mixer.
 
 ~this ()
 Cleanup SDL_Mixer audio.
 
void AddAudioResource (string audioName, string audioPath)
 Load an AudioResource from a given file name.
 
void PlayIndefinitely (string audio, int volume=10)
 Play a given sound indefinitely.
 
void StopBackgroundMusic ()
 Stop playing all sounds that are playing indefinitely.
 
void PlayEffect (string audio, int volume=20, int loops=0)
 Play a given sound a certain number of times.
 
void StopAllEffects ()
 Stop playing all one-time sounds that are playing.
 

Public Attributes

AudioResource[string] mAudioResourceMap
 Stored AudioResource instances.
 
AudioRequest mBackgroundMusic
 The currently playing background music's AudioRequest.
 
bool mBackgroundMusicActive = false
 Whether any background music is currently being playes.
 
AudioRequest[] mEffects
 The currently playing sound effects that will not loop forever.
 

Detailed Description

Manages playing/combining audio effects and background music.

Instances of this class store loaded AudioResource and AudioRequest objects.

See also
AudioResource
AudioRequest

Member Function Documentation

◆ AddAudioResource()

void AudioManager::AddAudioResource ( string audioName,
string audioPath )
inline

Load an AudioResource from a given file name.

Parameters
audioNamethe name to use to reference this sound in the future.
audioPaththe path to a .wav file containing the audio.

◆ PlayEffect()

void AudioManager::PlayEffect ( string audio,
int volume = 20,
int loops = 0 )
inline

Play a given sound a certain number of times.

Parameters
audiothe name of the audio source to play.
volumean int controlling the volume at which to play.
loopsthe number of times to play the effect (default: 0).

◆ PlayIndefinitely()

void AudioManager::PlayIndefinitely ( string audio,
int volume = 10 )
inline

Play a given sound indefinitely.

Parameters
audiothe name of the audio source to play.
volumean int controlling the volume at which to play.

The documentation for this class was generated from the following file: