mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-30 01:33:45 +01:00
More refactoring. Add the AudioBackend interface
This commit is contained in:
1 parent
990b74cc17
commit
61d6c95f0c
22 files changed
+94
-74
No files matched your search
+17
-19
@@ -86,6 +86,7 @@
|
||||
#include "Common/GPU/ShaderTranslation.h"
|
||||
#include "Common/VR/PPSSPPVR.h"
|
||||
#include "Common/Thread/ThreadManager.h"
|
||||
#include "Common/Audio/AudioBackend.h"
|
||||
|
||||
#include "Core/ControlMapper.h"
|
||||
#include "Core/Config.h"
|
||||
@@ -193,9 +194,7 @@ static int g_restartGraphics;
|
||||
static bool g_windowHidden = false;
|
||||
std::vector<std::function<void()>> g_pendingClosures;
|
||||
|
||||
#ifdef _WIN32
|
||||
WindowsAudioBackend *winAudioBackend;
|
||||
#endif
|
||||
AudioBackend *g_audioBackend = nullptr;
|
||||
|
||||
std::thread *graphicsLoadThread;
|
||||
|
||||
@@ -839,14 +838,10 @@ bool NativeInitGraphics(GraphicsContext *graphicsContext) {
|
||||
g_screenManager->setPostRenderCallback(&CallbackPostRender, nullptr);
|
||||
g_screenManager->deviceRestored(g_draw);
|
||||
|
||||
#ifdef _WIN32
|
||||
winAudioBackend = CreateAudioBackend((AudioBackendType)g_Config.iAudioBackend);
|
||||
#if PPSSPP_PLATFORM(UWP)
|
||||
winAudioBackend->Init(&NativeMix);
|
||||
#else
|
||||
winAudioBackend->Init(&NativeMix);
|
||||
#endif
|
||||
#endif
|
||||
g_audioBackend = System_CreateAudioBackend();
|
||||
if (g_audioBackend) {
|
||||
g_audioBackend->Init(&NativeMix);
|
||||
}
|
||||
|
||||
#if defined(_WIN32) && !PPSSPP_PLATFORM(UWP)
|
||||
if (IsWin7OrHigher()) {
|
||||
@@ -932,11 +927,6 @@ void NativeShutdownGraphics() {
|
||||
if (gpu)
|
||||
gpu->DeviceLost();
|
||||
|
||||
#if PPSSPP_PLATFORM(WINDOWS)
|
||||
delete winAudioBackend;
|
||||
winAudioBackend = nullptr;
|
||||
#endif
|
||||
|
||||
#if PPSSPP_PLATFORM(WINDOWS) && !PPSSPP_PLATFORM(UWP)
|
||||
if (winCamera) {
|
||||
winCamera->waitShutDown();
|
||||
@@ -950,6 +940,11 @@ void NativeShutdownGraphics() {
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g_audioBackend) {
|
||||
delete g_audioBackend;
|
||||
g_audioBackend = nullptr;
|
||||
}
|
||||
|
||||
UIBackgroundShutdown();
|
||||
|
||||
delete g_gameInfoCache;
|
||||
@@ -1071,8 +1066,6 @@ void NativeFrame(GraphicsContext *graphicsContext) {
|
||||
ProcessWheelRelease(NKCODE_EXT_MOUSEWHEEL_UP, startTime, false);
|
||||
ProcessWheelRelease(NKCODE_EXT_MOUSEWHEEL_DOWN, startTime, false);
|
||||
|
||||
System_Notify(SystemNotification::POLL_AUDIO_DEVICE);
|
||||
|
||||
SetOverrideScreenFrame(nullptr);
|
||||
|
||||
// it's ok to call this redundantly with DoFrame from EmuScreen
|
||||
@@ -1099,6 +1092,10 @@ void NativeFrame(GraphicsContext *graphicsContext) {
|
||||
|
||||
g_screenManager->update();
|
||||
|
||||
if (g_audioBackend) {
|
||||
g_audioBackend->FrameUpdate();
|
||||
}
|
||||
|
||||
// Do this after g_screenManager.update() so we can receive setting changes before rendering.
|
||||
{
|
||||
std::vector<PendingMessage> toProcess;
|
||||
@@ -1536,8 +1533,9 @@ void NativeShutdown() {
|
||||
ShaderTranslationShutdown();
|
||||
|
||||
// Avoid shutting this down when restarting core.
|
||||
if (!restarting)
|
||||
if (!restarting) {
|
||||
g_logManager.Shutdown();
|
||||
}
|
||||
|
||||
g_threadManager.Teardown();
|
||||
|
||||
|
||||
Reference in new issue
Block a user