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
4 changed files with 24 additions and 4 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue