GL Studio C++ Runtime API
SoundSystem Class Reference

Classes

class  ISoundSystemImpl
 Base class for all platform-specific implementations of the sound system. More...
 

Public Member Functions

 SoundSystem (int maxSounds)
 
 ~SoundSystem ()
 
bool IsValid () const
 
void Play (int which)
 
void Play (int which, float volumeOrDistance)
 
void LoadSound (const char *fn, int index)
 
void LoadSounds (const char *firstArg,...)
 
void ClearSound (int index)
 
void SetMasterVolume (float volume)
 
float GetMasterVolume () const
 

Constructor & Destructor Documentation

SoundSystem ( int  maxSounds)
explicit

Constructor

Parameters
maxSoundsMaximum number of soundfiles in the sound system
Exceptions
std::bad_allocif unable to allocate memory.

Destructor

Member Function Documentation

void ClearSound ( int  index)

Deletes the sound from the given index

Parameters
indexZero based index to clear
float GetMasterVolume ( ) const

Gets the master volume of the sound system, from 0.0 (min) to FLT_MAX (max)

Returns
The master volume of the sound system, from 0.0 (min) to FLT_MAX (max)
bool IsValid ( ) const

Returns whether the sound device was initialized sucessfully

void LoadSound ( const char *  fn,
int  index 
)

Loads the sound from a file into a slot in the sound system

Parameters
fnThe name of the file to load from
indexThe zero based index to load the file into
Exceptions
std::bad_allocif unable to allocate memory
void LoadSounds ( const char *  firstArg,
  ... 
)

Loads a number of sounds from files into the sound system The sounds are loaded sequentially starting at slot zero

Parameters
firstArgFilenames to load, followed by a NULL
Exceptions
std::bad_allocif unable to allocate memory
void Play ( int  which)

Plays the sound at the given index

Parameters
whichThe zero based index of the sound to play
void Play ( int  which,
float  volumeOrDistance 
)

Plays the sound at the given index, attenuated for distancec

Parameters
whichThe zero based index of the sound to play
volumeOrDistanceThe volume of the sound, from 0.0 (min) to FLT_MAX (max) or the distance in meters of the sound, depending on the platform.
void SetMasterVolume ( float  volume)

Sets the master volume of the sound system, from 0.0 (min) to FLT_MAX (max)

Parameters
volumeThe master volume of the sound system, from 0.0 (min) to FLT_MAX (max)

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