OgreSND::SoundMgr Class Reference

#include <SoundMgr.h>

List of all members.

Public Member Functions

 SoundMgr (OgreGFX::GraphicsInteractionManager *gim)
 ~SoundMgr ()
void initialize ()
void crosslink ()
void loadLevel ()
void tick (double dtime)
void releaseLevel ()
void cleanup ()
void enable ()
void disable ()
virtual bool frameRenderingQueued (const Ogre::FrameEvent &evt)
virtual bool frameStarted (const Ogre::FrameEvent &evt)
virtual bool frameEnded (const Ogre::FrameEvent &evt)
void printAudioDevices (const ALCchar *devices)
int printError (const char *ermsg)
ALenum toALFormat (short channels, short samples)
void syncListenerToCamera ()
void attachSelectedNodeToSoundIndex (OgreGFX::GFXNode *gfxNode, unsigned int index)
bool playEntityBornSound (FastEcslent::EntityType et, OgreGFX::GFXNode *gfxNode)
bool playExplosionSound (FastEcslent::EntityType et, OgreGFX::GFXNode *gfxNode)
bool playExplosionSound (OgreGFX::GFXNode *gfxNode)
bool playSelectionSound (FastEcslent::EntityType et, OgreGFX::GFXNode *gfxNode)
bool loadAudio (std::string filename, int sid)
bool loadStartBackground ()
bool stopBackground ()
bool pauseBackground ()
bool resumeBackground ()
bool registerCreate (FastEcslent::EntityType et, std::string filename)
bool registerSelection (FastEcslent::EntityType et, std::string filename)
bool registerBattleSound (FastEcslent::EntityType et, std::string filename)
bool isEntityShip (FastEcslent::EntityType et)
bool initWatercraftSounds ()
bool reserveAudio (std::string filename, bool loop, unsigned int &alSourceInfoIndex)
bool releaseSource (ALuint audioId)
bool releaseSourceIndex (int sid)
bool playAudio (ALuint audioId, bool forceRestart)
bool playAudio (ALuint audioId)
bool playAudioSourceIndex (int sid, bool forceRestart)
bool playAudioSourceIndex (int sid)
void copySoundState ()
bool isAudioPlaying (ALuint audioId)
bool stopAudio (ALuint audioID)
bool stopAllAudio (void)
bool stopAudioSourceIndex (int sid)
bool pauseAudio (ALuint audioID)
bool pauseAllAudio (void)
bool pauseAudioSourceIndex (int sid)
bool resumeAudio (ALuint audioID)
bool resumeAllAudio (void)
bool resumeAudioSourceIndex (int sid)
bool setSoundPosition (ALuint audioID, Ogre::Vector3 position)
bool setSoundDisposition (ALuint audioID, Ogre::Vector3 position, Ogre::Vector3 velocity, Ogre::Vector3 direction)
bool setSound (ALuint audioID, Ogre::Vector3 position, Ogre::Vector3 velocity, Ogre::Vector3 direction, float maxDistance, bool playNow, bool forceRestart, float minGain)
bool setListenerDisposition (Ogre::Vector3 position, Ogre::Vector3 velocity, Ogre::Quaternion orientation)

Private Member Functions

std::string getFQFNFromFilename (std::string filename)
int getBufferId (std::string filename)
int getEmptySourceIndex ()
bool resetSource (ALuint sid)

Private Attributes

OgreGFX::GraphicsInteractionManagergim
ALCdevice * device
ALCcontext * context
ALfloat position [3]
ALfloat velocity [3]
ALfloat orientation [6]
SourceInfo sourceInfo [maxAudioSources]
BufferInfo bufferInfo [maxAudioBuffers]
ALuint backgroundMusicBuffer
ALuint backgroundMusicSource
ALuint battleSoundSource
WaveInfo * backgroundWaveInfo
unsigned int soundDictionary [FastEcslent::NENTITYTYPES]
std::vector< std::string > sourceDictionary
int creationSoundsDictionary [FastEcslent::NENTITYTYPES][soundPerEnt]
int selectionSoundsDictionary [FastEcslent::NENTITYTYPES][soundPerEnt]
int battleSoundsDictionary [FastEcslent::NENTITYTYPES][soundPerEnt]
bool isEnabled


Detailed Description

Definition at line 47 of file SoundMgr.h.


Constructor & Destructor Documentation

SoundMgr::SoundMgr ( OgreGFX::GraphicsInteractionManager gim  ) 

Definition at line 13 of file SoundMgr.cpp.

