Merge pull request #720 from booto/dma-audio-fix2

DSP: copy audio dma samples as early as possible
This commit is contained in:
Pierre Bourdon 2014-08-02 15:13:26 -07:00
commit 9f8e1e2a0d
1 changed files with 9 additions and 8 deletions

View File

@ -403,10 +403,9 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
g_audioDMA.current_source_address = g_audioDMA.SourceAddress; g_audioDMA.current_source_address = g_audioDMA.SourceAddress;
g_audioDMA.remaining_blocks_count = g_audioDMA.AudioDMAControl.NumBlocks; g_audioDMA.remaining_blocks_count = g_audioDMA.AudioDMAControl.NumBlocks;
if (g_audioDMA.AudioDMAControl.NumBlocks == 0) // We make the samples ready as soon as possible
{ void *address = Memory::GetPointer(g_audioDMA.SourceAddress);
g_audioDMA.AudioDMAControl.Enable = 0; AudioCommon::SendAIBuffer((short*)address, g_audioDMA.AudioDMAControl.NumBlocks * 8);
}
GenerateDSPInterrupt(DSP::INT_AID); GenerateDSPInterrupt(DSP::INT_AID);
} }
@ -491,9 +490,6 @@ void UpdateAudioDMA()
// Read audio at g_audioDMA.current_source_address in RAM and push onto an // 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 // external audio fifo in the emulator, to be mixed with the disc
// streaming output. // streaming output.
void *address = Memory::GetPointer(g_audioDMA.current_source_address);
AudioCommon::SendAIBuffer((short*)address, 8);
g_audioDMA.remaining_blocks_count--; g_audioDMA.remaining_blocks_count--;
g_audioDMA.current_source_address += 32; g_audioDMA.current_source_address += 32;
@ -506,7 +502,12 @@ void UpdateAudioDMA()
{ {
g_audioDMA.AudioDMAControl.Enable = 0; 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); GenerateDSPInterrupt(DSP::INT_AID);
} }
} }