Move audio handling out of DSP emulation.

This is good for a couple of reasons: one, it gets rid of duplicated code,
and two, DSP emulation shouldn't need to interact with audio in the first
place.
This commit is contained in:
magumagu
2014-03-27 17:56:05 -07:00
parent 78499e5b7c
commit 3afa17f752
11 changed files with 38 additions and 153 deletions

View File

@ -23,6 +23,8 @@
// the just used buffer through the AXList (or whatever it might be called in
// Nintendo games).
#include "AudioCommon/AudioCommon.h"
#include "Common/MemoryUtil.h"
#include "Core/ConfigManager.h"
@ -482,7 +484,9 @@ void UpdateAudioDMA()
if (g_audioDMA.BlocksLeft == 0)
{
dsp_emulator->DSP_SendAIBuffer(g_audioDMA.SourceAddress, 8*g_audioDMA.AudioDMAControl.NumBlocks);
void *address = Memory::GetPointer(g_audioDMA.SourceAddress);
unsigned samples = 8 * g_audioDMA.AudioDMAControl.NumBlocks;
AudioCommon::SendAIBuffer((short*)address, samples);
GenerateDSPInterrupt(DSP::INT_AID);
g_audioDMA.BlocksLeft = g_audioDMA.AudioDMAControl.NumBlocks;
g_audioDMA.ReadAddress = g_audioDMA.SourceAddress;
@ -492,7 +496,7 @@ void UpdateAudioDMA()
{
// Send silence. Yeah, it's a bit of a waste to sample rate convert
// silence. or hm. Maybe we shouldn't do this :)
dsp_emulator->DSP_SendAIBuffer(0, AudioInterface::GetAIDSampleRate());
AudioCommon::SendAIBuffer(0, AudioInterface::GetAIDSampleRate());
}
}