attack decay envelope with modulation inputs Ricardo Wurmus GPL env.axh 0) && !((stage & 0xF0)>>4)) { // set "triggered" and "attack" stage = 0xFF; } else if (!(inlet_trig>0)) { // set "not triggered" stage &= 0x0F; } // decay if ((stage & 0x0F) == 0) { val = ___SMMLA(val,(-1<<26)+(param_d>>1)+(inlet_d>>1),val); // attack } else { int32_t a; MTOF(- param_a - inlet_a,a); // shift to let val rise more slowly a = a >> 4; val = val + a; // switch to decay phase at max if (val > 0x07FFFFFF) { val = 0x07FFFFFF; stage &= 0xF0; } } outlet_env = val; ]]>