audio_core/lle: link ahbm and audio callback
This commit is contained in:
parent
21da135cc6
commit
67213ca855
|
@ -44,6 +44,13 @@ void DspInterface::OutputFrame(StereoFrame16& frame) {
|
|||
fifo.Push(frame.data(), frame.size());
|
||||
}
|
||||
|
||||
void DspInterface::OutputSample(std::array<s16, 2> sample) {
|
||||
if (!sink)
|
||||
return;
|
||||
|
||||
fifo.Push(&sample, 1);
|
||||
}
|
||||
|
||||
void DspInterface::OutputCallback(s16* buffer, std::size_t num_frames) {
|
||||
std::size_t frames_written;
|
||||
if (perform_time_stretching) {
|
||||
|
|
|
@ -103,6 +103,7 @@ public:
|
|||
|
||||
protected:
|
||||
void OutputFrame(StereoFrame16& frame);
|
||||
void OutputSample(std::array<s16, 2> sample);
|
||||
|
||||
private:
|
||||
void FlushResidualStretcherAudio();
|
||||
|
|
|
@ -392,7 +392,17 @@ void DspLle::UnloadComponent() {
|
|||
impl->UnloadComponent();
|
||||
}
|
||||
|
||||
DspLle::DspLle() : impl(std::make_unique<Impl>()) {}
|
||||
DspLle::DspLle(Memory::MemorySystem& memory) : impl(std::make_unique<Impl>()) {
|
||||
Teakra::AHBMCallback ahbm;
|
||||
ahbm.read8 = [&memory](u32 address) -> u8 {
|
||||
return *memory.GetFCRAMPointer(address - Memory::FCRAM_PADDR);
|
||||
};
|
||||
ahbm.write8 = [&memory](u32 address, u8 value) {
|
||||
*memory.GetFCRAMPointer(address - Memory::FCRAM_PADDR) = value;
|
||||
};
|
||||
impl->teakra.SetAHBMCallback(ahbm);
|
||||
impl->teakra.SetAudioCallback([this](std::array<s16, 2> sample) { OutputSample(sample); });
|
||||
}
|
||||
DspLle::~DspLle() = default;
|
||||
|
||||
} // namespace AudioCore
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace AudioCore {
|
|||
|
||||
class DspLle final : public DspInterface {
|
||||
public:
|
||||
DspLle();
|
||||
explicit DspLle(Memory::MemorySystem& memory);
|
||||
~DspLle();
|
||||
|
||||
u16 RecvData(u32 register_number) override;
|
||||
|
|
|
@ -190,7 +190,7 @@ System::ResultStatus System::Init(EmuWindow& emu_window, u32 system_mode) {
|
|||
}
|
||||
|
||||
if (Settings::values.enable_dsp_lle) {
|
||||
dsp_core = std::make_unique<AudioCore::DspLle>();
|
||||
dsp_core = std::make_unique<AudioCore::DspLle>(*memory);
|
||||
} else {
|
||||
dsp_core = std::make_unique<AudioCore::DspHle>(*memory);
|
||||
}
|
||||
|
|
Reference in New Issue