Fixed the step_size_bytes in the ADPCM Accelerator loop taking into account the varying number of bytes that ADPCM steps by.

This commit is contained in:
skidau 2014-09-30 22:11:34 +10:00
parent 9551650c42
commit 711a8aa6ad
2 changed files with 9 additions and 3 deletions

View File

@ -122,8 +122,11 @@ u16 dsp_read_accelerator()
switch (g_dsp.ifx_regs[DSP_FORMAT])
{
case 0x00: // ADPCM audio
if ((Address & 15) == 0)
step_size_bytes = 2;
else
step_size_bytes = 1;
val = ADPCM_Step(Address);
step_size_bytes = 2;
break;
case 0x0A: // 16-bit PCM audio
val = (DSPHost::ReadHostMemory(Address * 2) << 8) | DSPHost::ReadHostMemory(Address * 2 + 1);

View File

@ -163,9 +163,13 @@ u16 AcceleratorGetSample()
if ((*acc_cur_addr & 15) == 0)
{
acc_pb->adpcm.pred_scale = DSP::ReadARAM((*acc_cur_addr & ~15) >> 1);
step_size_bytes = 2;
*acc_cur_addr += 2;
}
else
{
step_size_bytes = 1;
}
int scale = 1 << (acc_pb->adpcm.pred_scale & 0xF);
int coef_idx = (acc_pb->adpcm.pred_scale >> 4) & 0x7;
@ -184,7 +188,6 @@ u16 AcceleratorGetSample()
acc_pb->adpcm.yn2 = acc_pb->adpcm.yn1;
acc_pb->adpcm.yn1 = val;
step_size_bytes = 2;
*acc_cur_addr += 1;
ret = val;
break;