Remove useless indirection class "PSPMixer"

This commit is contained in:
Henrik Rydgard 2015-01-11 12:02:49 +01:00
parent 3ca212ad0c
commit 62d86f3246
15 changed files with 19 additions and 110 deletions

View File

@ -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

View File

@ -101,7 +101,6 @@ set(SRCS
MemMap.cpp
MemMapFunctions.cpp
PSPLoaders.cpp
PSPMixer.cpp
System.cpp
Core.cpp
../git-version.cpp

View File

@ -369,7 +369,6 @@
<ClCompile Include="MIPS\x86\Jit.cpp" />
<ClCompile Include="MIPS\x86\RegCache.cpp" />
<ClCompile Include="PSPLoaders.cpp" />
<ClCompile Include="PSPMixer.cpp" />
<ClCompile Include="Reporting.cpp" />
<ClCompile Include="SaveState.cpp" />
<ClCompile Include="MIPS\MIPSStackWalk.cpp" />
@ -562,7 +561,6 @@
<ClInclude Include="MIPS\x86\RegCache.h" />
<ClInclude Include="Opcode.h" />
<ClInclude Include="PSPLoaders.h" />
<ClInclude Include="PSPMixer.h" />
<ClInclude Include="Reporting.h" />
<ClInclude Include="SaveState.h" />
<ClInclude Include="MIPS\MIPSStackWalk.h" />
@ -601,4 +599,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -267,9 +267,6 @@
<ClCompile Include="PSPLoaders.cpp">
<Filter>Core</Filter>
</ClCompile>
<ClCompile Include="PSPMixer.cpp">
<Filter>Core</Filter>
</ClCompile>
<ClCompile Include="System.cpp">
<Filter>Core</Filter>
</ClCompile>
@ -748,9 +745,6 @@
<ClInclude Include="PSPLoaders.h">
<Filter>Core</Filter>
</ClInclude>
<ClInclude Include="PSPMixer.h">
<Filter>Core</Filter>
</ClInclude>
<ClInclude Include="HLE\__sceAudio.h">
<Filter>HLE\Libraries</Filter>
</ClInclude>

View File

@ -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;

View File

@ -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) {}

View File

@ -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);
}

View File

@ -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;
};

View File

@ -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();

View File

@ -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();

View File

@ -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));

View File

@ -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()

View File

@ -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;

View File

@ -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 \

View File

@ -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 {}