Re-enable music/sounds when volume cvars are changed

This commit is contained in:
James R 2023-12-23 08:25:10 -08:00
parent c11c7bcbbd
commit 375d87255e
2 changed files with 22 additions and 2 deletions

View file

@ -318,8 +318,10 @@ consvar_t cv_controlperkey = Player("controlperkey", "One").values({{1, "One"},
// actual general (maximum) sound & music volume, saved into the config // actual general (maximum) sound & music volume, saved into the config
// Volume scale is 0-100 in new mixer. 100 is treated as -0dB or 100% gain. No more weirdness to work around SDL_mixer // Volume scale is 0-100 in new mixer. 100 is treated as -0dB or 100% gain. No more weirdness to work around SDL_mixer
// problems // problems
consvar_t cv_digmusicvolume = Player("musicvolume", "80").min_max(0, 100); void DigMusicVolume_OnChange(void);
consvar_t cv_soundvolume = Player("soundvolume", "80").min_max(0, 100); void SoundVolume_OnChange(void);
consvar_t cv_digmusicvolume = Player("musicvolume", "80").min_max(0, 100).onchange_noinit(DigMusicVolume_OnChange);
consvar_t cv_soundvolume = Player("soundvolume", "80").min_max(0, 100).onchange_noinit(SoundVolume_OnChange);
#ifdef HAVE_DISCORDRPC #ifdef HAVE_DISCORDRPC
void DRPC_UpdatePresence(void); void DRPC_UpdatePresence(void);

View file

@ -2540,3 +2540,21 @@ void PlaySoundIfUnfocused_OnChange(void)
if (window_notinfocus && !cv_playsoundifunfocused.value) if (window_notinfocus && !cv_playsoundifunfocused.value)
S_StopSounds(); S_StopSounds();
} }
void DigMusicVolume_OnChange(void);
void DigMusicVolume_OnChange(void)
{
if (!cv_gamedigimusic.value)
{
CV_SetValue(&cv_gamedigimusic, 1);
}
}
void SoundVolume_OnChange(void);
void SoundVolume_OnChange(void)
{
if (!cv_gamesounds.value)
{
CV_SetValue(&cv_gamesounds, 1);
}
}