From 6e975586e08dd8ab2d2aa3bfc04a71013d09db5d Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Sun, 1 Apr 2018 14:19:05 +0200 Subject: env/ad m: Use less space. --- objects/env/ad m.axo | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'objects/env/ad m.axo') diff --git a/objects/env/ad m.axo b/objects/env/ad m.axo index 9ae76f1..fd12bf9 100644 --- a/objects/env/ad m.axo +++ b/objects/env/ad m.axo @@ -19,24 +19,27 @@ 0) && !ntrig) { - ntrig = 1; - stage = 1; + +// If trigger and not yet triggered +if ((inlet_trig>0) && !((stage & 0xF0)>>4)) { + // set "triggered" and "attack" + stage = 0xFF; } else if (!(inlet_trig>0)) { - ntrig = 0; + // set "not triggered" + stage &= 0x0F; } // decay -if (stage == 0) { +if ((stage & 0x0F) == 0) { val = ___SMMLA(val,(-1<<26)+(param_d>>1)+(inlet_d>>1),val); // attack @@ -51,7 +54,7 @@ if (stage == 0) { // switch to decay phase at max if (val > 0x07FFFFFF) { val = 0x07FFFFFF; - stage = 0; + stage &= 0xF0; } } outlet_env = val; -- cgit v1.2.3