From 3d1180ee21603392c32b4d610b6e866a1af0d262 Mon Sep 17 00:00:00 2001 From: Hamish Milne Date: Fri, 27 Mar 2020 22:19:29 +0000 Subject: [PATCH] DSP now works... committing this!! --- src/audio_core/dsp_interface.cpp | 7 ++++++- src/audio_core/hle/hle.cpp | 11 ++++++++++- src/core/core.cpp | 11 ++++------- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/audio_core/dsp_interface.cpp b/src/audio_core/dsp_interface.cpp index b6e74b82cd..fc2e231f24 100644 --- a/src/audio_core/dsp_interface.cpp +++ b/src/audio_core/dsp_interface.cpp @@ -1,3 +1,4 @@ +#pragma optimize("", off) // Copyright 2017 Citra Emulator Project // Licensed under GPLv2 or any later version // Refer to the license.txt file included. @@ -14,7 +15,11 @@ namespace AudioCore { DspInterface::DspInterface() = default; -DspInterface::~DspInterface() = default; +DspInterface::~DspInterface() { + LOG_WARNING(Audio_DSP, "c1"); + sink.reset(); + LOG_WARNING(Audio_DSP, "c2"); +} void DspInterface::SetSink(const std::string& sink_id, const std::string& audio_device) { sink = CreateSinkFromID(Settings::values.sink_id, Settings::values.audio_device_id); diff --git a/src/audio_core/hle/hle.cpp b/src/audio_core/hle/hle.cpp index 87af17ba79..cac8a7df5e 100644 --- a/src/audio_core/hle/hle.cpp +++ b/src/audio_core/hle/hle.cpp @@ -16,6 +16,7 @@ #elif HAVE_FDK #include "audio_core/hle/fdk_decoder.h" #endif +#include #include "audio_core/hle/common.h" #include "audio_core/hle/decoder.h" #include "audio_core/hle/hle.h" @@ -148,8 +149,11 @@ DspHle::Impl::Impl(DspHle& parent_, Memory::MemorySystem& memory) : parent(paren } DspHle::Impl::~Impl() { + LOG_WARNING(Audio_DSP, "b1"); Core::Timing& timing = Core::System::GetInstance().CoreTiming(); + LOG_WARNING(Audio_DSP, "b2"); timing.UnscheduleEvent(tick_event, 0); + LOG_WARNING(Audio_DSP, "b3"); } DspState DspHle::Impl::GetDspState() const { @@ -448,7 +452,12 @@ void DspHle::Impl::AudioTickCallback(s64 cycles_late) { } DspHle::DspHle(Memory::MemorySystem& memory) : impl(std::make_unique(*this, memory)) {} -DspHle::~DspHle() = default; +DspHle::~DspHle() { + + LOG_WARNING(Audio_DSP, "a1"); + impl.reset(); + LOG_WARNING(Audio_DSP, "a2"); +} u16 DspHle::RecvData(u32 register_number) { return impl->RecvData(register_number); diff --git a/src/core/core.cpp b/src/core/core.cpp index ca22999203..1c18af2027 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -547,13 +547,10 @@ void System::serialize(Archive& ar, const unsigned int file_version) { ar&* service_manager.get(); ar& GPU::g_regs; ar& LCD::g_regs; - if (Archive::is_loading::value) { - dsp_core.reset(); + if (!dynamic_cast(dsp_core.get())) { + throw std::runtime_error("Only HLE audio supported"); } - if (dsp_core) { - throw "BLEH"; - } - ar& dsp_core; + ar&* dynamic_cast(dsp_core.get()); ar&* memory.get(); ar&* kernel.get(); @@ -562,7 +559,7 @@ void System::serialize(Archive& ar, const unsigned int file_version) { Service::GSP::SetGlobalModule(*this); memory->SetDSP(*dsp_core); - dsp_core->SetSink(Settings::values.sink_id, Settings::values.audio_device_id); + // dsp_core->SetSink(Settings::values.sink_id, Settings::values.audio_device_id); dsp_core->EnableStretching(Settings::values.enable_audio_stretching); } }