From 441e6c9e0e014f505c25076992c1c0ec8e49207d Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Sat, 4 Mar 2017 21:53:35 -0800 Subject: [PATCH] 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. --- src/wx/panel.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wx/panel.cpp b/src/wx/panel.cpp index 60a6c6e0..b7565d98 100644 --- a/src/wx/panel.cpp +++ b/src/wx/panel.cpp @@ -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);