diff --git a/CMakeLists.txt b/CMakeLists.txt
index e654ed7cb2..6972eaf731 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1314,8 +1314,6 @@ add_library(${CoreLibName} ${CoreLinkType}
Core/MemMapFunctions.cpp
Core/PSPLoaders.cpp
Core/PSPLoaders.h
- Core/PSPMixer.cpp
- Core/PSPMixer.h
Core/Reporting.cpp
Core/Reporting.h
Core/SaveState.cpp
diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt
index 9930c1f5ba..ba804fbd51 100644
--- a/Core/CMakeLists.txt
+++ b/Core/CMakeLists.txt
@@ -101,7 +101,6 @@ set(SRCS
MemMap.cpp
MemMapFunctions.cpp
PSPLoaders.cpp
- PSPMixer.cpp
System.cpp
Core.cpp
../git-version.cpp
diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj
index 497118a561..bac7ae807d 100644
--- a/Core/Core.vcxproj
+++ b/Core/Core.vcxproj
@@ -369,7 +369,6 @@
-
@@ -562,7 +561,6 @@
-
@@ -601,4 +599,4 @@
-
+
\ No newline at end of file
diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters
index 6348b1c1f5..bb2f85b6c5 100644
--- a/Core/Core.vcxproj.filters
+++ b/Core/Core.vcxproj.filters
@@ -267,9 +267,6 @@
Core
-
- Core
-
Core
@@ -748,9 +745,6 @@
Core
-
- Core
-
HLE\Libraries
diff --git a/Core/Host.cpp b/Core/Host.cpp
index 2dd5c7d33c..dbe00d7647 100644
--- a/Core/Host.cpp
+++ b/Core/Host.cpp
@@ -22,11 +22,6 @@
Host *host;
-int PMixer::Mix(short *stereoout, int numSamples) {
- memset(stereoout, 0, numSamples * 2 * sizeof(short));
- return numSamples;
-}
-
bool Host::AttemptLoadSymbolMap() {
symbolMap.Clear();
return false;
diff --git a/Core/Host.h b/Core/Host.h
index aeb2436eaf..58ef4739ad 100644
--- a/Core/Host.h
+++ b/Core/Host.h
@@ -22,13 +22,6 @@
struct InputState;
-class PMixer {
-public:
- PMixer() {}
- virtual ~PMixer() {}
- virtual int Mix(short *stereoout, int numSamples);
-};
-
class Host {
public:
virtual ~Host() {}
@@ -43,7 +36,7 @@ public:
virtual bool InitGraphics(std::string *error_string) = 0;
virtual void ShutdownGraphics() = 0;
- virtual void InitSound(PMixer *mixer) = 0;
+ virtual void InitSound() = 0;
virtual void UpdateSound() {}
virtual void UpdateScreen() {}
virtual void GoFullscreen(bool) {}
diff --git a/Core/PSPMixer.cpp b/Core/PSPMixer.cpp
deleted file mode 100644
index b82d9e649f..0000000000
--- a/Core/PSPMixer.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (C) 2012 PPSSPP Project
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0 or later versions.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official git repository and contact information can be found at
-// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
-
-#include "MemMap.h"
-#include "Host.h"
-
-#include "System.h"
-#include "PSPMixer.h"
-
-#include "HLE/__sceAudio.h"
-#include "base/NativeApp.h"
-
-int PSPMixer::Mix(short *stereoout, int numSamples)
-{
- return __AudioMix(stereoout, numSamples);
-}
diff --git a/Core/PSPMixer.h b/Core/PSPMixer.h
deleted file mode 100644
index b8f36cbd35..0000000000
--- a/Core/PSPMixer.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (C) 2012 PPSSPP Project
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0 or later versions.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official git repository and contact information can be found at
-// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
-
-#pragma once
-
-#include "Core/Host.h"
-
-class PSPMixer : public PMixer
-{
-public:
- int Mix(short *stereoout, int numSamples) override;
-};
-
diff --git a/Core/System.cpp b/Core/System.cpp
index d704aa7a24..7f192f4573 100644
--- a/Core/System.cpp
+++ b/Core/System.cpp
@@ -36,7 +36,6 @@
#include "Core/Host.h"
#include "Core/System.h"
-#include "Core/PSPMixer.h"
#include "Core/HLE/HLE.h"
#include "Core/HLE/ReplaceTables.h"
#include "Core/HLE/sceKernel.h"
@@ -74,13 +73,13 @@ ParamSFOData g_paramSFO;
static GlobalUIState globalUIState;
static CoreParameter coreParameter;
static FileLoader *loadedFile;
-static PSPMixer *mixer;
static std::thread *cpuThread = nullptr;
static std::thread::id cpuThreadID;
static recursive_mutex cpuThreadLock;
static condition_variable cpuThreadCond;
static condition_variable cpuThreadReplyCond;
static u64 cpuThreadUntil;
+bool audioInitialized;
// This can be read and written from ANYWHERE.
volatile CoreState coreState = CORE_STEPPING;
@@ -101,13 +100,13 @@ GlobalUIState GetUIState() {
}
bool IsAudioInitialised() {
- return mixer != NULL;
+ return audioInitialized;
}
void Audio_Init() {
- if (mixer == NULL) {
- mixer = new PSPMixer();
- host->InitSound(mixer);
+ if (!audioInitialized) {
+ audioInitialized = true;
+ host->InitSound();
}
}
@@ -248,7 +247,7 @@ void CPU_Shutdown() {
HLEShutdown();
if (coreParameter.enableSound) {
host->ShutdownSound();
- mixer = 0; // deleted in ShutdownSound
+ audioInitialized = false; // deleted in ShutdownSound
}
pspFileSystem.Shutdown();
mipsr4k.Shutdown();
diff --git a/UI/HostTypes.h b/UI/HostTypes.h
index 7f16f1693a..9d987962d9 100644
--- a/UI/HostTypes.h
+++ b/UI/HostTypes.h
@@ -40,7 +40,7 @@ public:
bool InitGraphics(std::string *error_message) override { return true; }
void ShutdownGraphics() override {}
- void InitSound(PMixer *mixer) override;
+ void InitSound() override;
void UpdateSound() override {}
void ShutdownSound() override;
@@ -96,7 +96,7 @@ public:
virtual bool InitGraphics(std::string *error_message) override { return true; }
virtual void ShutdownGraphics() override {}
- virtual void InitSound(PMixer *mixer) override;
+ virtual void InitSound() override;
virtual void UpdateSound() override {}
virtual void ShutdownSound();
diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp
index c055752b4a..4990c7c349 100644
--- a/UI/NativeApp.cpp
+++ b/UI/NativeApp.cpp
@@ -71,10 +71,10 @@
#include "Core/Config.h"
#include "Core/Core.h"
#include "Core/Host.h"
-#include "Core/PSPMixer.h"
#include "Core/SaveState.h"
#include "Core/Screenshot.h"
#include "Core/System.h"
+#include "Core/HLE/__sceAudio.h"
#include "Core/HLE/sceCtrl.h"
#include "Core/Util/GameManager.h"
@@ -178,15 +178,13 @@ int Win32Mix(short *buffer, int numSamples, int bits, int rate, int channels) {
#endif
// globals
-PMixer *g_mixer = 0;
#ifndef _WIN32
static AndroidLogger *logger = 0;
#endif
std::string boot_filename = "";
-void NativeHost::InitSound(PMixer *mixer) {
- g_mixer = mixer;
+void NativeHost::InitSound() {
#ifdef IOS
iOSCoreAudioInit();
#endif
@@ -196,12 +194,11 @@ void NativeHost::ShutdownSound() {
#ifdef IOS
iOSCoreAudioShutdown();
#endif
- g_mixer = 0;
}
#if !defined(MOBILE_DEVICE) && defined(USING_QT_UI)
-void QtHost::InitSound(PMixer *mixer) { g_mixer = mixer; }
-void QtHost::ShutdownSound() { g_mixer = 0; }
+void QtHost::InitSound() { }
+void QtHost::ShutdownSound() { }
#endif
std::string NativeQueryConfig(std::string query) {
@@ -228,8 +225,8 @@ std::string NativeQueryConfig(std::string query) {
}
int NativeMix(short *audio, int num_samples) {
- if (g_mixer && GetUIState() == UISTATE_INGAME) {
- num_samples = g_mixer->Mix(audio, num_samples);
+ if (GetUIState() == UISTATE_INGAME) {
+ num_samples = __AudioMix(audio, num_samples);
} else {
MixBackgroundAudio(audio, num_samples);
// memset(audio, 0, num_samples * 2 * sizeof(short));
diff --git a/Windows/WindowsHost.cpp b/Windows/WindowsHost.cpp
index b7a2bfc841..b6637c681b 100644
--- a/Windows/WindowsHost.cpp
+++ b/Windows/WindowsHost.cpp
@@ -59,8 +59,6 @@
static const int numCPUs = 1;
-extern PMixer *g_mixer;
-
float mouseDeltaX = 0;
float mouseDeltaY = 0;
@@ -124,9 +122,8 @@ void WindowsHost::SetWindowTitle(const char *message)
PostMessage(mainWindow_, MainWindow::WM_USER_WINDOW_TITLE_CHANGED, 0, 0);
}
-void WindowsHost::InitSound(PMixer *mixer)
+void WindowsHost::InitSound()
{
- g_mixer = mixer;
}
void WindowsHost::UpdateSound()
@@ -136,9 +133,6 @@ void WindowsHost::UpdateSound()
void WindowsHost::ShutdownSound()
{
- if (g_mixer)
- delete g_mixer;
- g_mixer = 0;
}
void WindowsHost::UpdateUI()
diff --git a/Windows/WindowsHost.h b/Windows/WindowsHost.h
index 5dc96cf1bf..73eb5c0b73 100644
--- a/Windows/WindowsHost.h
+++ b/Windows/WindowsHost.h
@@ -42,7 +42,7 @@ public:
void PollControllers(InputState &input_state) override;
void ShutdownGraphics() override;
- void InitSound(PMixer *mixer) override;
+ void InitSound() override;
void UpdateSound() override;
void ShutdownSound() override;
diff --git a/android/jni/Android.mk b/android/jni/Android.mk
index 3eec5e07f1..ccd56c00c2 100644
--- a/android/jni/Android.mk
+++ b/android/jni/Android.mk
@@ -201,7 +201,6 @@ EXEC_AND_LIB_FILES := \
$(SRC)/Core/SaveState.cpp \
$(SRC)/Core/Screenshot.cpp \
$(SRC)/Core/System.cpp \
- $(SRC)/Core/PSPMixer.cpp \
$(SRC)/Core/Debugger/Breakpoints.cpp \
$(SRC)/Core/Debugger/SymbolMap.cpp \
$(SRC)/Core/Dialog/PSPDialog.cpp \
diff --git a/headless/StubHost.h b/headless/StubHost.h
index 47dafe1e36..39290b7bc2 100644
--- a/headless/StubHost.h
+++ b/headless/StubHost.h
@@ -35,7 +35,7 @@ public:
bool InitGraphics(std::string *error_message) override {return false;}
void ShutdownGraphics() override {}
- void InitSound(PMixer *mixer) override {}
+ void InitSound() override {}
void UpdateSound() override {}
void ShutdownSound() override {}