mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 19:36:43 +00:00
Explicitly stop sounds instead of relying on their deletion to do it
This commit is contained in:
parent
74e79bb4af
commit
80dbf82a74
1 changed files with 20 additions and 4 deletions
|
@ -40,7 +40,6 @@ namespace MWSound
|
||||||
: mFSStrict(fsstrict)
|
: mFSStrict(fsstrict)
|
||||||
, mEnvironment(environment)
|
, mEnvironment(environment)
|
||||||
, mCurrentPlaylist(NULL)
|
, mCurrentPlaylist(NULL)
|
||||||
, mUsingSound(useSound)
|
|
||||||
{
|
{
|
||||||
if(!useSound)
|
if(!useSound)
|
||||||
return;
|
return;
|
||||||
|
@ -239,9 +238,6 @@ namespace MWSound
|
||||||
|
|
||||||
void SoundManager::playPlaylist(std::string playlist)
|
void SoundManager::playPlaylist(std::string playlist)
|
||||||
{
|
{
|
||||||
if (!mUsingSound)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (playlist == "")
|
if (playlist == "")
|
||||||
{
|
{
|
||||||
if(!isMusicPlaying())
|
if(!isMusicPlaying())
|
||||||
|
@ -321,13 +317,22 @@ namespace MWSound
|
||||||
IDMap::iterator iditer = snditer->second.find(soundId);
|
IDMap::iterator iditer = snditer->second.find(soundId);
|
||||||
if(iditer != snditer->second.end())
|
if(iditer != snditer->second.end())
|
||||||
{
|
{
|
||||||
|
iditer->second->stop();
|
||||||
snditer->second.erase(iditer);
|
snditer->second.erase(iditer);
|
||||||
if(snditer->second.empty())
|
if(snditer->second.empty())
|
||||||
mActiveSounds.erase(snditer);
|
mActiveSounds.erase(snditer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
IDMap::iterator iditer = snditer->second.begin();
|
||||||
|
while(iditer != snditer->second.end())
|
||||||
|
{
|
||||||
|
iditer->second->stop();
|
||||||
|
iditer++;
|
||||||
|
}
|
||||||
mActiveSounds.erase(snditer);
|
mActiveSounds.erase(snditer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundManager::stopSound(MWWorld::Ptr::CellStore *cell)
|
void SoundManager::stopSound(MWWorld::Ptr::CellStore *cell)
|
||||||
|
@ -337,7 +342,15 @@ namespace MWSound
|
||||||
while(snditer != mActiveSounds.end())
|
while(snditer != mActiveSounds.end())
|
||||||
{
|
{
|
||||||
if(snditer->first.getCell() == cell)
|
if(snditer->first.getCell() == cell)
|
||||||
|
{
|
||||||
|
IDMap::iterator iditer = snditer->second.begin();
|
||||||
|
while(iditer != snditer->second.end())
|
||||||
|
{
|
||||||
|
iditer->second->stop();
|
||||||
|
iditer++;
|
||||||
|
}
|
||||||
mActiveSounds.erase(snditer++);
|
mActiveSounds.erase(snditer++);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
snditer++;
|
snditer++;
|
||||||
}
|
}
|
||||||
|
@ -347,7 +360,10 @@ namespace MWSound
|
||||||
{
|
{
|
||||||
IDMap::iterator iditer = mLooseSounds.find(soundId);
|
IDMap::iterator iditer = mLooseSounds.find(soundId);
|
||||||
if(iditer != mLooseSounds.end())
|
if(iditer != mLooseSounds.end())
|
||||||
|
{
|
||||||
|
iditer->second->stop();
|
||||||
mLooseSounds.erase(iditer);
|
mLooseSounds.erase(iditer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SoundManager::getSoundPlaying(MWWorld::Ptr ptr, const std::string& soundId) const
|
bool SoundManager::getSoundPlaying(MWWorld::Ptr ptr, const std::string& soundId) const
|
||||||
|
|
Loading…
Reference in a new issue