From f567950e258370cca92c14abaee09829ab974623 Mon Sep 17 00:00:00 2001 From: Michael Papageorgiou Date: Sun, 18 Mar 2012 22:38:53 +0200 Subject: [PATCH] Fix for the --nosound crash --- apps/openmw/mwsound/soundmanager.cpp | 8 ++++++-- apps/openmw/mwsound/soundmanager.hpp | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwsound/soundmanager.cpp b/apps/openmw/mwsound/soundmanager.cpp index a5ba04e26..6a2ba2fe4 100644 --- a/apps/openmw/mwsound/soundmanager.cpp +++ b/apps/openmw/mwsound/soundmanager.cpp @@ -67,6 +67,7 @@ namespace MWSound , updater(mgr) , cameraTracker(mgr) , mCurrentPlaylist(NULL) + , mUsingSound(useSound) { if(useSound) { @@ -105,8 +106,11 @@ namespace MWSound SoundManager::~SoundManager() { - Ogre::Root::getSingleton().removeFrameListener(&updater); - cameraTracker.unfollowCamera(); + if(mUsingSound) + { + Ogre::Root::getSingleton().removeFrameListener(&updater); + cameraTracker.unfollowCamera(); + } } // Convert a soundId to file name, and modify the volume diff --git a/apps/openmw/mwsound/soundmanager.hpp b/apps/openmw/mwsound/soundmanager.hpp index bd3b67679..dcf64b90c 100644 --- a/apps/openmw/mwsound/soundmanager.hpp +++ b/apps/openmw/mwsound/soundmanager.hpp @@ -82,6 +82,8 @@ namespace MWSound IDMap mLoopedSounds; + bool mUsingSound; + std::string lookup(const std::string &soundId, float &volume, float &min, float &max); void add(const std::string &file,