- fixed sound updating by moving the engine's UpdateSound call into the main loop.

This needs to be called unconditionally for every frame being rendered, not all of the game modules did that.
Placing this call here ensures that it is independent of anything the games do.
This commit is contained in:
Christoph Oelckers 2020-08-26 04:10:16 +02:00
parent de871c9ab9
commit cc5e6d19c3
7 changed files with 4 additions and 8 deletions

View file

@ -137,7 +137,7 @@ void sfxUpdate3DSounds(void)
listener.ListenerObject = gMe->pSprite;
soundEngine->SetListener(listener);
soundEngine->UpdateSounds(gameclock);
soundEngine->UpdateSounds(I_GetTime());
}
FSoundID getSfx(FSoundID soundId, float &attenuation, int &pitch, int &relvol)

View file

@ -930,9 +930,11 @@ void app_loop()
if (gamestate == GS_LEVEL) DrawFullscreenBlends();
DrawRateStuff();
soundEngine->UpdateSounds(I_GetTime());
Mus_UpdateMusic(); // must be at the end.
videoNextPage();
videoSetBrightness(0); // immediately reset this so that the value doesn't stick around in the backend.
Mus_UpdateMusic(); // must be at the end.
}
catch (CRecoverableError& err)
{

View file

@ -522,7 +522,6 @@ void UpdateSounds()
soundEngine->SetListener(listener);
soundEngine->UpdateSounds(I_GetTime());
soundEngine->EnumerateChannels([](FSoundChan* chan)
{
if (!(chan->ChanFlags & (CHANF_UI|CHANF_FORGETTABLE)))

View file

@ -246,8 +246,6 @@ void DrawView(double smoothRatio, bool sceneonly)
fix16_t nAngle;
fix16_t pan;
UpdateSounds();
zbob = Sin(2 * bobangle) >> 3;
int nPlayerSprite = PlayerList[nLocalPlayer].nSprite;

View file

@ -353,7 +353,6 @@ void S_Update(void)
}
listener.ListenerObject = ud.camerasprite == -1 ? nullptr : &sprite[ud.camerasprite];
soundEngine->SetListener(listener);
soundEngine->UpdateSounds(I_GetTime());
}

View file

@ -711,7 +711,6 @@ void EndOfLevel()
COVER_SetReverb(0); // Reset reverb
Player[myconnectindex].Reverb = 0;
StopSound();
soundEngine->UpdateSounds(I_GetTime());
// NextLevel must be null while the intermission is running, but we still need the value for later
auto localNextLevel = NextLevel;
NextLevel = nullptr;

View file

@ -604,7 +604,6 @@ void DoUpdateSounds(void)
soundEngine->SetListener(listener);
UpdateAmbients();
soundEngine->UpdateSounds(I_GetTime());
}
//==========================================================================