snd::SoundPlib Class Reference

Sound class based on PLIB. More...

#include <snd_plib.hh>

Inheritance diagram for snd::SoundPlib:

snd::SoundAbstract

List of all members.

Public Member Functions

CLASS_METHOD SoundPlibGetInstance (void)
CLASS_METHOD void Disable (void)
void Play (const string &filename, const bool loop, const fp volume=DEFAULT_VOLUME)
void Stop (const string &filename)
void SetVolume (const string &filename, const fp volume)

Private Types

typedef map< string,
SharedPtr< Sample > > 
SampleMap

Private Member Functions

 SoundPlib (void)
 ~SoundPlib ()
void Pulse (void)
void EnqueueZombieSample (slSample *zombie)

Private Attributes

CLASS_VAR SoundPlibmsInstance
CLASS_VAR bool msEnabled = true
 for permanently disabling sound
SampleMap mSampleMap
 to load a sound file once but play it multiple times
slScheduler * mSched
 PLIB.
smMixer * mMixer
 PLIB.
set< slSample * > mZombieSamples
 samples that were discarded after changing volume (yuck)

Friends

class ListenerTick

Classes

struct  ListenerTick
class  Sample
 Defines a sound sample. More...


Detailed Description

Sound class based on PLIB.

Sounds are identified/keyed by filename.

Gory details of PLIB code is better structured by making Sample mostly private to Sound, but letting Sample have full access to Sound.


Member Typedef Documentation

typedef map<string,SharedPtr<Sample> > snd::SoundPlib::SampleMap [private]


Constructor & Destructor Documentation

snd::SoundPlib::SoundPlib ( void   )  [private]

ctor/dtor.

snd::SoundPlib::~SoundPlib (  )  [private]


Member Function Documentation

SoundPlib & snd::SoundPlib::GetInstance ( void   ) 

Singleton method.

Reimplemented from snd::SoundAbstract.

void snd::SoundPlib::Disable ( void   ) 

Enable() is omitted. If Disable() is ever called, it should be done during startup, before SoundPlib::GetInstance() is called.

Reimplemented from snd::SoundAbstract.

void snd::SoundPlib::Play ( const string &  filename,
const bool  loop,
const fp  volume = DEFAULT_VOLUME 
) [virtual]

Play audio file.

Parameters:
filename Identifies sound file.
loop Play continuously.
volume Default is DEFAULT_VOLUME.

Reimplemented from snd::SoundAbstract.

void snd::SoundPlib::Stop ( const string &  filename  )  [virtual]

Stop playing sample.

Reimplemented from snd::SoundAbstract.

void snd::SoundPlib::SetVolume ( const string &  filename,
const fp  volume 
) [virtual]

Set volume of sample.

Parameters:
volume 0.0 = off, 1.0 max volume.

Reimplemented from snd::SoundAbstract.

void snd::SoundPlib::Pulse ( void   )  [private]

void snd::SoundPlib::EnqueueZombieSample ( slSample *  zombie  )  [private]

Enqueue a zombie sample (possibly still playing).


Friends And Related Function Documentation

friend class ListenerTick [friend]


Member Data Documentation

SoundPlib * snd::SoundPlib::msInstance [private]

bool snd::SoundPlib::msEnabled = true [private]

for permanently disabling sound

SampleMap snd::SoundPlib::mSampleMap [private]

to load a sound file once but play it multiple times

slScheduler* snd::SoundPlib::mSched [private]

PLIB.

smMixer* snd::SoundPlib::mMixer [private]

PLIB.

set<slSample*> snd::SoundPlib::mZombieSamples [private]

samples that were discarded after changing volume (yuck)


The documentation for this class was generated from the following files: Palomino 3D Engine documents generated by doxygen 1.5.3 on Fri Nov 23 11:26:32 2007