From: kub Date: Thu, 3 Jun 2021 19:51:47 +0000 (+0200) Subject: mcd, fix pcm output level X-Git-Tag: v2.00~517 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cce32a34da6b18ead5e0808471f666196ea53513;p=picodrive.git mcd, fix pcm output level --- diff --git a/pico/cd/pcm.c b/pico/cd/pcm.c index b77196a4..795ec3b7 100644 --- a/pico/cd/pcm.c +++ b/pico/cd/pcm.c @@ -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; }