spu: fix a wrong assumption
authornotaz <notasas@gmail.com>
Thu, 3 Nov 2022 20:49:08 +0000 (22:49 +0200)
committernotaz <notasas@gmail.com>
Thu, 3 Nov 2022 20:49:08 +0000 (22:49 +0200)
from 5aa94fa080e1b0a661b23aa912022dd464d41110
libretro/pcsx_rearmed#704

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

index e75f708..e00939e 100644 (file)
@@ -505,10 +505,8 @@ static void SetPitch(int ch,unsigned short val)               // SET PITCH
  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
  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
- if (val)\r
-  spu.dwChannelsAudible |= 1u << ch;\r
- else\r
-  spu.dwChannelsAudible &= ~(1u << ch);\r
+\r
+ // don't mess spu.dwChannelsAudible as adsr runs independently\r
 }\r
 \r
 ////////////////////////////////////////////////////////////////////////\r
 }\r
 \r
 ////////////////////////////////////////////////////////////////////////\r
index 3b4c051..1127cd7 100644 (file)
@@ -251,8 +251,7 @@ static void StartSoundMain(int ch)
 
  spu.dwNewChannel&=~(1<<ch);                           // clear new channel bit
  spu.dwChannelDead&=~(1<<ch);
 
  spu.dwNewChannel&=~(1<<ch);                           // clear new channel bit
  spu.dwChannelDead&=~(1<<ch);
- if (s_chan->iRawPitch)
-  spu.dwChannelsAudible|=1<<ch;
+ spu.dwChannelsAudible|=1<<ch;
 }
 
 static void StartSound(int ch)
 }
 
 static void StartSound(int ch)
@@ -950,6 +949,7 @@ static void queue_channel_work(int ns_to, unsigned int silentch)
    d = SkipADSR(&s_chan->ADSRX, d);
    if (d < ns_to) {
     spu.dwChannelsAudible &= ~(1 << ch);
    d = SkipADSR(&s_chan->ADSRX, d);
    if (d < ns_to) {
     spu.dwChannelsAudible &= ~(1 << ch);
+    s_chan->ADSRX.State = ADSR_RELEASE;
     s_chan->ADSRX.EnvelopeVol = 0;
    }
   }
     s_chan->ADSRX.EnvelopeVol = 0;
    }
   }