bool32.rising trigger
frac32.bipolar decay time
frac32buffer i
frac32buffer o
bool32.tgl on
frac32.s.map d
int32_t prev;
int32_t step;
int32_t val;
int ntrig;
int32_t Loopval;
val = 0;
ntrig = 0;
// vca
step = (Loopval - prev) >> 4;
int32_t i = prev;
prev = Loopval;
// env
if ((inlet_t > 0) && !ntrig) {
val = 1 << 27;
ntrig = 1;
} else {
if (!(inlet_t > 0))
ntrig = 0;
int32_t t;
int32_t dt = param_d + inlet_d;
MTOF(-dt, t);
val -= t >> 6;
if (val < 0)
val = 0;
}
Loopval = val;
// Env off
outlet_o = inlet_i;
// Env on
if (param_on) {
outlet_o = ___SMMUL(inlet_i, i) << 5;
i += step;
}