diff --git a/src/dmg/gbSound.cpp b/src/dmg/gbSound.cpp index 9a92efe5..2a3d984d 100644 --- a/src/dmg/gbSound.cpp +++ b/src/dmg/gbSound.cpp @@ -92,7 +92,7 @@ static void flush_samples() int const chan_count = 4; -gb_effects_config_t gb_effects_config; +gb_effects_config_t gb_effects_config = { false, 0.0f, 0.0f, false }; static gb_effects_config_t gb_effects_config_current; static int prevSoundEnable = -1; @@ -181,10 +181,6 @@ static void remake_stereo_buffer() void gbSoundReset() { - gb_effects_config.echo = 0.20f; - gb_effects_config.stereo = 0.15f; - gb_effects_config.surround = false; - SOUND_CLOCK_TICKS = 20000; remake_stereo_buffer(); diff --git a/src/win32/VBA.cpp b/src/win32/VBA.cpp index a86f5bf9..13e17de7 100644 --- a/src/win32/VBA.cpp +++ b/src/win32/VBA.cpp @@ -47,6 +47,7 @@ #include "../Util.h" #include "../dmg/gbGlobals.h" #include "../dmg/gbPrinter.h" +#include "../dmg/gbSound.h" /* Link ---------------------*/ @@ -1595,6 +1596,11 @@ void VBA::loadSettings() if(soundInterpolation < 0 || soundInterpolation > 1) soundInterpolation = 0; + gb_effects_config.enabled = 1 == regQueryDwordValue( "gbSoundEffectsEnabled", 0 ); + gb_effects_config.surround = 1 == regQueryDwordValue( "gbSoundEffectsSurround", 0 ); + gb_effects_config.echo = (float)regQueryDwordValue( "gbSoundEffectsEcho", 0 ) / 100.0f; + gb_effects_config.stereo = (float)regQueryDwordValue( "gbSoundEffectsStereo", 0 ) / 100.0f; + tripleBuffering = regQueryDwordValue("tripleBuffering", false) ? true : false; #ifndef NO_D3D @@ -2584,6 +2590,12 @@ void VBA::saveSettings() regSetDwordValue("soundVolume", (DWORD)(soundGetVolume() * 100.0f)); regSetDwordValue("soundInterpolation", soundInterpolation); + + regSetDwordValue( "gbSoundEffectsEnabled", gb_effects_config.enabled ? 1 : 0 ); + regSetDwordValue( "gbSoundEffectsSurround", gb_effects_config.surround ? 1 : 0 ); + regSetDwordValue( "gbSoundEffectsEcho", (DWORD)( gb_effects_config.echo * 100.0f ) ); + regSetDwordValue( "gbSoundEffectsStereo", (DWORD)( gb_effects_config.stereo * 100.0f ) ); + regSetDwordValue("tripleBuffering", tripleBuffering); #ifndef NO_D3D