Sound Class Reference

#include <Sound.h>

Inheritance diagram for Sound:

GameStateI

List of all members.

Public Member Functions

bool init (int channels)
bool getInit ()
void destroy ()
void showSoundBuffers ()
void soundPlay (std::vector< ConsoleRuleValue > &values)
SoundBufferfetchOrCreateBuffer (const std::string &filename)
SoundListenergetDefaultListener ()
void addManaged (VirtualSoundSource *source)
void addPlaying (VirtualSoundSource *source)
void removePlaying (VirtualSoundSource *source)
void simulate (const unsigned state, float simTime)
int getAvailableChannels ()
int getPlayingChannels ()

Static Public Member Functions

static Soundinstance ()

Protected Types

typedef std::map
< std::string,
SoundBuffer * > 
BufferMap
typedef std::vector
< SoundSource * > 
SourceList
typedef std::vector
< VirtualSoundSource * > 
VirtualSourceList
typedef std::vector
< PlayingSoundSource * > 
PlayingSourceList

Protected Member Functions

void updateSources ()
SoundBuffercreateBuffer (char *fileName)

Protected Attributes

float totalTime_
BufferMap bufferMap_
SourceList totalSources_
SourceList availableSources_
SoundListener listener_
VirtualSourceList managedSources_
PlayingSourceList playingSources_
bool init_

Static Protected Attributes

static Soundinstance_ = 0

Private Member Functions

 Sound ()
virtual ~Sound ()


Detailed Description

Definition at line 38 of file Sound.h.


Member Typedef Documentation

typedef std::map<std::string, SoundBuffer *> Sound::BufferMap [protected]

Definition at line 63 of file Sound.h.

typedef std::vector<SoundSource *> Sound::SourceList [protected]

Definition at line 64 of file Sound.h.

typedef std::vector<VirtualSoundSource *> Sound::VirtualSourceList [protected]

Definition at line 65 of file Sound.h.

typedef std::vector<PlayingSoundSource *> Sound::PlayingSourceList [protected]

Definition at line 66 of file Sound.h.


Constructor & Destructor Documentation

Sound::Sound (  )  [private]

Definition at line 52 of file Sound.cpp.

References ConsoleRuleTypeString, ConsoleUtil::formParams(), showSoundBuffers(), and soundPlay().

Sound::~Sound (  )  [private, virtual]

Definition at line 64 of file Sound.cpp.

References bufferMap_, init_, and totalSources_.


Member Function Documentation

Sound * Sound::instance (  )  [static]

Definition at line 42 of file Sound.cpp.

References instance_.

Referenced by ClientState::addMandatoryComponents(), SoundDialog::buttonDown(), ClientMain::clientMain(), SoundBufferFactory::createBuffer(), WeaponNapalm::fireWeapon(), HelpButtonDialog::PerformanceMenu::getMenuToolTip(), SoundListener::getPosition(), TankMovement::init(), ExplosionLaserBeamRenderer::init(), initHardware(), LandscapeSoundSoundFile::play(), VirtualSoundSource::play(), ClientDefenseHandler::processMessage(), ProgressDialogSync::progressChange(), SoundListener::setGain(), SoundListener::setOrientation(), SoundListener::setPosition(), SoundListener::setVelocity(), Teleport::simulate(), TankFired::simulate(), SoundAction::simulate(), ShieldHit::simulate(), Lightning::simulate(), Explosion::simulate(), MissileActionRenderer::simulate(), ExplosionRingRenderer::simulate(), LandscapeMusicManager::simulate(), MainCamera::simulate(), VirtualSoundSource::stop(), and VirtualSoundSource::VirtualSoundSource().

bool Sound::init ( int  channels  ) 

Definition at line 108 of file Sound.cpp.

References availableSources_, checkString(), SoundSource::create(), S3D::dialogMessage(), S3D::formatStringBuffer(), OptionsDisplay::getSoundChannels(), init_, OptionsDisplay::instance(), Logger::log(), and totalSources_.

bool Sound::getInit (  )  [inline]

Definition at line 44 of file Sound.h.

References init_.

void Sound::destroy (  ) 

Definition at line 97 of file Sound.cpp.

References instance_.

Referenced by ClientMain::clientMain().

void Sound::showSoundBuffers (  ) 

Definition at line 175 of file Sound.cpp.

References S3D::formatStringBuffer(), getAvailableChannels(), VirtualSoundSource::getBuffer(), VirtualSoundSource::getDistance(), SoundBuffer::getFileName(), VirtualSoundSource::getLooping(), VirtualSoundSource::getPlaying(), getPlayingChannels(), VirtualSoundSource::getPriority(), PlayingSoundSource::getStopped(), PlayingSoundSource::getVirtualSource(), Logger::log(), and playingSources_.

Referenced by Sound().

void Sound::soundPlay ( std::vector< ConsoleRuleValue > &  values  ) 

Definition at line 163 of file Sound.cpp.

References fetchOrCreateBuffer(), VirtualSoundSource::play(), VirtualSoundSource::setRelative(), and ConsoleRuleValue::valueString.

