frac32buffer i
bool32.rising trigger
frac32.bipolar decay time
frac32buffer o
bool32.tgl on
frac32.s.map d
bool32 on
int32_t prev;
int32_t step;
int32_t val;
int ntrig;
int32_t Loopval;
val = 0;
ntrig = 0;
disp_on = 0;
// display gate
if (param_on) {
disp_on = inlet_t;
}
// 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;
}