An attempt to resolve the issue roused by r4660, it needs tests though.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4672 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
f572fcdf6d
commit
9f06dd9a0a
|
@ -125,7 +125,7 @@ union UAudioDMAControl
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
unsigned NumBlocks : 15;
|
unsigned NumBlocks : 15;
|
||||||
unsigned Enabled : 1;
|
unsigned Reload : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
UAudioDMAControl(u16 _Hex = 0) : Hex(_Hex)
|
UAudioDMAControl(u16 _Hex = 0) : Hex(_Hex)
|
||||||
|
@ -417,16 +417,10 @@ void Write16(const u16 _Value, const u32 _Address)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AUDIO_DMA_CONTROL_LEN: // called by AIStartDMA()
|
case AUDIO_DMA_CONTROL_LEN: // called by AIStartDMA()
|
||||||
{
|
|
||||||
UAudioDMAControl old_control = g_audioDMA.AudioDMAControl;
|
|
||||||
g_audioDMA.AudioDMAControl.Hex = _Value;
|
g_audioDMA.AudioDMAControl.Hex = _Value;
|
||||||
if (!old_control.Enabled && g_audioDMA.AudioDMAControl.Enabled) //needed for some AX games under LLE (Crazy Taxi)
|
g_audioDMA.BlocksLeft = g_audioDMA.AudioDMAControl.NumBlocks;
|
||||||
{
|
g_audioDMA.ReadAddress = g_audioDMA.SourceAddress;
|
||||||
g_audioDMA.BlocksLeft = g_audioDMA.AudioDMAControl.NumBlocks;
|
INFO_LOG(DSPINTERFACE, "AID DMA started - source address %08x, length %i blocks", g_audioDMA.SourceAddress, g_audioDMA.AudioDMAControl.NumBlocks);
|
||||||
g_audioDMA.ReadAddress = g_audioDMA.SourceAddress;
|
|
||||||
INFO_LOG(DSPINTERFACE, "AID DMA started - source address %08x, length %i blocks", g_audioDMA.SourceAddress, g_audioDMA.AudioDMAControl.NumBlocks);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AUDIO_DMA_BYTES_LEFT:
|
case AUDIO_DMA_BYTES_LEFT:
|
||||||
|
@ -442,25 +436,28 @@ void Write16(const u16 _Value, const u32 _Address)
|
||||||
// This happens at 4 khz, since 32 bytes at 4khz = 4 bytes at 32 khz (16bit stereo pcm)
|
// This happens at 4 khz, since 32 bytes at 4khz = 4 bytes at 32 khz (16bit stereo pcm)
|
||||||
void UpdateAudioDMA()
|
void UpdateAudioDMA()
|
||||||
{
|
{
|
||||||
if (g_audioDMA.AudioDMAControl.Enabled && g_audioDMA.BlocksLeft) {
|
if (g_audioDMA.BlocksLeft)
|
||||||
|
{
|
||||||
// Read audio at g_audioDMA.ReadAddress in RAM and push onto an
|
// Read audio at g_audioDMA.ReadAddress 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. If that audio queue fills up, we delay the
|
// streaming output. If that audio queue fills up, we delay the
|
||||||
// emulator.
|
// emulator.
|
||||||
// TO RESTORE OLD BEHAVIOUR, COMMENT OUT THIS LINE
|
|
||||||
dsp_plugin->DSP_SendAIBuffer(g_audioDMA.ReadAddress, AudioInterface::GetDSPSampleRate());
|
dsp_plugin->DSP_SendAIBuffer(g_audioDMA.ReadAddress, AudioInterface::GetDSPSampleRate());
|
||||||
|
|
||||||
g_audioDMA.ReadAddress += 32;
|
g_audioDMA.ReadAddress += 32;
|
||||||
g_audioDMA.BlocksLeft--;
|
g_audioDMA.BlocksLeft--;
|
||||||
if (!g_audioDMA.BlocksLeft) {
|
if (g_audioDMA.BlocksLeft == 0)
|
||||||
// Latch new parameters
|
{
|
||||||
// This is mainly used by NGC games which do auto loops
|
if (g_audioDMA.AudioDMAControl.Reload)
|
||||||
g_audioDMA.BlocksLeft = g_audioDMA.AudioDMAControl.NumBlocks;
|
{
|
||||||
g_audioDMA.ReadAddress = g_audioDMA.SourceAddress;
|
g_audioDMA.BlocksLeft = g_audioDMA.AudioDMAControl.NumBlocks;
|
||||||
|
g_audioDMA.ReadAddress = g_audioDMA.SourceAddress;
|
||||||
|
}
|
||||||
// DEBUG_LOG(DSPLLE, "ADMA read addresses: %08x", g_audioDMA.ReadAddress);
|
// DEBUG_LOG(DSPLLE, "ADMA read addresses: %08x", g_audioDMA.ReadAddress);
|
||||||
GenerateDSPInterrupt(DSP::INT_AID);
|
GenerateDSPInterrupt(DSP::INT_AID);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Send silence. Yeah, it's a bit of a waste to sample rate convert
|
// Send silence. Yeah, it's a bit of a waste to sample rate convert
|
||||||
// silence. or hm. Maybe we shouldn't do this :)
|
// silence. or hm. Maybe we shouldn't do this :)
|
||||||
// dsp->DSP_SendAIBuffer(0, AudioInterface::GetDSPSampleRate());
|
// dsp->DSP_SendAIBuffer(0, AudioInterface::GetDSPSampleRate());
|
||||||
|
|
Loading…
Reference in New Issue