commit 5b967edaf6e407b03455631734ee2e33e88304c8
Author: Michael Day <43701387+mikeday0@users.noreply.github.com>
AuthorDate: Mon Apr 5 15:52:15 2021 -0400
Commit: GitHub <noreply@github.com>
CommitDate: Mon Apr 5 21:52:15 2021 +0200
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
---
src/i_sound.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/i_sound.c b/src/i_sound.c
index 468b2da7..41a1374d 100644
--- a/src/i_sound.c
+++ b/src/i_sound.c
@@ -390,9 +390,14 @@ void I_ShutdownMusic(void)
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);
+ }
}
}