shithub: choc

Download patch

ref: 5b967edaf6e407b03455631734ee2e33e88304c8
parent: 5003ab5283ff27c951c97b064c26cdde2bb0f427
author: Michael Day <43701387+mikeday0@users.noreply.github.com>
date: Mon Apr 5 11:52:15 EDT 2021

Fix max volume musicpack at startup (#1364)

* Fix max volume musicpack at startup

Whenever I_SetMusicVolume is called, set the volume for both
music_module and music_pack_module. Previously the music_pack_module
volume would never get set at the first call of I_SetMusicVolume during
initialization. Therefore, its volume would default to max.

* Adjust logic for music volume calls

-Add guard against possible double calls of music_pack_module's
SetMusicVolume()
-Do nothing if music_module is NULL

--- a/src/i_sound.c
+++ b/src/i_sound.c
@@ -390,9 +390,14 @@
 
 void I_SetMusicVolume(int volume)
 {
-    if (active_music_module != NULL)
+    if (music_module != NULL)
     {
-        active_music_module->SetMusicVolume(volume);
+        music_module->SetMusicVolume(volume);
+
+        if (music_packs_active && music_module != &music_pack_module)
+        {
+            music_pack_module.SetMusicVolume(volume);
+        }
     }
 }