#include <audio.h>
Public Member Functions | |
AudioSound * | findSound (unsigned int name_hash) |
Searches for the named sound effect. | |
void | Update () |
Updates the audio system. | |
AudioSound * | PreloadSound (const char *filename) |
Preload a sound effect. | |
void | PlaySound (const char *filename) |
Play the specified sound effect. | |
Static Public Member Functions | |
static void | PlayMusic (const char *filename, bool repeat=true) |
Play the specified music file. | |
static void | StopMusic () |
Stops currently playing music. | |
Public Attributes | |
std::list< AudioSound * > | m_Sounds |
Audio manager.
The audio manager is responsible for management of sound effects, update of the audio system and play back of sound effects and background music.
Example usage:
// Set up audio systems g_pAudio = new Audio(); // Update while (!s3eDeviceCheckQuitRequest()) { // Update audio system g_pAudio->Update(); } // Cleanup delete g_pAudio;
AudioSound * Audio::findSound | ( | unsigned int | name_hash | ) |
Searches for the named sound effect.
name_hash | String hash of sound effect name. |
void Audio::PlayMusic | ( | const char * | filename, | |
bool | repeat = true | |||
) | [static] |
Play the specified music file.
filename | Name of the audio file to play (MP3 format only) | |
repeat | true to repeat play back. |
void Audio::PlaySound | ( | const char * | filename | ) |
Play the specified sound effect.
Once a suond effect has been played it will be cached in the audio manager so future play back will not be hindered by having to re-load the sound effect from storage.
filename | Filename of the sound effect. |
AudioSound * Audio::PreloadSound | ( | const char * | filename | ) |
Preload a sound effect.
The sound effect will be added to the audio managers list of loaded sound effects. If the sound effect already exists within the audio manager then no sound effect will be loaded. Its useful to preload larger sound effects during app set-up to prevent delays when playing audio back during game play.
filename | Name of sound effect file. |
void Audio::Update | ( | ) |
Updates the audio system.
This should be called each main loop update to ensure that sound effects are played back consistently.