From d3917de1b3c88b36eb0e661d5671006aa03d6d49 Mon Sep 17 00:00:00 2001 From: nattthebear Date: Wed, 20 Jan 2021 19:57:48 -0500 Subject: [PATCH] Make sound work correctly during clock throttle mode Fixes #2580 --- src/BizHawk.Client.EmuHawk/MainForm.Events.cs | 2 +- src/BizHawk.Client.EmuHawk/MainForm.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/MainForm.Events.cs b/src/BizHawk.Client.EmuHawk/MainForm.Events.cs index 5c480d211a..9c879da4b8 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -924,7 +924,7 @@ namespace BizHawk.Client.EmuHawk if (form.ApplyNewSoundDevice) { Sound.Dispose(); - Sound = new Sound(Handle, Config, Emulator.VsyncRate); + Sound = new Sound(Handle, Config, () => Emulator.VsyncRate()); Sound.StartSound(); } else diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index 61f4b692b1..76a554f98d 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -433,7 +433,7 @@ namespace BizHawk.Client.EmuHawk InputManager.AutofireStickyXorAdapter.SetOnOffPatternFromConfig(Config.AutofireOn, Config.AutofireOff); try { - Sound = new Sound(Handle, Config, Emulator.VsyncRate); + Sound = new Sound(Handle, Config, () => Emulator.VsyncRate()); } catch { @@ -446,7 +446,7 @@ namespace BizHawk.Client.EmuHawk ShowMessageBox(owner: null, message, "Initialization Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Config.SoundOutputMethod = ESoundOutputMethod.Dummy; - Sound = new Sound(Handle, Config, Emulator.VsyncRate); + Sound = new Sound(Handle, Config, () => Emulator.VsyncRate()); } Sound.StartSound(); @@ -3324,7 +3324,7 @@ namespace BizHawk.Client.EmuHawk else { _currentSoundProvider.SetSyncMode(SyncSoundMode.Sync); - _aviSoundInputAsync = new SyncToAsyncProvider(Emulator.VsyncRate, _currentSoundProvider); + _aviSoundInputAsync = new SyncToAsyncProvider(() => Emulator.VsyncRate(), _currentSoundProvider); } }