SoundMgr::~SoundMgr (  ) 

Definition at line 18 of file SoundMgr.cpp.

References context, device, OgreSND::maxAudioBuffers, and OgreSND::maxAudioSources.


Member Function Documentation

std::string SoundMgr::getFQFNFromFilename ( std::string  filename  )  [private]

Definition at line 714 of file SoundMgr.cpp.

Referenced by loadAudio(), and loadStartBackground().

int SoundMgr::getBufferId ( std::string  filename  )  [private]

Definition at line 445 of file SoundMgr.cpp.

References loadAudio(), and OgreSND::maxAudioBuffers.

Referenced by reserveAudio().

int SoundMgr::getEmptySourceIndex (  )  [private]

Definition at line 471 of file SoundMgr.cpp.

References OgreSND::maxAudioSources.

Referenced by reserveAudio().

bool SoundMgr::resetSource ( ALuint  sid  )  [private]

Definition at line 658 of file SoundMgr.cpp.

References printError().

Referenced by reserveAudio().

void SoundMgr::initialize ( void   ) 

Definition at line 51 of file SoundMgr.cpp.

References backgroundMusicSource, battleSoundsDictionary, battleSoundSource, OgreSND::BufferInfo::buffer, OgreSND::BufferInfo::bufferFilename, bufferInfo, context, creationSoundsDictionary, device, initWatercraftSounds(), OgreSND::SourceInfo::inUse, isEnabled, loadStartBackground(), OgreSND::maxAudioBuffers, OgreSND::maxAudioSources, FastEcslent::NENTITYTYPES, selectionSoundsDictionary, OgreSND::soundPerEnt, OgreSND::SourceInfo::source, sourceDictionary, and sourceInfo.

Referenced by OgreGFX::GraphicsInteractionManager::createSoundMgr().

void SoundMgr::crosslink ( void   ) 

Definition at line 213 of file SoundMgr.cpp.

References syncListenerToCamera().

void SoundMgr::loadLevel ( void   ) 

Definition at line 218 of file SoundMgr.cpp.

References syncListenerToCamera().

void SoundMgr::tick ( double  dtime  ) 

Definition at line 242 of file SoundMgr.cpp.

References FastEcslent::Entity::didSelectSoundPlayed, FastEcslent::Entity::engine, OgreGFX::GraphicsInteractionManager::engine, FastEcslent::Entity::entityId, FastEcslent::Engine::entityMgr, FastEcslent::Entity::entityType, OgreGFX::GraphicsInteractionManager::gfxNodes, gim, FastEcslent::Entity::isNewBorn, FastEcslent::Entity::isSelected, OgreGFX::GraphicsInteractionManager::nGFXNodes, playEntityBornSound(), playSelectionSound(), and syncListenerToCamera().

Referenced by frameRenderingQueued().

void SoundMgr::releaseLevel ( void   ) 

Definition at line 387 of file SoundMgr.cpp.

void SoundMgr::cleanup ( void   ) 

Definition at line 392 of file SoundMgr.cpp.

void SoundMgr::enable (  ) 

Definition at line 152 of file SoundMgr.cpp.

References isEnabled, and resumeBackground().

void SoundMgr::disable (  ) 

Definition at line 157 of file SoundMgr.cpp.

References isEnabled, stopAllAudio(), and stopBackground().

bool SoundMgr::frameRenderingQueued ( const Ogre::FrameEvent &  evt  )  [virtual]

Definition at line 199 of file SoundMgr.cpp.

References tick().

bool SoundMgr::frameStarted ( const Ogre::FrameEvent &  evt  )  [virtual]

Definition at line 204 of file SoundMgr.cpp.

bool SoundMgr::frameEnded ( const Ogre::FrameEvent &  evt  )  [virtual]

Definition at line 207 of file SoundMgr.cpp.

void SoundMgr::printAudioDevices ( const ALCchar *  devices  ) 

Definition at line 396 of file SoundMgr.cpp.

References device.

int SoundMgr::printError ( const char *  ermsg  ) 

Definition at line 412 of file SoundMgr.cpp.

Referenced by isAudioPlaying(), loadAudio(), loadStartBackground(), pauseAudio(), pauseBackground(), playAudio(), releaseSourceIndex(), reserveAudio(), resetSource(), resumeBackground(), setSoundDisposition(), setSoundPosition(), stopAudio(), stopBackground(), and syncListenerToCamera().

ALenum SoundMgr::toALFormat ( short  channels,
short  samples 
) [inline]

