e2d::audio::AudioManager Class Reference

List of all members.

Detailed Description

This class is responsible for controlling sound initialization and overall sound volume. Every Sound, when created, is automatically added to a list according to it's defined group (see Sound documentation for info on sound groups). You can set the group's volume, so all sounds of that group will be set to that volume.

Easy2D uses a library called Audiere (http://audiere.sourceforge.net/) for sound. This means Easy2D supports sounds of any format supported by Audiere. Also, different from Video, you do not need to explicitly Quit the sound subsystem.

This class is a Singleton, what means you can't create an instance of AudioManager yourself. It is available to you via Utilities.

Public Member Functions

void AddSound (Sound *sound)
 Adds a sound to the correspondent group.
audiere::AudioDevicePtr GetDevice ()
 Returs a reference to Audiere's sound device.
float GetGroupVolume (int group)
 Gets the volume set for a group.
void Init ()
 Initializes Audiere.
void Clear ()
 Cleans up sound table.
void SetGroupVolume (int group, float volume)
 Sets a volume for a group.

Static Public Member Functions

static AudioManagerGetInstance ()
 Gets an object for this class.

Member Function Documentation

void e2d::audio::AudioManager::AddSound ( Sound sound  ) 

Adds a sound to the correspondent group. This method is called internally by Easy2D (most precisely on Sound 's constructor), so you don't need to call it yourself.

sound Sound to be added

audiere::AudioDevicePtr e2d::audio::AudioManager::GetDevice (  ) 

With this method you can have direct access to Audiere's sound device. You really must know what you are doing if you intend to call this method.

Audiere's sound device

float e2d::audio::AudioManager::GetGroupVolume ( int  group  ) 

Gets the volume set for a group

group sound group, see Sound
the volume for that group

AudioManager * e2d::audio::AudioManager::GetInstance ( void   )  [static]

This class is a Singleton. If you want an instance of this class to work with, get it via this method.

void e2d::audio::AudioManager::Init (  ) 

Initializes Audiere.

e2d::core::Exception if Audiere initialization fails

void e2d::audio::AudioManager::Clear ( void   ) 

Deletes all sounds loaded. This method is called in Easy2D's clean up routines, so you just need to call it if you want to free sound memory in the middle of of your game.

void e2d::audio::AudioManager::SetGroupVolume ( int  group,
float  volume 

Sets a volume for a group. The volume's value must be between 0 and 1.

group sound group, see Sound
volume the volume for that group
e2d::core::Exception if volume is not between 0 and 1.

Generated on Tue Dec 8 10:32:44 2009 for Easy2D by  doxygen 1.5.6