bool32.rising trigger
frac32 a
frac32 d
frac32 skew
frac32 shift
frac32.positive envelope output
frac32.s.map.klineartime.exp a
frac32.s.map.klineartime.exp d
frac32.s.map skew
frac32.u.map shift
frac32.u.map expo
int8_t stage;
int ntrig;
int32_t val;
ntrig = 0;
val = 0;
if ((inlet_trig > 0) && !ntrig) {
ntrig = 1;
stage = 1;
} else if (!(inlet_trig > 0)) {
ntrig = 0;
}
if (stage == 0) {
int32_t t, d, D1, D2, D3, shift, skew;
shift = __USAT(param_shift + inlet_shift, 27);
skew = __SSAT(param_skew + inlet_skew, 28);
d = __SSAT(param_decay + inlet_decay, 28);
D1 = d + skew - (___SMMUL(shift << 1, skew) << 5);
D2 = d + (___SMMUL(__USAT(shift << 1, 27), skew) << 5);
D3 = d - skew;
D1 = D2 + ___SMMUL(D1 - D2 << 1, val);
D2 = D3 + ___SMMUL(D2 - D3 << 1, val);
D1 = D2 + ___SMMUL(D1 - D2 << 1, val);
MTOF(-(D1), t);
d = t;
t = t >> 2;
t += ___SMMUL((___SMMUL(val, d)) - t, param_expo) << 5;
val = __USAT(val - t, 31);
} else {
int32_t t, a;
MTOF(-param_a, t);
a = t;
t = t >> 2;
a = ___SMMUL((___SMMUL(((1 << 31) - 1) - val, a)) - t, param_expo) << 5;
t += a - (a >> 8);
val = val + t;
if (val < 0) {
val = 0x7FFFFFFF;
stage = 0;
}
}
outlet_env = val >> 4;