Definition at line 421 of file SoundMgr.cpp.

Referenced by loadAudio(), and loadStartBackground().

void SoundMgr::syncListenerToCamera (  ) 

Definition at line 163 of file SoundMgr.cpp.

References gim, orientation, position, printError(), OgreGFX::GraphicsInteractionManager::uiMgr, and velocity.

Referenced by crosslink(), loadLevel(), and tick().

void SoundMgr::attachSelectedNodeToSoundIndex ( OgreGFX::GFXNode gfxNode,
unsigned int  index 
)

Definition at line 233 of file SoundMgr.cpp.

References OgreGFX::GFXNode::node, playAudio(), and setSoundPosition().

Referenced by copySoundState().

bool SoundMgr::playEntityBornSound ( FastEcslent::EntityType  et,
OgreGFX::GFXNode gfxNode 
)

Definition at line 324 of file SoundMgr.cpp.

References creationSoundsDictionary, OgreGFX::GFXNode::node, playAudioSourceIndex(), setSoundPosition(), OgreSND::soundPerEnt, and sourceInfo.

Referenced by tick().

bool SoundMgr::playExplosionSound ( FastEcslent::EntityType  et,
OgreGFX::GFXNode gfxNode 
)

Definition at line 351 of file SoundMgr.cpp.

References battleSoundsDictionary, OgreGFX::GFXNode::node, playAudioSourceIndex(), setSoundPosition(), OgreSND::soundPerEnt, and sourceInfo.

Referenced by OgreGFX::GraphicsInteractionManager::copySimState().

bool SoundMgr::playExplosionSound ( OgreGFX::GFXNode gfxNode  ) 

Definition at line 377 of file SoundMgr.cpp.

References battleSoundSource, OgreGFX::GFXNode::node, and setSoundPosition().

bool SoundMgr::playSelectionSound ( FastEcslent::EntityType  et,
OgreGFX::GFXNode gfxNode 
)

Definition at line 297 of file SoundMgr.cpp.

References OgreGFX::GFXNode::node, playAudioSourceIndex(), selectionSoundsDictionary, setSoundPosition(), OgreSND::soundPerEnt, and sourceInfo.

Referenced by tick().

bool SoundMgr::loadAudio ( std::string  filename,
int  sid 
)

Definition at line 758 of file SoundMgr.cpp.

References OgreSND::BufferInfo::bufferFilename, bufferInfo, getFQFNFromFilename(), printError(), toALFormat(), and OgreSND::BufferInfo::wave.

Referenced by getBufferId().

bool SoundMgr::loadStartBackground (  ) 

Definition at line 810 of file SoundMgr.cpp.

References OgreSND::backgroundMusicFilename, backgroundWaveInfo, getFQFNFromFilename(), printError(), and toALFormat().

Referenced by initialize().

bool SoundMgr::stopBackground (  ) 

Definition at line 728 of file SoundMgr.cpp.

References printError().

Referenced by disable().

bool SoundMgr::pauseBackground (  ) 

Definition at line 740 of file SoundMgr.cpp.

References printError().

bool SoundMgr::resumeBackground (  ) 

Definition at line 749 of file SoundMgr.cpp.

References printError().

Referenced by enable().

bool SoundMgr::registerCreate ( FastEcslent::EntityType  et,
std::string  filename 
)

Definition at line 480 of file SoundMgr.cpp.

References creationSoundsDictionary, OgreSND::maxAudioSources, OgreSND::soundPerEnt, and sourceDictionary.

Referenced by initWatercraftSounds().

bool SoundMgr::registerSelection ( FastEcslent::EntityType  et,
std::string  filename 
)

Definition at line 523 of file SoundMgr.cpp.

References OgreSND::maxAudioSources, selectionSoundsDictionary, OgreSND::soundPerEnt, and sourceDictionary.

Referenced by initWatercraftSounds().

bool SoundMgr::registerBattleSound ( FastEcslent::EntityType  et,
std::string  filename 
)

Definition at line 566 of file SoundMgr.cpp.

References battleSoundsDictionary, OgreSND::maxAudioSources, OgreSND::soundPerEnt, and sourceDictionary.

bool SoundMgr::isEntityShip ( FastEcslent::EntityType  et  ) 

Definition at line 145 of file SoundMgr.cpp.

Referenced by initWatercraftSounds().

bool SoundMgr::initWatercraftSounds (  ) 

Definition at line 117 of file SoundMgr.cpp.

