From e3419ebfa3fa9f816b3e3367f44e8df70c74b494 Mon Sep 17 00:00:00 2001 From: Souryo Date: Mon, 28 Dec 2015 14:02:49 -0500 Subject: [PATCH] Mute audio while running tests --- Core/AutoRomTest.cpp | 3 +++ Core/EmulationSettings.cpp | 3 ++- Core/EmulationSettings.h | 8 +++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Core/AutoRomTest.cpp b/Core/AutoRomTest.cpp index 6f7c7ab1..d20bd015 100644 --- a/Core/AutoRomTest.cpp +++ b/Core/AutoRomTest.cpp @@ -192,6 +192,8 @@ bool AutoRomTest::Run(string filename) } EmulationSettings::SetEmulationSpeed(0); + EmulationSettings::SetAudioState(false); + Console::Pause(); Reset(); @@ -227,6 +229,7 @@ bool AutoRomTest::Run(string filename) _runningTest = false; EmulationSettings::SetEmulationSpeed(100); + EmulationSettings::SetAudioState(true); return _testResult; } diff --git a/Core/EmulationSettings.cpp b/Core/EmulationSettings.cpp index 4e26b2a5..32a72d2f 100644 --- a/Core/EmulationSettings.cpp +++ b/Core/EmulationSettings.cpp @@ -6,4 +6,5 @@ uint32_t EmulationSettings::AudioLatency = 20000; double EmulationSettings::ChannelVolume[5] = { 0.5f, 0.5f, 0.5f, 0.5f, 0.5f }; NesModel EmulationSettings::Model = NesModel::Auto; OverscanDimensions EmulationSettings::Overscan; -uint32_t EmulationSettings::EmulationSpeed = 100; \ No newline at end of file +uint32_t EmulationSettings::EmulationSpeed = 100; +bool EmulationSettings::AudioEnabled = true; \ No newline at end of file diff --git a/Core/EmulationSettings.h b/Core/EmulationSettings.h index d8edb69b..86865bfc 100644 --- a/Core/EmulationSettings.h +++ b/Core/EmulationSettings.h @@ -51,6 +51,7 @@ class EmulationSettings { private: static uint32_t Flags; + static bool AudioEnabled; static uint32_t AudioLatency; static double ChannelVolume[5]; static NesModel Model; @@ -83,6 +84,11 @@ public: return Model; } + static void SetAudioState(bool enabled) + { + AudioEnabled = enabled; + } + //0: Muted, 0.5: Default, 1.0: Max volume static void SetChannelVolume(AudioChannel channel, double volume) { @@ -120,7 +126,7 @@ public: static double GetChannelVolume(AudioChannel channel) { - return ChannelVolume[(int)channel]; + return AudioEnabled ? ChannelVolume[(int)channel] : 0; } static uint32_t GetAudioLatency()