Store the underwater sound to easily stop it

pull/51/head
Chris Robinson 12 years ago
parent 16331bf1ed
commit 02df8ab841

@ -103,6 +103,7 @@ namespace MWSound
SoundManager::~SoundManager()
{
mUnderwaterSound.reset();
mActiveSounds.clear();
mMusic.reset();
mOutput.reset();
@ -550,13 +551,13 @@ namespace MWSound
{
env = Env_Underwater;
//play underwater sound
if(!getSoundPlaying(MWWorld::Ptr(), "Underwater"))
playSound("Underwater", 1.0f, 1.0f, Play_TypeSfx, Play_LoopNoEnv);
if(!(mUnderwaterSound && mUnderwaterSound->isPlaying()))
mUnderwaterSound = playSound("Underwater", 1.0f, 1.0f, Play_TypeSfx, Play_LoopNoEnv);
}
else
else if(mUnderwaterSound)
{
//no need to check if it's playing, stop sound does nothing in that case
stopSound("Underwater");
mUnderwaterSound->stop();
mUnderwaterSound.reset();
}
mOutput->updateListener(

@ -44,6 +44,8 @@ namespace MWSound
typedef std::map<MWBase::SoundPtr,PtrIDPair> SoundMap;
SoundMap mActiveSounds;
MWBase::SoundPtr mUnderwaterSound;
Ogre::Vector3 mListenerPos;
Ogre::Vector3 mListenerDir;
Ogre::Vector3 mListenerUp;

Loading…
Cancel
Save