1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-19 20:53:52 +00:00

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.
This commit is contained in:
Chris Robinson 2015-12-14 13:54:53 -08:00
parent c70790ecb7
commit cddea4a99c

View file

@ -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();
}