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];
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;
}