From 96970dc3393955d40cf92f6ad725ee831918f65e Mon Sep 17 00:00:00 2001 From: OV2 Date: Wed, 27 Nov 2019 14:28:23 +0100 Subject: [PATCH] win32: reset last_volume when reinitializing sound (fixes #603) (cherry picked from commit 33f7a1711c627a083c0e97b3a40e5cbfb4da2496) --- win32/win32_sound.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/win32/win32_sound.cpp b/win32/win32_sound.cpp index 4f349a0cb..3718b1d78 100644 --- a/win32/win32_sound.cpp +++ b/win32/win32_sound.cpp @@ -22,6 +22,8 @@ CWaveOut S9xWaveOut; // Interface used to access the sound output IS9xSoundOutput *S9xSoundOutput = &S9xXAudio2; +static double last_volume = 1.0; + /* ReInitSound reinitializes the sound core with current settings IN: @@ -51,6 +53,7 @@ bool ReInitSound() if(S9xSoundOutput) S9xSoundOutput->DeInitSoundOutput(); + last_volume = 1.0; return S9xInitSound(0); } @@ -95,8 +98,6 @@ called by the sound core to process generated samples */ void S9xSoundCallback(void *data) { - static double last_volume = 1.0; - // only try to change volume if we actually need to switch it double current_volume = (Settings.TurboMode ? GUI.VolumeTurbo : GUI.VolumeRegular) / 100.; if (last_volume != current_volume) {