mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-05 09:39:58 +00:00
Merge pull request #1192 from skidau/dsp-acc-loop-adpcm
Fixed the step_size_bytes in the ADPCM Accelerator loop
This commit is contained in:
commit
b4e82a5b9b
@ -15,7 +15,7 @@ static s16 ADPCM_Step(u32& _rSamplePos)
|
|||||||
{
|
{
|
||||||
const s16 *pCoefTable = (const s16 *)&g_dsp.ifx_regs[DSP_COEF_A1_0];
|
const s16 *pCoefTable = (const s16 *)&g_dsp.ifx_regs[DSP_COEF_A1_0];
|
||||||
|
|
||||||
if (((_rSamplePos)& 15) == 0)
|
if ((_rSamplePos & 15) == 0)
|
||||||
{
|
{
|
||||||
g_dsp.ifx_regs[DSP_PRED_SCALE] = DSPHost::ReadHostMemory((_rSamplePos & ~15) >> 1);
|
g_dsp.ifx_regs[DSP_PRED_SCALE] = DSPHost::ReadHostMemory((_rSamplePos & ~15) >> 1);
|
||||||
_rSamplePos += 2;
|
_rSamplePos += 2;
|
||||||
@ -122,8 +122,11 @@ u16 dsp_read_accelerator()
|
|||||||
switch (g_dsp.ifx_regs[DSP_FORMAT])
|
switch (g_dsp.ifx_regs[DSP_FORMAT])
|
||||||
{
|
{
|
||||||
case 0x00: // ADPCM audio
|
case 0x00: // ADPCM audio
|
||||||
|
if ((EndAddress & 15) == 0)
|
||||||
|
step_size_bytes = 1;
|
||||||
|
else
|
||||||
|
step_size_bytes = 2;
|
||||||
val = ADPCM_Step(Address);
|
val = ADPCM_Step(Address);
|
||||||
step_size_bytes = 2;
|
|
||||||
break;
|
break;
|
||||||
case 0x0A: // 16-bit PCM audio
|
case 0x0A: // 16-bit PCM audio
|
||||||
val = (DSPHost::ReadHostMemory(Address * 2) << 8) | DSPHost::ReadHostMemory(Address * 2 + 1);
|
val = (DSPHost::ReadHostMemory(Address * 2) << 8) | DSPHost::ReadHostMemory(Address * 2 + 1);
|
||||||
@ -136,12 +139,12 @@ u16 dsp_read_accelerator()
|
|||||||
val = DSPHost::ReadHostMemory(Address) << 8;
|
val = DSPHost::ReadHostMemory(Address) << 8;
|
||||||
g_dsp.ifx_regs[DSP_YN2] = g_dsp.ifx_regs[DSP_YN1];
|
g_dsp.ifx_regs[DSP_YN2] = g_dsp.ifx_regs[DSP_YN1];
|
||||||
g_dsp.ifx_regs[DSP_YN1] = val;
|
g_dsp.ifx_regs[DSP_YN1] = val;
|
||||||
step_size_bytes = 1;
|
step_size_bytes = 2;
|
||||||
Address++;
|
Address++;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ERROR_LOG(DSPLLE, "dsp_read_accelerator() - unknown format 0x%x", g_dsp.ifx_regs[DSP_FORMAT]);
|
ERROR_LOG(DSPLLE, "dsp_read_accelerator() - unknown format 0x%x", g_dsp.ifx_regs[DSP_FORMAT]);
|
||||||
step_size_bytes = 1;
|
step_size_bytes = 2;
|
||||||
Address++;
|
Address++;
|
||||||
val = 0;
|
val = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -166,6 +166,11 @@ u16 AcceleratorGetSample()
|
|||||||
*acc_cur_addr += 2;
|
*acc_cur_addr += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((acc_end_addr & 15) == 0)
|
||||||
|
step_size_bytes = 1;
|
||||||
|
else
|
||||||
|
step_size_bytes = 2;
|
||||||
|
|
||||||
int scale = 1 << (acc_pb->adpcm.pred_scale & 0xF);
|
int scale = 1 << (acc_pb->adpcm.pred_scale & 0xF);
|
||||||
int coef_idx = (acc_pb->adpcm.pred_scale >> 4) & 0x7;
|
int coef_idx = (acc_pb->adpcm.pred_scale >> 4) & 0x7;
|
||||||
|
|
||||||
@ -184,7 +189,6 @@ u16 AcceleratorGetSample()
|
|||||||
|
|
||||||
acc_pb->adpcm.yn2 = acc_pb->adpcm.yn1;
|
acc_pb->adpcm.yn2 = acc_pb->adpcm.yn1;
|
||||||
acc_pb->adpcm.yn1 = val;
|
acc_pb->adpcm.yn1 = val;
|
||||||
step_size_bytes = 2;
|
|
||||||
*acc_cur_addr += 1;
|
*acc_cur_addr += 1;
|
||||||
ret = val;
|
ret = val;
|
||||||
break;
|
break;
|
||||||
@ -202,7 +206,7 @@ u16 AcceleratorGetSample()
|
|||||||
ret = DSP::ReadARAM(*acc_cur_addr) << 8;
|
ret = DSP::ReadARAM(*acc_cur_addr) << 8;
|
||||||
acc_pb->adpcm.yn2 = acc_pb->adpcm.yn1;
|
acc_pb->adpcm.yn2 = acc_pb->adpcm.yn1;
|
||||||
acc_pb->adpcm.yn1 = ret;
|
acc_pb->adpcm.yn1 = ret;
|
||||||
step_size_bytes = 1;
|
step_size_bytes = 2;
|
||||||
*acc_cur_addr += 1;
|
*acc_cur_addr += 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user