References isEntityShip(), FastEcslent::MARINE, FastEcslent::NENTITYTYPES, registerCreate(), and registerSelection().

Referenced by initialize().

bool SoundMgr::reserveAudio ( std::string  filename,
bool  loop,
unsigned int &  sourceInfoIndex 
)

Reserves a source name and binds it to a buffer. It returns status AND the index in sourcesInfo of this sound's audioId

Definition at line 615 of file SoundMgr.cpp.

References getBufferId(), getEmptySourceIndex(), OgreSND::SourceInfo::inUse, printError(), resetSource(), and sourceInfo.

bool SoundMgr::releaseSource ( ALuint  audioId  ) 

Definition at line 703 of file SoundMgr.cpp.

References OgreSND::maxAudioSources, and releaseSourceIndex().

bool SoundMgr::releaseSourceIndex ( int  sid  ) 

Releases a source name. First finds it souceInfo, stopsAudio playing if any, then deletes the source

Definition at line 684 of file SoundMgr.cpp.

References OgreSND::SourceInfo::inUse, printError(), OgreSND::SourceInfo::source, sourceInfo, and stopAudio().

Referenced by releaseSource().

bool SoundMgr::playAudio ( ALuint  audioId,
bool  forceRestart 
)

Definition at line 883 of file SoundMgr.cpp.

References printError(), and stopAudio().

Referenced by attachSelectedNodeToSoundIndex(), playAudio(), playAudioSourceIndex(), resumeAllAudio(), and resumeAudio().

bool SoundMgr::playAudio ( ALuint  audioId  ) 

Definition at line 909 of file SoundMgr.cpp.

References playAudio().

bool SoundMgr::playAudioSourceIndex ( int  sid,
bool  forceRestart 
)

Definition at line 913 of file SoundMgr.cpp.

References playAudio().

Referenced by playEntityBornSound(), playExplosionSound(), and playSelectionSound().

bool SoundMgr::playAudioSourceIndex ( int  sid  ) 

Definition at line 917 of file SoundMgr.cpp.

References playAudio().

void SoundMgr::copySoundState (  ) 

Definition at line 1028 of file SoundMgr.cpp.

References attachSelectedNodeToSoundIndex(), FastEcslent::UnitAI::commands, OgreGFX::GraphicsInteractionManager::engine, FastEcslent::Engine::entityMgr, OgreGFX::GraphicsInteractionManager::gfxNodes, gim, FastEcslent::MoveCommand, OgreGFX::GraphicsInteractionManager::nGFXNodes, and FastEcslent::UNITAI.

bool SoundMgr::isAudioPlaying ( ALuint  audioId  ) 

Definition at line 938 of file SoundMgr.cpp.

References printError().

bool SoundMgr::stopAudio ( ALuint  audioID  ) 

Definition at line 921 of file SoundMgr.cpp.

References printError().

Referenced by playAudio(), releaseSourceIndex(), stopAllAudio(), and stopAudioSourceIndex().

bool SoundMgr::stopAllAudio ( void   ) 

Definition at line 953 of file SoundMgr.cpp.

References OgreSND::maxAudioSources, and stopAudio().

Referenced by disable().

bool SoundMgr::stopAudioSourceIndex ( int  sid  ) 

Definition at line 934 of file SoundMgr.cpp.

References stopAudio().

bool SoundMgr::pauseAudio ( ALuint  audioID  ) 

Definition at line 965 of file SoundMgr.cpp.

References printError().

Referenced by pauseAllAudio(), and pauseAudioSourceIndex().

bool SoundMgr::pauseAllAudio ( void   ) 

Definition at line 975 of file SoundMgr.cpp.

References OgreSND::maxAudioSources, and pauseAudio().

bool SoundMgr::pauseAudioSourceIndex ( int  sid  ) 

Definition at line 960 of file SoundMgr.cpp.

References pauseAudio().

bool SoundMgr::resumeAudio ( ALuint  audioID  ) 

Definition at line 982 of file SoundMgr.cpp.

References playAudio().

bool SoundMgr::resumeAllAudio ( void   ) 

Definition at line 986 of file SoundMgr.cpp.

References OgreSND::maxAudioSources, and playAudio().

bool OgreSND::SoundMgr::resumeAudioSourceIndex ( int  sid  ) 

bool SoundMgr::setSoundPosition ( ALuint  audioID,
Ogre::Vector3  position 
)

Definition at line 993 of file SoundMgr.cpp.

References printError().

Referenced by attachSelectedNodeToSoundIndex(), playEntityBornSound(), playExplosionSound(), and playSelectionSound().

