AudioCommon: Pass Core::System to AudioCommon functions.

This commit is contained in:
Admiral H. Curtiss
2022-10-13 21:01:55 +02:00
parent 89bc1649e3
commit 1c63349984
8 changed files with 57 additions and 55 deletions

View File

@ -414,7 +414,8 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
mmio->Register(
base | AUDIO_DMA_CONTROL_LEN, MMIO::DirectRead<u16>(&state.audio_dma.AudioDMAControl.Hex),
MMIO::ComplexWrite<u16>([](u32, u16 val) {
auto& state = Core::System::GetInstance().GetDSPState().GetData();
auto& system = Core::System::GetInstance();
auto& state = system.GetDSPState().GetData();
bool already_enabled = state.audio_dma.AudioDMAControl.Enable;
state.audio_dma.AudioDMAControl.Hex = val;
@ -512,7 +513,8 @@ void UpdateDSPSlice(int cycles)
// This happens at 4 khz, since 32 bytes at 4khz = 4 bytes at 32 khz (16bit stereo pcm)
void UpdateAudioDMA()
{
auto& state = Core::System::GetInstance().GetDSPState().GetData();
auto& system = Core::System::GetInstance();
auto& state = system.GetDSPState().GetData();
static short zero_samples[8 * 2] = {0};
if (state.audio_dma.AudioDMAControl.Enable)
@ -521,7 +523,7 @@ void UpdateAudioDMA()
// external audio fifo in the emulator, to be mixed with the disc
// streaming output.
void* address = Memory::GetPointer(state.audio_dma.current_source_address);
AudioCommon::SendAIBuffer(reinterpret_cast<short*>(address), 8);
AudioCommon::SendAIBuffer(system, reinterpret_cast<short*>(address), 8);
if (state.audio_dma.remaining_blocks_count != 0)
{
@ -539,7 +541,7 @@ void UpdateAudioDMA()
}
else
{
AudioCommon::SendAIBuffer(&zero_samples[0], 8);
AudioCommon::SendAIBuffer(system, &zero_samples[0], 8);
}
}