X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=plugins%2Fdfsound%2Fspu.c;h=fbd555b179877bccbe49b8dce4995a43693ffd61;hp=de7d2f250c9b22c17de695addc0b8287fab678de;hb=5fdcf5cd320abef2c685630e3edf3598645d141e;hpb=5aa94fa080e1b0a661b23aa912022dd464d41110 diff --git a/plugins/dfsound/spu.c b/plugins/dfsound/spu.c index de7d2f25..fbd555b1 100644 --- a/plugins/dfsound/spu.c +++ b/plugins/dfsound/spu.c @@ -247,7 +247,7 @@ static void StartSoundMain(int ch) s_chan->iSBPos=27; s_chan->spos=0; - s_chan->pCurr = spu.spuMemC+((regAreaGet(ch,6)&~1)<<3); + s_chan->pCurr = spu.spuMemC + ((regAreaGetCh(ch, 6) & ~1) << 3); spu.dwNewChannel&=~(1<> 17; + int vol_r = ((int)regAreaGet(H_SPUmvolR) << 17) >> 17; int ns; int d; @@ -1192,23 +1193,28 @@ static void do_samples_finish(int *SSumLR, int ns_to, } MixXA(SSumLR, ns_to, decode_pos); - - if((spu.spuCtrl&0x4000)==0) // muted? (rare, don't optimize for this) + + vol_l = vol_l * spu_config.iVolume >> 10; + vol_r = vol_r * spu_config.iVolume >> 10; + + if (!(spu.spuCtrl & 0x4000) || !(vol_l | vol_r)) { + // muted? (rare) memset(spu.pS, 0, ns_to * 2 * sizeof(spu.pS[0])); + memset(SSumLR, 0, ns_to * 2 * sizeof(SSumLR[0])); spu.pS += ns_to * 2; } else for (ns = 0; ns < ns_to * 2; ) { d = SSumLR[ns]; SSumLR[ns] = 0; - d = d * volmult >> 10; + d = d * vol_l >> 15; ssat32_to_16(d); *spu.pS++ = d; ns++; d = SSumLR[ns]; SSumLR[ns] = 0; - d = d * volmult >> 10; + d = d * vol_r >> 15; ssat32_to_16(d); *spu.pS++ = d; ns++;