DSP now works... committing this!!

This commit is contained in:
Hamish Milne 2020-03-27 22:19:29 +00:00
parent 5604613642
commit 3d1180ee21
3 changed files with 20 additions and 9 deletions

View File

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

View File

@ -16,6 +16,7 @@
#elif HAVE_FDK
#include "audio_core/hle/fdk_decoder.h"
#endif
#include <iostream>
#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<Impl>(*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);

View File

@ -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<AudioCore::DspHle*>(dsp_core.get())) {
throw std::runtime_error("Only HLE audio supported");
}
if (dsp_core) {
throw "BLEH";
}
ar& dsp_core;
ar&* dynamic_cast<AudioCore::DspHle*>(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);
}
}