#include <SoundMgr.h>
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::GraphicsInteractionManager * | gim |
| 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 |
Definition at line 47 of file SoundMgr.h.
| 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.
| std::string SoundMgr::getFQFNFromFilename | ( | std::string | filename | ) | [private] |
| 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] |
| 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 | ) |
| void SoundMgr::loadLevel | ( | void | ) |
| 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 | ( | ) |
| void SoundMgr::disable | ( | ) |
Definition at line 157 of file SoundMgr.cpp.
References isEnabled, stopAllAudio(), and stopBackground().
| bool SoundMgr::frameRenderingQueued | ( | const Ogre::FrameEvent & | evt | ) | [virtual] |
| 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 | ) |
| 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] |
| 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 | ( | ) |
| bool SoundMgr::pauseBackground | ( | ) |
| bool SoundMgr::resumeBackground | ( | ) |
| 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 | ) |
| 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 | ) |
| 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 | ) |
| 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 | ) |
| 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 | ) |
| bool SoundMgr::pauseAudio | ( | ALuint | audioID | ) |
Definition at line 965 of file SoundMgr.cpp.
References printError().
Referenced by pauseAllAudio(), and pauseAudioSourceIndex().
| bool SoundMgr::pauseAllAudio | ( | void | ) |
| bool SoundMgr::pauseAudioSourceIndex | ( | int | sid | ) |
| bool SoundMgr::resumeAudio | ( | ALuint | audioID | ) |
| bool SoundMgr::resumeAllAudio | ( | void | ) |
| 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 | |||
| ) |
| 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.
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] |
ALfloat OgreSND::SoundMgr::position[3] [private] |
ALfloat OgreSND::SoundMgr::velocity[3] [private] |
ALfloat OgreSND::SoundMgr::orientation[6] [private] |
Definition at line 58 of file SoundMgr.h.
Referenced by initialize(), playEntityBornSound(), playExplosionSound(), playSelectionSound(), releaseSourceIndex(), and reserveAudio().
ALuint OgreSND::SoundMgr::backgroundMusicBuffer [private] |
Definition at line 62 of file SoundMgr.h.
ALuint OgreSND::SoundMgr::backgroundMusicSource [private] |
ALuint OgreSND::SoundMgr::battleSoundSource [private] |
WaveInfo* OgreSND::SoundMgr::backgroundWaveInfo [private] |
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] |
1.5.4