spu: support master volume
[pcsx_rearmed.git] / plugins / dfsound / registers.c
index e069306..6b62247 100644 (file)
@@ -296,7 +296,7 @@ unsigned short CALLBACK SPUreadRegister(unsigned long reg)
       {\r
        const int ch=(r>>4)-0xc0;\r
        if(spu.dwNewChannel&(1<<ch)) return 1;          // we are started, but not processed? return 1\r
-       if((spu.dwChannelOn&(1<<ch)) &&                 // same here... we haven't decoded one sample yet, so no envelope yet. return 1 as well\r
+       if((spu.dwChannelsAudible&(1<<ch)) &&           // same here... we haven't decoded one sample yet, so no envelope yet. return 1 as well\r
           !spu.s_chan[ch].ADSRX.EnvelopeVol)\r
         return 1;\r
        return (unsigned short)(spu.s_chan[ch].ADSRX.EnvelopeVol>>16);\r
@@ -350,7 +350,7 @@ static void SoundOn(int start,int end,unsigned short val)
 \r
  for(ch=start;ch<end;ch++,val>>=1)                     // loop channels\r
   {\r
-   if((val&1) && regAreaGet(ch,6))                     // mmm... start has to be set before key on !?!\r
+   if((val&1) && regAreaGetCh(ch, 6))                  // mmm... start has to be set before key on !?!\r
     {\r
      spu.s_chan[ch].bIgnoreLoop = 0;\r
      spu.dwNewChannel|=(1<<ch);\r
@@ -484,11 +484,14 @@ 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
+ if (val)\r
+  spu.dwChannelsAudible |= 1u << ch;\r
+ else\r
+  spu.dwChannelsAudible &= ~(1u << ch);\r
 }\r
 \r
 ////////////////////////////////////////////////////////////////////////\r