bool SoundMgr::setSoundDisposition ( ALuint  audioID,
Ogre::Vector3  position,
Ogre::Vector3  velocity,
Ogre::Vector3  direction 
)

Definition at line 1006 of file SoundMgr.cpp.

References printError().

bool SoundMgr::setSound ( ALuint  audioID,
Ogre::Vector3  position,
Ogre::Vector3  velocity,
Ogre::Vector3  direction,
float  maxDistance,
bool  playNow,
bool  forceRestart,
float  minGain 
)

Definition at line 1017 of file SoundMgr.cpp.

bool SoundMgr::setListenerDisposition ( Ogre::Vector3  position,
Ogre::Vector3  velocity,
Ogre::Quaternion  orientation 
)

Definition at line 1024 of file SoundMgr.cpp.


Member Data Documentation

OgreGFX::GraphicsInteractionManager* OgreSND::SoundMgr::gim [private]

Definition at line 49 of file SoundMgr.h.

Referenced by copySoundState(), syncListenerToCamera(), and tick().

ALCdevice* OgreSND::SoundMgr::device [private]

Definition at line 50 of file SoundMgr.h.

Referenced by initialize(), printAudioDevices(), and ~SoundMgr().

ALCcontext* OgreSND::SoundMgr::context [private]

Definition at line 51 of file SoundMgr.h.

Referenced by initialize(), and ~SoundMgr().

ALfloat OgreSND::SoundMgr::position[3] [private]

Definition at line 52 of file SoundMgr.h.

Referenced by syncListenerToCamera().

ALfloat OgreSND::SoundMgr::velocity[3] [private]

Definition at line 53 of file SoundMgr.h.

Referenced by syncListenerToCamera().

ALfloat OgreSND::SoundMgr::orientation[6] [private]

Definition at line 54 of file SoundMgr.h.

Referenced by syncListenerToCamera().

SourceInfo OgreSND::SoundMgr::sourceInfo[maxAudioSources] [private]

Definition at line 58 of file SoundMgr.h.

Referenced by initialize(), playEntityBornSound(), playExplosionSound(), playSelectionSound(), releaseSourceIndex(), and reserveAudio().

BufferInfo OgreSND::SoundMgr::bufferInfo[maxAudioBuffers] [private]

Definition at line 59 of file SoundMgr.h.

Referenced by initialize(), and loadAudio().

ALuint OgreSND::SoundMgr::backgroundMusicBuffer [private]

Definition at line 62 of file SoundMgr.h.

ALuint OgreSND::SoundMgr::backgroundMusicSource [private]

Definition at line 62 of file SoundMgr.h.

Referenced by initialize().

ALuint OgreSND::SoundMgr::battleSoundSource [private]

Definition at line 63 of file SoundMgr.h.

Referenced by initialize(), and playExplosionSound().

WaveInfo* OgreSND::SoundMgr::backgroundWaveInfo [private]

Definition at line 64 of file SoundMgr.h.

Referenced by loadStartBackground().

unsigned int OgreSND::SoundMgr::soundDictionary[FastEcslent::NENTITYTYPES] [private]

Definition at line 66 of file SoundMgr.h.

std::vector<std::string> OgreSND::SoundMgr::sourceDictionary [private]

Definition at line 67 of file SoundMgr.h.

Referenced by initialize(), registerBattleSound(), registerCreate(), and registerSelection().

int OgreSND::SoundMgr::creationSoundsDictionary[FastEcslent::NENTITYTYPES][soundPerEnt] [private]

Definition at line 70 of file SoundMgr.h.

Referenced by initialize(), playEntityBornSound(), and registerCreate().

int OgreSND::SoundMgr::selectionSoundsDictionary[FastEcslent::NENTITYTYPES][soundPerEnt] [private]

Definition at line 71 of file SoundMgr.h.

Referenced by initialize(), playSelectionSound(), and registerSelection().

int OgreSND::SoundMgr::battleSoundsDictionary[FastEcslent::NENTITYTYPES][soundPerEnt] [private]

Definition at line 72 of file SoundMgr.h.

Referenced by initialize(), playExplosionSound(), and registerBattleSound().

bool OgreSND::SoundMgr::isEnabled [private]

Definition at line 81 of file SoundMgr.h.

Referenced by disable(), enable(), and initialize().


The documentation for this class was generated from the following files:
Generated on Fri Dec 13 14:54:23 2013 for FastECSLent by  doxygen 1.5.4