fix setting throttle on LoadGame()

Move the soundSetThrottle() calls after the soundSetSampleRate() calls
in LoadGame(), because the core calls soundInit() again after
soundSetSampleRate() wiping out the throttle value. This allows the
throttle setting to work with xaudio on startup and game loads.

TODO: the throttle config setting only works correctly for the xaudio
driver at the moment, it needs to be implemented for other sound drivers
and eventually moved out of the sound drivers altogether.
This commit is contained in:
Rafael Kitover 2017-03-04 21:53:35 -08:00
parent 88d15c6ec8
commit 441e6c9e0e
1 changed files with 4 additions and 2 deletions

View File

@ -162,10 +162,11 @@ void GameArea::LoadGame(const wxString& name)
gb_effects_config.stereo = (float)gopts.gb_stereo / 100.0;
gbSoundSetDeclicking(gopts.gb_declick);
soundInit();
soundSetThrottle(throttle);
soundSetEnable(gopts.sound_en);
gbSoundSetSampleRate(!gopts.sound_qual ? 48000 : 44100 / (1 << (gopts.sound_qual - 1)));
soundSetVolume((float)gopts.sound_vol / 100.0);
// this **MUST** be called **AFTER** setting sample rate because the core calls soundInit()
soundSetThrottle(throttle);
gbGetHardwareType();
bool use_bios = false;
// auto-conversion of wxCharBuffer to const char * seems broken
@ -272,11 +273,12 @@ void GameArea::LoadGame(const wxString& name)
gb_effects_config.stereo = (float)gopts.gb_stereo / 100.0;
gbSoundSetDeclicking(gopts.gb_declick);
soundInit();
soundSetThrottle(throttle);
soundSetEnable(gopts.sound_en);
gbSoundSetSampleRate(!gopts.sound_qual ? 48000 : 44100 / (1 << (gopts.sound_qual - 1)));
soundSetSampleRate(!gopts.sound_qual ? 48000 : 44100 / (1 << (gopts.sound_qual - 1)));
soundSetVolume((float)gopts.sound_vol / 100.0);
// this **MUST** be called **AFTER** setting sample rate because the core calls soundInit()
soundSetThrottle(throttle);
soundFiltering = (float)gopts.gba_sound_filter / 100.0f;
CPUInit(gopts.gba_bios.mb_fn_str(), useBiosFileGBA);