Merge pull request #282 from cam900/patch-5

Clamp X1-010 Envelope wave
This commit is contained in:
tildearrow 2022-03-11 21:53:29 -05:00 committed by GitHub
commit b73591970d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -323,9 +323,15 @@ void DivPlatformX1_010::updateEnvelope(int ch) {
} }
if (chan[ch].env.flag.envVinvR) { ro=15-ro; } // vertical invert right envelope if (chan[ch].env.flag.envVinvR) { ro=15-ro; } // vertical invert right envelope
if (chan[ch].env.flag.envVinvL) { lo=15-lo; } // vertical invert left envelope if (chan[ch].env.flag.envVinvL) { lo=15-lo; } // vertical invert left envelope
if (lo<0) lo=0;
if (lo>15) lo=15;
if (ro<0) ro=0;
if (ro>15) ro=15;
envWrite(ch,i,lo,ro); envWrite(ch,i,lo,ro);
} else { } else {
int out=wt->data[i*wt->len/128]*15/wt->max; int out=wt->data[i*wt->len/128]*15/wt->max;
if (out<0) out=0;
if (out>15) out=15;
envWrite(ch,i,out,out); envWrite(ch,i,out,out);
} }
} }