From 35dfe57bc1aec45b8ced0520b70f6ba5495da12b Mon Sep 17 00:00:00 2001 From: booto Date: Sun, 3 Aug 2014 05:24:19 +0800 Subject: [PATCH] DSP: copy audio dma samples as early as possible --- Source/Core/Core/HW/DSP.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Source/Core/Core/HW/DSP.cpp b/Source/Core/Core/HW/DSP.cpp index a0d3a35337..5cd14885e6 100644 --- a/Source/Core/Core/HW/DSP.cpp +++ b/Source/Core/Core/HW/DSP.cpp @@ -403,10 +403,9 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base) g_audioDMA.current_source_address = g_audioDMA.SourceAddress; g_audioDMA.remaining_blocks_count = g_audioDMA.AudioDMAControl.NumBlocks; - if (g_audioDMA.AudioDMAControl.NumBlocks == 0) - { - g_audioDMA.AudioDMAControl.Enable = 0; - } + // We make the samples ready as soon as possible + void *address = Memory::GetPointer(g_audioDMA.SourceAddress); + AudioCommon::SendAIBuffer((short*)address, g_audioDMA.AudioDMAControl.NumBlocks * 8); GenerateDSPInterrupt(DSP::INT_AID); } @@ -491,9 +490,6 @@ void UpdateAudioDMA() // Read audio at g_audioDMA.current_source_address in RAM and push onto an // external audio fifo in the emulator, to be mixed with the disc // streaming output. - void *address = Memory::GetPointer(g_audioDMA.current_source_address); - AudioCommon::SendAIBuffer((short*)address, 8); - g_audioDMA.remaining_blocks_count--; g_audioDMA.current_source_address += 32; @@ -506,7 +502,12 @@ void UpdateAudioDMA() { g_audioDMA.AudioDMAControl.Enable = 0; } - + else + { + // We make the samples ready as soon as possible + void *address = Memory::GetPointer(g_audioDMA.SourceAddress); + AudioCommon::SendAIBuffer((short*)address, g_audioDMA.AudioDMAControl.NumBlocks * 8); + } GenerateDSPInterrupt(DSP::INT_AID); } }