mcd, fix pcm output level

This commit is contained in:
kub 2021-06-03 21:51:47 +02:00
parent 97916e3361
commit cce32a34da

View file

@ -89,10 +89,10 @@ void pcd_pcm_sync(unsigned int to)
addr = ch->addr;
inc = ch->regs[2] + (ch->regs[3]<<8);
mul_l = ((int)ch->regs[0] * (ch->regs[1] & 0xf)) >> (5+1);
mul_r = ((int)ch->regs[0] * (ch->regs[1] >> 4)) >> (5+1);
mul_l = (int)ch->regs[0] * (ch->regs[1] & 0xf);
mul_r = (int)ch->regs[0] * (ch->regs[1] >> 4);
for (s = 0; s < steps; s++, addr = (addr + inc) & 0x7FFFFFF)
for (s = 0; s < steps; s++, addr = (addr + inc) & 0x07FFFFFF)
{
smp = Pico_mcd->pcm_ram[addr >> PCM_STEP_SHIFT];
@ -109,8 +109,8 @@ void pcd_pcm_sync(unsigned int to)
if (smp & 0x80)
smp = -(smp & 0x7f);
out[s*2 ] += smp * mul_l; // max 128 * 119 = 15232
out[s*2+1] += smp * mul_r;
out[s*2 ] += (smp * mul_l) >> 5; // max 127 * 255 * 15 / 32 = 15180
out[s*2+1] += (smp * mul_r) >> 5;
}
ch->addr = addr;
}