Fix: Data race on effect volume setting with mixer thread

This commit is contained in:
Jonathan G Rennison
2022-11-07 21:26:03 +00:00
committed by Michael Lutz
parent a962d7476b
commit 0fae0599b7
4 changed files with 21 additions and 5 deletions

View File

@@ -13,6 +13,7 @@
#include "sound/sound_driver.hpp"
#include "music/music_driver.hpp"
#include "video/video_driver.hpp"
#include "mixer.h"
#include "fontcache.h"
#include "error.h"
@@ -452,8 +453,9 @@ struct AfterNewGRFScan : NewGRFScanCallback {
/* We have loaded the config, so we may possibly save it. */
_save_config = save_config;
/* restore saved music volume */
/* restore saved music and effects volumes */
MusicDriver::GetInstance()->SetVolume(_settings_client.music.music_vol);
SetEffectVolume(_settings_client.music.effect_vol);
if (startyear != INVALID_YEAR) IConsoleSetSetting("game_creation.starting_year", startyear);
if (generation_seed != GENERATE_NEW_SEED) _settings_newgame.game_creation.generation_seed = generation_seed;