From af2e6a2331d2bc4a3acd9f416034107880f5fe78 Mon Sep 17 00:00:00 2001 From: Misa Date: Mon, 12 Apr 2021 10:41:44 -0700 Subject: [PATCH] Fix 1-frame glitch when fading in from zero The problem here is that even though we start playing the music when the volume is set to zero, mixer's state doesn't have volume zero, so whatever it plays next will be the very first quanta of the track but at the previous volume (in this case, the maximum volume). To fix this, just update mixer when we update the volume here - it's okay to not account for user volume because it ends up being zero anyway. Fixes #710. --- desktop_version/src/Music.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/desktop_version/src/Music.cpp b/desktop_version/src/Music.cpp index 14b617d8..e69453e2 100644 --- a/desktop_version/src/Music.cpp +++ b/desktop_version/src/Music.cpp @@ -293,6 +293,9 @@ void musicclass::fadeMusicVolumeIn(int ms) /* Ensure it starts at 0 */ musicVolume = 0; + /* Fix 1-frame glitch */ + Mix_VolumeMusic(0); + setfadeamount(ms); }