From f3fa20c2fc7cff9352b5bcbe23e8b682bdcf0b2c Mon Sep 17 00:00:00 2001 From: notaz Date: Mon, 5 Sep 2022 00:02:28 +0300 Subject: [PATCH] spu: remove some strange rounding Seems wrong. Also deal with now possible div by 0 in scan_for_irq(). --- plugins/dfsound/registers.c | 9 ++++----- plugins/dfsound/spu.c | 2 ++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/dfsound/registers.c b/plugins/dfsound/registers.c index e0693064..61d0b810 100644 --- a/plugins/dfsound/registers.c +++ b/plugins/dfsound/registers.c @@ -484,11 +484,10 @@ static void SetPitch(int ch,unsigned short val) // SET PITCH if(val>0x3fff) NP=0x3fff; // get pitch val else NP=val; - spu.s_chan[ch].iRawPitch=NP; - spu.s_chan[ch].sinc=(NP<<4)|8; - spu.s_chan[ch].sinc_inv=0; - if (spu_config.iUseInterpolation == 1) - spu.SB[ch * SB_SIZE + 32] = 1; // -> freq change in simple interpolation mode: set flag + spu.s_chan[ch].iRawPitch = NP; + spu.s_chan[ch].sinc = NP << 4; + spu.s_chan[ch].sinc_inv = 0; + spu.SB[ch * SB_SIZE + 32] = 1; // -> freq change in simple interpolation mode: set flag } //////////////////////////////////////////////////////////////////////// diff --git a/plugins/dfsound/spu.c b/plugins/dfsound/spu.c index b0b083dd..35d890d9 100644 --- a/plugins/dfsound/spu.c +++ b/plugins/dfsound/spu.c @@ -1230,6 +1230,8 @@ void schedule_next_irq(void) if ((unsigned long)(spu.pSpuIrq - spu.s_chan[ch].pCurr) > IRQ_NEAR_BLOCKS * 16 && (unsigned long)(spu.pSpuIrq - spu.s_chan[ch].pLoop) > IRQ_NEAR_BLOCKS * 16) continue; + if (spu.s_chan[ch].sinc == 0) + continue; scan_for_irq(ch, &upd_samples); } -- 2.39.2