From 27d0b1a1d4b48757aa1bb394fa4d8699e1df1632 Mon Sep 17 00:00:00 2001 From: Misa Date: Mon, 12 Apr 2021 10:38:44 -0700 Subject: [PATCH] Ensure all fade-ins start from zero This fixes a bug where fading music in but not going through the music.play() path wouldn't start the fade volume from zero. If this happened, then the previous volume would persist, and if the previous volume was the max volume, then that essentially canceled out the fade-in and prevented it from happening at all. But now all paths to fadeMusicVolumeIn() set the volume to zero first, instead of only the caller of music.play(). --- desktop_version/src/Music.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/desktop_version/src/Music.cpp b/desktop_version/src/Music.cpp index e02816f1..14b617d8 100644 --- a/desktop_version/src/Music.cpp +++ b/desktop_version/src/Music.cpp @@ -238,7 +238,6 @@ void musicclass::play(int t) else { fadeMusicVolumeIn(3000); - musicVolume = 0; } } } @@ -290,6 +289,10 @@ void musicclass::fadeMusicVolumeIn(int ms) { m_doFadeInVol = true; m_doFadeOutVol = false; + + /* Ensure it starts at 0 */ + musicVolume = 0; + setfadeamount(ms); }