diff options
| author | JosJuice <josjuice@gmail.com> | 2017-11-06 09:15:05 +0100 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2017-11-06 09:15:14 +0100 |
| commit | b00ef39c1c8c3aa2e02bcae4a6aa80ff927c381b (patch) | |
| tree | ada729c8830188f39879f4935639d0517d870c9b /Source/Core/AudioCommon | |
| parent | 5e70af1ce5e626751539bf82feb257e5ee11db7c (diff) | |
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.
Diffstat (limited to 'Source/Core/AudioCommon')
| -rw-r--r-- | Source/Core/AudioCommon/Mixer.cpp | 15 | ||||
| -rw-r--r-- | Source/Core/AudioCommon/Mixer.h | 5 |
2 files changed, 20 insertions, 0 deletions
diff --git a/Source/Core/AudioCommon/Mixer.cpp b/Source/Core/AudioCommon/Mixer.cpp index 374cb89d9a..da0f81c87e 100644 --- a/Source/Core/AudioCommon/Mixer.cpp +++ b/Source/Core/AudioCommon/Mixer.cpp @@ -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; diff --git a/Source/Core/AudioCommon/Mixer.h b/Source/Core/AudioCommon/Mixer.h index 6f610c6773..7359ab85e8 100644 --- a/Source/Core/AudioCommon/Mixer.h +++ b/Source/Core/AudioCommon/Mixer.h @@ -11,12 +11,16 @@ #include "AudioCommon/WaveFile.h" #include "Common/CommonTypes.h" +class PointerWrap; + class Mixer final { public: explicit Mixer(unsigned int BackendSampleRate); ~Mixer(); + void DoState(PointerWrap& p); + // Called from audio threads unsigned int Mix(short* samples, unsigned int numSamples); unsigned int MixSurround(float* samples, unsigned int num_samples); @@ -53,6 +57,7 @@ private: MixerFifo(Mixer* mixer, unsigned sample_rate) : m_mixer(mixer), m_input_sample_rate(sample_rate) { } + void DoState(PointerWrap& p); void PushSamples(const short* samples, unsigned int num_samples); unsigned int Mix(short* samples, unsigned int numSamples, bool consider_framelimit = true); void SetInputSampleRate(unsigned int rate); |
