adding missing cleanup for SoundManager

actorid
Marc Zinnschlag 11 years ago
parent 14e64c180f
commit 0f60898517

@ -147,6 +147,8 @@ namespace MWBase
virtual void update(float duration) = 0;
virtual void setListenerPosDir(const Ogre::Vector3 &pos, const Ogre::Vector3 &dir, const Ogre::Vector3 &up) = 0;
virtual void clear() = 0;
};
}

@ -705,4 +705,13 @@ namespace MWSound
{
return bytes / framesToBytes(1, config, type);
}
void SoundManager::clear()
{
for (SoundMap::iterator iter (mActiveSounds.begin()); iter!=mActiveSounds.end(); ++iter)
iter->first->stop();
mActiveSounds.clear();
stopMusic();
}
}

@ -148,6 +148,8 @@ namespace MWSound
virtual void update(float duration);
virtual void setListenerPosDir(const Ogre::Vector3 &pos, const Ogre::Vector3 &dir, const Ogre::Vector3 &up);
virtual void clear();
};
}

@ -15,6 +15,7 @@
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/scriptmanager.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwworld/player.hpp"
#include "../mwworld/class.hpp"
@ -27,6 +28,7 @@ void MWState::StateManager::cleanup()
{
if (mState!=State_NoGame)
{
MWBase::Environment::get().getSoundManager()->clear();
MWBase::Environment::get().getDialogueManager()->clear();
MWBase::Environment::get().getJournal()->clear();
MWBase::Environment::get().getScriptManager()->getGlobalScripts().clear();

Loading…
Cancel
Save