From cddea4a99cd4af28800e017d0c4b5c789806fb56 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 14 Dec 2015 13:54:53 -0800 Subject: [PATCH] Start underwater sound after updating sounds In between the startUpdate/finishUpdate calls, changes are deferred so that they can happen all at once. This includes starting sounds, so when the underwater sound is started it will be immediately checked to see if it's playing. Since it's not yet playing, it'll be seen as stopped and get cleaned up before ever playing. --- apps/openmw/mwsound/soundmanagerimp.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/openmw/mwsound/soundmanagerimp.cpp b/apps/openmw/mwsound/soundmanagerimp.cpp index d1a90759b..522efe3a7 100644 --- a/apps/openmw/mwsound/soundmanagerimp.cpp +++ b/apps/openmw/mwsound/soundmanagerimp.cpp @@ -844,13 +844,6 @@ namespace MWSound env ); - if(mListenerUnderwater) - { - // Play underwater sound (after updating listener) - if(!(mUnderwaterSound && mOutput->isSoundPlaying(mUnderwaterSound))) - mUnderwaterSound = playSound("Underwater", 1.0f, 1.0f, Play_TypeSfx, Play_LoopNoEnv); - } - // Check if any sounds are finished playing, and trash them SoundMap::iterator snditer = mActiveSounds.begin(); while(snditer != mActiveSounds.end()) @@ -979,6 +972,13 @@ namespace MWSound ++trkiter; } } + + if(mListenerUnderwater) + { + // Play underwater sound (after updating sounds) + if(!(mUnderwaterSound && mOutput->isSoundPlaying(mUnderwaterSound))) + mUnderwaterSound = playSound("Underwater", 1.0f, 1.0f, Play_TypeSfx, Play_LoopNoEnv); + } mOutput->finishUpdate(); }