audio_core: pass in memory reference
Because HLE::Source is initialized as an array in the member initializer, it is hard to let it accept the reference on ctor, so it has a second init stage performed by DspHle::Impl::Impl
This commit is contained in:
parent
8bb404c82a
commit
ec01975549
@ -24,7 +24,7 @@ static constexpr u64 audio_frame_ticks = 1310252ull; ///< Units: ARM11 cycles
|
||||
|
||||
struct DspHle::Impl final {
|
||||
public:
|
||||
explicit Impl(DspHle& parent);
|
||||
explicit Impl(DspHle& parent, Memory::MemorySystem& memory);
|
||||
~Impl();
|
||||
|
||||
DspState GetDspState() const;
|
||||
@ -69,9 +69,13 @@ private:
|
||||
std::weak_ptr<DSP_DSP> dsp_dsp;
|
||||
};
|
||||
|
||||
DspHle::Impl::Impl(DspHle& parent_) : parent(parent_) {
|
||||
DspHle::Impl::Impl(DspHle& parent_, Memory::MemorySystem& memory) : parent(parent_) {
|
||||
dsp_memory.raw_memory.fill(0);
|
||||
|
||||
for (auto& source : sources) {
|
||||
source.SetMemory(memory);
|
||||
}
|
||||
|
||||
Core::Timing& timing = Core::System::GetInstance().CoreTiming();
|
||||
tick_event =
|
||||
timing.RegisterEvent("AudioCore::DspHle::tick_event", [this](u64, s64 cycles_late) {
|
||||
@ -335,7 +339,7 @@ void DspHle::Impl::AudioTickCallback(s64 cycles_late) {
|
||||
timing.ScheduleEvent(audio_frame_ticks - cycles_late, tick_event);
|
||||
}
|
||||
|
||||
DspHle::DspHle() : impl(std::make_unique<Impl>(*this)) {}
|
||||
DspHle::DspHle(Memory::MemorySystem& memory) : impl(std::make_unique<Impl>(*this, memory)) {}
|
||||
DspHle::~DspHle() = default;
|
||||
|
||||
DspState DspHle::GetDspState() const {
|
||||
|
@ -13,11 +13,15 @@
|
||||
#include "core/hle/service/dsp/dsp_dsp.h"
|
||||
#include "core/memory.h"
|
||||
|
||||
namespace Memory {
|
||||
class MemorySystem;
|
||||
}
|
||||
|
||||
namespace AudioCore {
|
||||
|
||||
class DspHle final : public DspInterface {
|
||||
public:
|
||||
DspHle();
|
||||
explicit DspHle(Memory::MemorySystem& memory);
|
||||
~DspHle();
|
||||
|
||||
DspState GetDspState() const override;
|
||||
|
@ -45,6 +45,10 @@ void Source::Reset() {
|
||||
state = {};
|
||||
}
|
||||
|
||||
void Source::SetMemory(Memory::MemorySystem& memory) {
|
||||
memory_system = &memory;
|
||||
}
|
||||
|
||||
void Source::ParseConfig(SourceConfiguration::Configuration& config,
|
||||
const s16_le (&adpcm_coeffs)[16]) {
|
||||
if (!config.dirty_raw) {
|
||||
|
@ -14,6 +14,10 @@
|
||||
#include "audio_core/interpolate.h"
|
||||
#include "common/common_types.h"
|
||||
|
||||
namespace Memory {
|
||||
class MemorySystem;
|
||||
}
|
||||
|
||||
namespace AudioCore {
|
||||
namespace HLE {
|
||||
|
||||
@ -35,6 +39,9 @@ public:
|
||||
/// Resets internal state.
|
||||
void Reset();
|
||||
|
||||
/// Sets the memory system to read data from
|
||||
void SetMemory(Memory::MemorySystem& memory);
|
||||
|
||||
/**
|
||||
* This is called once every audio frame. This performs per-source processing every frame.
|
||||
* @param config The new configuration we've got for this Source from the application.
|
||||
@ -56,6 +63,7 @@ public:
|
||||
|
||||
private:
|
||||
const std::size_t source_id;
|
||||
Memory::MemorySystem* memory_system;
|
||||
StereoFrame16 current_frame;
|
||||
|
||||
using Format = SourceConfiguration::Configuration::Format;
|
||||
|
Loading…
Reference in New Issue
Block a user