Skip to content

Commit

Permalink
Reverted the audio streaming tweak from r7a04ec6f9220dd66147c86baaebc…
Browse files Browse the repository at this point in the history
…2f9e05d65ead as it was causing audio clipping in some Wii games like Fire Emblem: Radiant Dawn.
  • Loading branch information
skidau committed Mar 3, 2013
1 parent 6d1a0f5 commit 6dbd80d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Source/Core/Core/Src/HW/DSP.cpp
Expand Up @@ -47,7 +47,6 @@
#include "../PowerPC/PowerPC.h"
#include "../ConfigManager.h"
#include "../DSPEmulator.h"
#include "SystemTimers.h"

namespace DSP
{
Expand Down Expand Up @@ -153,7 +152,7 @@ struct AudioDMA
SourceAddress = 0;
ReadAddress = 0;
AudioDMAControl.Hex = 0;
BlocksLeft = 1;
BlocksLeft = 0;
}
};

Expand Down Expand Up @@ -356,7 +355,7 @@ void Read16(u16& _uReturnValue, const u32 _iAddress)

// AI
case AUDIO_DMA_BLOCKS_LEFT:
_uReturnValue = g_audioDMA.BlocksLeft;
_uReturnValue = g_audioDMA.BlocksLeft > 0 ? g_audioDMA.BlocksLeft - 1 : 0; // AUDIO_DMA_BLOCKS_LEFT is zero based
break;

case AUDIO_DMA_START_LO:
Expand Down Expand Up @@ -666,7 +665,7 @@ void UpdateDSPSlice(int cycles) {
// This happens at 4 khz, since 32 bytes at 4khz = 4 bytes at 32 khz (16bit stereo pcm)
void UpdateAudioDMA()
{
if (g_audioDMA.AudioDMAControl.Enable && g_audioDMA.BlocksLeft > -1)
if (g_audioDMA.AudioDMAControl.Enable && g_audioDMA.BlocksLeft)
{
// Read audio at g_audioDMA.ReadAddress in RAM and push onto an
// external audio fifo in the emulator, to be mixed with the disc
Expand All @@ -676,7 +675,7 @@ void UpdateAudioDMA()
g_audioDMA.BlocksLeft--;
g_audioDMA.ReadAddress += 32;

if (g_audioDMA.BlocksLeft == -1)
if (g_audioDMA.BlocksLeft == 0)
{
dsp_emulator->DSP_SendAIBuffer(g_audioDMA.SourceAddress, 8*g_audioDMA.AudioDMAControl.NumBlocks);
GenerateDSPInterrupt(DSP::INT_AID);
Expand Down

0 comments on commit 6dbd80d

Please sign in to comment.