diff --git a/desktop_version/src/Music.cpp b/desktop_version/src/Music.cpp index 2a278803..7c031b49 100644 --- a/desktop_version/src/Music.cpp +++ b/desktop_version/src/Music.cpp @@ -620,3 +620,25 @@ bool musicclass::halted(void) { return Mix_PausedMusic() == 1; } + +void musicclass::updatemutestate(void) +{ + if (game.muted) + { + Mix_VolumeMusic(0); + Mix_Volume(-1, 0); + } + else + { + Mix_Volume(-1, MIX_MAX_VOLUME * user_sound_volume / USER_VOLUME_MAX); + + if (game.musicmuted) + { + Mix_VolumeMusic(0); + } + else + { + Mix_VolumeMusic(musicVolume * user_music_volume / USER_VOLUME_MAX); + } + } +} diff --git a/desktop_version/src/Music.h b/desktop_version/src/Music.h index d2714f78..65859416 100644 --- a/desktop_version/src/Music.h +++ b/desktop_version/src/Music.h @@ -64,6 +64,7 @@ public: void resumeef(void); bool halted(void); + void updatemutestate(void); std::vector soundTracks; std::vector musicTracks; diff --git a/desktop_version/src/main.cpp b/desktop_version/src/main.cpp index d2be21be..72c26e43 100644 --- a/desktop_version/src/main.cpp +++ b/desktop_version/src/main.cpp @@ -855,24 +855,7 @@ static enum LoopCode loop_end(void) game.musicmutebutton--; } - if (game.muted) - { - Mix_VolumeMusic(0) ; - Mix_Volume(-1,0); - } - else - { - Mix_Volume(-1,MIX_MAX_VOLUME * music.user_sound_volume / USER_VOLUME_MAX); - - if (game.musicmuted) - { - Mix_VolumeMusic(0); - } - else - { - Mix_VolumeMusic(music.musicVolume * music.user_music_volume / USER_VOLUME_MAX); - } - } + music.updatemutestate(); if (key.resetWindow) {