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)

This commit is contained in:
Sour 2018-06-12 16:37:36 -04:00
parent 509d85b2a3
commit 44ca91adb1

View file

@ -41,9 +41,14 @@ SoundMixer::~SoundMixer()
void SoundMixer::StreamState(bool saving) void SoundMixer::StreamState(bool saving)
{ {
Stream(_clockRate, _sampleRate); Stream(_clockRate, _sampleRate, _model);
if(!saving) { if(!saving) {
if(_model == NesModel::Auto) {
//Older savestates - assume NTSC
_model = NesModel::NTSC;
}
Reset(); Reset();
UpdateRates(true); UpdateRates(true);
} }
@ -174,8 +179,10 @@ void SoundMixer::PlayAudioBuffer(uint32_t time)
void SoundMixer::SetNesModel(NesModel model) void SoundMixer::SetNesModel(NesModel model)
{ {
_model = model; if(_model != model) {
UpdateRates(true); _model = model;
UpdateRates(true);
}
} }
void SoundMixer::UpdateRates(bool forceUpdate) void SoundMixer::UpdateRates(bool forceUpdate)