From 80dbf82a748f7b821b8eabbdf7a795e1998fecc2 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 20 Mar 2012 07:22:17 -0700 Subject: [PATCH] Explicitly stop sounds instead of relying on their deletion to do it --- apps/openmw/mwsound/soundmanager.cpp | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwsound/soundmanager.cpp b/apps/openmw/mwsound/soundmanager.cpp index 508e9144d..e5449e09b 100644 --- a/apps/openmw/mwsound/soundmanager.cpp +++ b/apps/openmw/mwsound/soundmanager.cpp @@ -40,7 +40,6 @@ namespace MWSound : mFSStrict(fsstrict) , mEnvironment(environment) , mCurrentPlaylist(NULL) - , mUsingSound(useSound) { if(!useSound) return; @@ -239,9 +238,6 @@ namespace MWSound void SoundManager::playPlaylist(std::string playlist) { - if (!mUsingSound) - return; - if (playlist == "") { if(!isMusicPlaying()) @@ -321,13 +317,22 @@ namespace MWSound IDMap::iterator iditer = snditer->second.find(soundId); if(iditer != snditer->second.end()) { + iditer->second->stop(); snditer->second.erase(iditer); if(snditer->second.empty()) mActiveSounds.erase(snditer); } } else + { + IDMap::iterator iditer = snditer->second.begin(); + while(iditer != snditer->second.end()) + { + iditer->second->stop(); + iditer++; + } mActiveSounds.erase(snditer); + } } void SoundManager::stopSound(MWWorld::Ptr::CellStore *cell) @@ -337,7 +342,15 @@ namespace MWSound while(snditer != mActiveSounds.end()) { if(snditer->first.getCell() == cell) + { + IDMap::iterator iditer = snditer->second.begin(); + while(iditer != snditer->second.end()) + { + iditer->second->stop(); + iditer++; + } mActiveSounds.erase(snditer++); + } else snditer++; } @@ -347,7 +360,10 @@ namespace MWSound { IDMap::iterator iditer = mLooseSounds.find(soundId); if(iditer != mLooseSounds.end()) + { + iditer->second->stop(); mLooseSounds.erase(iditer); + } } bool SoundManager::getSoundPlaying(MWWorld::Ptr ptr, const std::string& soundId) const