From 44ca91adb13cb1b9163e813d075115dbb57654c7 Mon Sep 17 00:00:00 2001 From: Sour Date: Tue, 12 Jun 2018 16:37:36 -0400 Subject: [PATCH] Savestates: Fixed audio issues when loading savestate saved in one region while the UI is configured to use another region (e.g ntsc vs pal) --- Core/SoundMixer.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Core/SoundMixer.cpp b/Core/SoundMixer.cpp index 5bcac40c..64d00623 100644 --- a/Core/SoundMixer.cpp +++ b/Core/SoundMixer.cpp @@ -41,9 +41,14 @@ SoundMixer::~SoundMixer() void SoundMixer::StreamState(bool saving) { - Stream(_clockRate, _sampleRate); + Stream(_clockRate, _sampleRate, _model); if(!saving) { + if(_model == NesModel::Auto) { + //Older savestates - assume NTSC + _model = NesModel::NTSC; + } + Reset(); UpdateRates(true); } @@ -174,8 +179,10 @@ void SoundMixer::PlayAudioBuffer(uint32_t time) void SoundMixer::SetNesModel(NesModel model) { - _model = model; - UpdateRates(true); + if(_model != model) { + _model = model; + UpdateRates(true); + } } void SoundMixer::UpdateRates(bool forceUpdate)