\r
RateTableAdd[lcv] = ((7 - (lcv&3)) << 16) / denom;\r
RateTableSub[lcv] = ((-8 + (lcv&3)) << 16) / denom;\r
+\r
+ // XXX: this is wrong, we need more bits..\r
+ if (RateTableAdd[lcv] == 0)\r
+ RateTableAdd[lcv] = 1;\r
}\r
}\r
\r
if (s_chan[ch].bStop) // should be stopped:\r
{ // do release\r
val = RateTableSub[s_chan[ch].ADSRX.ReleaseRate * 4];\r
+\r
if (s_chan[ch].ADSRX.ReleaseModeExp)\r
{\r
for (; ns < ns_to; ns++)\r
{\r
EnvelopeVol += ((long long)val * EnvelopeVol) >> (15+16);\r
- if (EnvelopeVol < 0)\r
+ if (EnvelopeVol <= 0)\r
break;\r
\r
ChanBuf[ns] *= EnvelopeVol >> 21;\r
for (; ns < ns_to; ns++)\r
{\r
EnvelopeVol += val;\r
- if (EnvelopeVol < 0)\r
+ if (EnvelopeVol <= 0)\r
break;\r
\r
ChanBuf[ns] *= EnvelopeVol >> 21;\r
}\r
}\r
\r
- if (EnvelopeVol < 0)\r
+ if (EnvelopeVol <= 0)\r
goto stop;\r
\r
goto done;\r