spu: remove some strange rounding
authornotaz <notasas@gmail.com>
Sun, 4 Sep 2022 21:02:28 +0000 (00:02 +0300)
committernotaz <notasas@gmail.com>
Sun, 4 Sep 2022 23:28:58 +0000 (02:28 +0300)
Seems wrong.
Also deal with now possible div by 0 in scan_for_irq().

plugins/dfsound/registers.c
plugins/dfsound/spu.c

index e069306..61d0b81 100644 (file)
@@ -484,11 +484,10 @@ static void SetPitch(int ch,unsigned short val)               // SET PITCH
  if(val>0x3fff) NP=0x3fff;                             // get pitch val\r
  else           NP=val;\r
 \r
- spu.s_chan[ch].iRawPitch=NP;\r
- spu.s_chan[ch].sinc=(NP<<4)|8;\r
- spu.s_chan[ch].sinc_inv=0;\r
- if (spu_config.iUseInterpolation == 1)\r
-  spu.SB[ch * SB_SIZE + 32] = 1; // -> freq change in simple interpolation mode: set flag\r
+ spu.s_chan[ch].iRawPitch = NP;\r
+ spu.s_chan[ch].sinc = NP << 4;\r
+ spu.s_chan[ch].sinc_inv = 0;\r
+ spu.SB[ch * SB_SIZE + 32] = 1; // -> freq change in simple interpolation mode: set flag\r
 }\r
 \r
 ////////////////////////////////////////////////////////////////////////\r
index b0b083d..35d890d 100644 (file)
@@ -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);
  }