Fix DTK audio not working after loading a savestate

The main problem was that the volume of the mixer wasn't savestated.
The volume is typically 0 at the beginning of a game, so loading a
savestate at the beginning of a game would lead to silent DTK audio.

I also added savestating to StreamADPCM.cpp.
This commit is contained in:
JosJuice
2017-11-06 09:15:05 +01:00
parent 5e70af1ce5
commit b00ef39c1c
7 changed files with 38 additions and 2 deletions

View File

@ -8,6 +8,7 @@
#include <cstring>
#include "AudioCommon/DPL2Decoder.h"
#include "Common/ChunkFile.h"
#include "Common/CommonTypes.h"
#include "Common/Logging/Log.h"
#include "Common/MathUtil.h"
@ -25,6 +26,13 @@ Mixer::~Mixer()
{
}
void Mixer::DoState(PointerWrap& p)
{
m_dma_mixer.DoState(p);
m_streaming_mixer.DoState(p);
m_wiimote_speaker_mixer.DoState(p);
}
// Executed from sound stream thread
unsigned int Mixer::MixerFifo::Mix(short* samples, unsigned int numSamples,
bool consider_framelimit)
@ -333,6 +341,13 @@ void Mixer::StopLogDSPAudio()
}
}
void Mixer::MixerFifo::DoState(PointerWrap& p)
{
p.Do(m_input_sample_rate);
p.Do(m_LVolume);
p.Do(m_RVolume);
}
void Mixer::MixerFifo::SetInputSampleRate(unsigned int rate)
{
m_input_sample_rate = rate;