summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorMarkus Wick <degasus@users.noreply.github.com>2017-11-08 12:03:05 +0100
committerGitHub <noreply@github.com>2017-11-08 12:03:05 +0100
commit7e7b5af4c7ecbc5f28db1054c9be4cd54e679e62 (patch)
tree1188bcfc56eae6bc68fabebb7a0fea48384b1e04 /Source
parentd9d4bd7eef7dd9af331be1ed3d3e6e737b284178 (diff)
parentb00ef39c1c8c3aa2e02bcae4a6aa80ff927c381b (diff)
Merge pull request #6173 from JosJuice/dtk-savestate
Fix DTK audio not working after loading a savestate
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/AudioCommon/Mixer.cpp15
-rw-r--r--Source/Core/AudioCommon/Mixer.h5
-rw-r--r--Source/Core/Core/HW/AudioInterface.cpp2
-rw-r--r--Source/Core/Core/HW/DVD/DVDInterface.cpp2
-rw-r--r--Source/Core/Core/HW/StreamADPCM.cpp11
-rw-r--r--Source/Core/Core/HW/StreamADPCM.h3
-rw-r--r--Source/Core/Core/State.cpp2
7 files changed, 38 insertions, 2 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);
diff --git a/Source/Core/Core/HW/AudioInterface.cpp b/Source/Core/Core/HW/AudioInterface.cpp
index 898101d095..62b43cc2a8 100644
--- a/Source/Core/Core/HW/AudioInterface.cpp
+++ b/Source/Core/Core/HW/AudioInterface.cpp
@@ -127,6 +127,8 @@ void DoState(PointerWrap& p)
p.Do(g_AISSampleRate);
p.Do(g_AIDSampleRate);
p.Do(g_CPUCyclesPerSample);
+
+ g_sound_stream->GetMixer()->DoState(p);
}
static void GenerateAudioInterrupt();
diff --git a/Source/Core/Core/HW/DVD/DVDInterface.cpp b/Source/Core/Core/HW/DVD/DVDInterface.cpp
index 853026a92e..5c3704667b 100644
--- a/Source/Core/Core/HW/DVD/DVDInterface.cpp
+++ b/Source/Core/Core/HW/DVD/DVDInterface.cpp
@@ -285,6 +285,8 @@ void DoState(PointerWrap& p)
p.Do(s_disc_path_to_insert);
DVDThread::DoState(p);
+
+ StreamADPCM::DoState(p);
}
static size_t ProcessDTKSamples(std::vector<s16>* temp_pcm, const std::vector<u8>& audio_data)
diff --git a/Source/Core/Core/HW/StreamADPCM.cpp b/Source/Core/Core/HW/StreamADPCM.cpp
index d3e3dbf5a7..1175eb8c9c 100644
--- a/Source/Core/Core/HW/StreamADPCM.cpp
+++ b/Source/Core/Core/HW/StreamADPCM.cpp
@@ -6,12 +6,13 @@
#include "Core/HW/StreamADPCM.h"
+#include "Common/ChunkFile.h"
#include "Common/CommonTypes.h"
#include "Common/MathUtil.h"
namespace StreamADPCM
{
-// STATE_TO_SAVE (not saved yet!)
+// STATE_TO_SAVE
static s32 histl1;
static s32 histl2;
static s32 histr1;
@@ -56,6 +57,14 @@ void InitFilter()
histr2 = 0;
}
+void DoState(PointerWrap& p)
+{
+ p.Do(histl1);
+ p.Do(histl2);
+ p.Do(histr1);
+ p.Do(histr2);
+}
+
void DecodeBlock(s16* pcm, const u8* adpcm)
{
for (int i = 0; i < SAMPLES_PER_BLOCK; i++)
diff --git a/Source/Core/Core/HW/StreamADPCM.h b/Source/Core/Core/HW/StreamADPCM.h
index 69daf227f0..7ec6022137 100644
--- a/Source/Core/Core/HW/StreamADPCM.h
+++ b/Source/Core/Core/HW/StreamADPCM.h
@@ -8,6 +8,8 @@
#include "Common/CommonTypes.h"
+class PointerWrap;
+
namespace StreamADPCM
{
enum
@@ -17,5 +19,6 @@ enum
};
void InitFilter();
+void DoState(PointerWrap& p);
void DecodeBlock(s16* pcm, const u8* adpcm);
}
diff --git a/Source/Core/Core/State.cpp b/Source/Core/Core/State.cpp
index afd6105e7c..70c9c351eb 100644
--- a/Source/Core/Core/State.cpp
+++ b/Source/Core/Core/State.cpp
@@ -74,7 +74,7 @@ static Common::Event g_compressAndDumpStateSyncEvent;
static std::thread g_save_thread;
// Don't forget to increase this after doing changes on the savestate system
-static const u32 STATE_VERSION = 91; // Last changed in PR 6094
+static const u32 STATE_VERSION = 92; // Last changed in PR 6173
// Maps savestate versions to Dolphin versions.
// Versions after 42 don't need to be added to this list,