mirror of
https://github.com/libretro/Mesen.git
synced 2025-02-25 02:50:42 +00:00
APU: Fixed sound issues when loading a savestate
This commit is contained in:
parent
56d2580fbf
commit
8ef9fab489
@ -55,6 +55,7 @@ void APU::SetNesModel(NesModel model, bool forceInit)
|
||||
_frameCounter->SetNesModel(model);
|
||||
|
||||
_mixer->SetNesModel(model);
|
||||
_mixer->Reset();
|
||||
}
|
||||
}
|
||||
|
||||
@ -213,8 +214,6 @@ void APU::Reset(bool softReset)
|
||||
void APU::StreamState(bool saving)
|
||||
{
|
||||
Stream<NesModel>(_nesModel);
|
||||
Stream<uint32_t>(_currentCycle);
|
||||
Stream<uint32_t>(_previousCycle);
|
||||
Stream(_squareChannel[0].get());
|
||||
Stream(_squareChannel[1].get());
|
||||
Stream(_triangleChannel.get());
|
||||
@ -223,6 +222,8 @@ void APU::StreamState(bool saving)
|
||||
Stream(_frameCounter.get());
|
||||
|
||||
if(!saving) {
|
||||
_currentCycle = 0;
|
||||
_previousCycle = 0;
|
||||
SetNesModel(_nesModel, true);
|
||||
}
|
||||
}
|
@ -47,15 +47,14 @@ public:
|
||||
|
||||
virtual void StreamState(bool saving)
|
||||
{
|
||||
Stream<int8_t>(_lastOutput);
|
||||
Stream<uint32_t>(_previousCycle);
|
||||
if(!saving) {
|
||||
_lastOutput = 0;
|
||||
_previousCycle = 0;
|
||||
}
|
||||
|
||||
Stream<uint16_t>(_timer);
|
||||
Stream<uint16_t>(_period);
|
||||
Stream<NesModel>(_nesModel);
|
||||
|
||||
if(!saving) {
|
||||
_mixer->Reset();
|
||||
}
|
||||
}
|
||||
|
||||
void SetNesModel(NesModel model)
|
||||
|
@ -44,6 +44,8 @@ void SoundMixer::Reset()
|
||||
_previousOutput = 0;
|
||||
blip_clear(_blipBuf);
|
||||
|
||||
_timestamps.clear();
|
||||
|
||||
for(int i = 0; i < 5; i++) {
|
||||
_volumes[0] = 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user