diff options
author | notaz | 2012-11-16 00:30:32 +0200 |
---|---|---|
committer | notaz | 2012-11-18 01:40:00 +0200 |
commit | 07bd309f731eefa49208d77a35507a7b7448ffb6 (patch) | |
tree | 11ca3763a55a084581c371e6d1f1ee9377da8fd5 | |
parent | a02ee86fc0e356c99516bb0d1e76c88a907a796f (diff) | |
download | pcsx_rearmed-07bd309f731eefa49208d77a35507a7b7448ffb6.tar.gz pcsx_rearmed-07bd309f731eefa49208d77a35507a7b7448ffb6.tar.bz2 pcsx_rearmed-07bd309f731eefa49208d77a35507a7b7448ffb6.zip |
spu: stop at 0 volume
-rw-r--r-- | plugins/dfsound/adsr.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/plugins/dfsound/adsr.c b/plugins/dfsound/adsr.c index e4873df..79f593c 100644 --- a/plugins/dfsound/adsr.c +++ b/plugins/dfsound/adsr.c @@ -46,6 +46,10 @@ void InitADSR(void) // INIT ADSR RateTableAdd[lcv] = ((7 - (lcv&3)) << 16) / denom;
RateTableSub[lcv] = ((-8 + (lcv&3)) << 16) / denom;
+
+ // XXX: this is wrong, we need more bits..
+ if (RateTableAdd[lcv] == 0)
+ RateTableAdd[lcv] = 1;
}
}
@@ -67,12 +71,13 @@ static void MixADSR(int ch, int ns, int ns_to) // MIX ADSR if (s_chan[ch].bStop) // should be stopped:
{ // do release
val = RateTableSub[s_chan[ch].ADSRX.ReleaseRate * 4];
+
if (s_chan[ch].ADSRX.ReleaseModeExp)
{
for (; ns < ns_to; ns++)
{
EnvelopeVol += ((long long)val * EnvelopeVol) >> (15+16);
- if (EnvelopeVol < 0)
+ if (EnvelopeVol <= 0)
break;
ChanBuf[ns] *= EnvelopeVol >> 21;
@@ -84,7 +89,7 @@ static void MixADSR(int ch, int ns, int ns_to) // MIX ADSR for (; ns < ns_to; ns++)
{
EnvelopeVol += val;
- if (EnvelopeVol < 0)
+ if (EnvelopeVol <= 0)
break;
ChanBuf[ns] *= EnvelopeVol >> 21;
@@ -92,7 +97,7 @@ static void MixADSR(int ch, int ns, int ns_to) // MIX ADSR }
}
- if (EnvelopeVol < 0)
+ if (EnvelopeVol <= 0)
goto stop;
goto done;
|