Public Member Functions | Static Public Member Functions | Public Attributes

Audio Class Reference

Audio manager. More...

#include <audio.h>

List of all members.

Public Member Functions

AudioSoundfindSound (unsigned int name_hash)
 Searches for the named sound effect.
void Update ()
 Updates the audio system.
AudioSoundPreloadSound (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

Detailed Description

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;

Member Function Documentation

AudioSound * Audio::findSound ( unsigned int  name_hash  ) 

Searches for the named sound effect.

Parameters:
name_hash String hash of sound effect name.
Returns:
null if it fails, else the found sound effect.
void Audio::PlayMusic ( const char *  filename,
bool  repeat = true 
) [static]

Play the specified music file.

Parameters:
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.

Parameters:
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.

Parameters:
filename Name of sound effect file.
Returns:
null if it fails, else the sound effect
void Audio::Update (  ) 

Updates the audio system.

This should be called each main loop update to ensure that sound effects are played back consistently.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations