Mute audio while running tests

This commit is contained in:
Souryo 2015-12-28 14:02:49 -05:00
parent 165c8d3b81
commit e3419ebfa3
3 changed files with 12 additions and 2 deletions

View file

@ -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;
}

View file

@ -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;
uint32_t EmulationSettings::EmulationSpeed = 100;
bool EmulationSettings::AudioEnabled = true;

View file

@ -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()