spu: fix saving bug
authornotaz <notasas@gmail.com>
Thu, 22 Nov 2012 00:48:19 +0000 (02:48 +0200)
committernotaz <notasas@gmail.com>
Sat, 24 Nov 2012 02:25:25 +0000 (04:25 +0200)
fixup on load too

plugins/dfsound/freeze.c

index 8787db0..0601bf5 100644 (file)
@@ -188,7 +188,6 @@ static void load_channel(SPUCHAN *d, const SPUCHAN_orig *s, int ch)
  memcpy(d->SB, s->SB, sizeof(d->SB));\r
  d->pCurr = (void *)((long)s->iCurr & 0x7fff0);\r
  d->pLoop = (void *)((long)s->iLoop & 0x7fff0);\r
- if (s->bOn) dwChannelOn |= 1<<ch;\r
  d->bStop = s->bStop;\r
  d->bReverb = s->bReverb;\r
  d->iLeftVolume = s->iLeftVolume;\r
@@ -209,6 +208,8 @@ static void load_channel(SPUCHAN *d, const SPUCHAN_orig *s, int ch)
  d->ADSRX.ReleaseModeExp = s->ADSRX.ReleaseModeExp;\r
  d->ADSRX.ReleaseRate = s->ADSRX.ReleaseRate;\r
  d->ADSRX.EnvelopeVol = s->ADSRX.EnvelopeVol;\r
+ if (s->bOn) dwChannelOn |= 1<<ch;\r
+ else d->ADSRX.EnvelopeVol = 0;\r
 }\r
 \r
 ////////////////////////////////////////////////////////////////////////\r
@@ -252,9 +253,6 @@ long CALLBACK SPUfreeze(uint32_t ulFreezeMode,SPUFreeze_t * pF)
 \r
    for(i=0;i<MAXCHAN;i++)\r
     {\r
-     if(!(s_chan[i].prevflags&2))\r
-      dwChannelOn&=~(1<<i);\r
-\r
      save_channel(&pFO->s_chan[i],&s_chan[i],i);\r
      if(s_chan[i].pCurr)\r
       pFO->s_chan[i].iCurr=s_chan[i].pCurr-spuMemC;\r