Referenced by Sound().

SoundBuffer * Sound::fetchOrCreateBuffer ( const std::string filename  ) 

Definition at line 438 of file Sound.cpp.

References bufferMap_, and createBuffer().

Referenced by WeaponNapalm::fireWeapon(), TankMovement::init(), ExplosionLaserBeamRenderer::init(), LandscapeSoundSoundFile::play(), ClientDefenseHandler::processMessage(), Teleport::simulate(), TankFired::simulate(), SoundAction::simulate(), ShieldHit::simulate(), Lightning::simulate(), Explosion::simulate(), MissileActionRenderer::simulate(), ExplosionRingRenderer::simulate(), LandscapeMusicManager::simulate(), and soundPlay().

SoundListener * Sound::getDefaultListener (  ) 

Definition at line 417 of file Sound.cpp.

References listener_.

Referenced by SoundDialog::buttonDown(), initHardware(), and MainCamera::simulate().

void Sound::addManaged ( VirtualSoundSource source  ) 

Definition at line 402 of file Sound.cpp.

References managedSources_.

Referenced by VirtualSoundSource::VirtualSoundSource().

void Sound::addPlaying ( VirtualSoundSource source  ) 

Definition at line 248 of file Sound.cpp.

References playingSources_, VirtualSoundSource::setPlayingSource(), and updateSources().

Referenced by VirtualSoundSource::play().

void Sound::removePlaying ( VirtualSoundSource source  ) 

Definition at line 390 of file Sound.cpp.

References VirtualSoundSource::getPlayingSource(), VirtualSoundSource::setPlayingSource(), PlayingSoundSource::setStopped(), PlayingSoundSource::setVirtualSource(), and updateSources().

Referenced by VirtualSoundSource::stop().

void Sound::simulate ( const unsigned  state,
float  simTime 
) [virtual]

Reimplemented from GameStateI.

Definition at line 205 of file Sound.cpp.

References SoundSource::getPlaying(), playingSources_, SoundSource::simulate(), totalTime_, and updateSources().

Referenced by ProgressDialogSync::progressChange().

int Sound::getAvailableChannels (  ) 

Definition at line 407 of file Sound.cpp.

References availableSources_.

Referenced by showSoundBuffers().

int Sound::getPlayingChannels (  ) 

Definition at line 412 of file Sound.cpp.

References playingSources_.

Referenced by showSoundBuffers().

void Sound::updateSources (  )  [protected]

Definition at line 258 of file Sound.cpp.

References VirtualSoundSource::actualPlay(), availableSources_, DIALOG_ASSERT, PlayingSoundSource::getActualSource(), VirtualSoundSource::getLooping(), VirtualSoundSource::getPlaying(), SoundSource::getPlaying(), SoundListener::getPosition(), PlayingSoundSource::getStopped(), PlayingSoundSource::getVirtualSource(), int(), listener_, lt_virt(), managedSources_, playingSources_, PlayingSoundSource::setActualSource(), VirtualSoundSource::setPlayingSource(), PlayingSoundSource::setStopped(), sort(), SoundSource::stop(), totalSources_, and VirtualSoundSource::updateDistance().

Referenced by addPlaying(), removePlaying(), and simulate().

SoundBuffer * Sound::createBuffer ( char *  fileName  )  [protected]

Definition at line 422 of file Sound.cpp.

References SoundBufferFactory::createBuffer(), S3D::dialogExit(), and S3D::formatStringBuffer().

Referenced by fetchOrCreateBuffer().


Member Data Documentation

Sound * Sound::instance_ = 0 [static, protected]

Definition at line 62 of file Sound.h.

Referenced by destroy(), and instance().

float Sound::totalTime_ [protected]

Definition at line 68 of file Sound.h.

Referenced by simulate().

BufferMap Sound::bufferMap_ [protected]

Definition at line 69 of file Sound.h.

Referenced by fetchOrCreateBuffer(), and ~Sound().

SourceList Sound::totalSources_ [protected]

Definition at line 70 of file Sound.h.

Referenced by init(), updateSources(), and ~Sound().

SourceList Sound::availableSources_ [protected]

Definition at line 71 of file Sound.h.

Referenced by getAvailableChannels(), init(), and updateSources().

SoundListener Sound::listener_ [protected]

Definition at line 72 of file Sound.h.

Referenced by getDefaultListener(), and updateSources().

VirtualSourceList Sound::managedSources_ [protected]

Definition at line 73 of file Sound.h.

Referenced by addManaged(), and updateSources().

PlayingSourceList Sound::playingSources_ [protected]

Definition at line 74 of file Sound.h.

Referenced by addPlaying(), getPlayingChannels(), showSoundBuffers(), simulate(), and updateSources().

bool Sound::init_ [protected]

Definition at line 75 of file Sound.h.

Referenced by getInit(), init(), and ~Sound().


The documentation for this class was generated from the following files:
Generated on Mon Feb 16 15:15:06 2009 for Scorched3D by  doxygen 1.5.3