frac32buffer i
bool32.rising trigger
frac32 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 in = -inlet_d - param_d;
int32_t c;
MTOFEXTENDED(in, c);
c = 0x7FFFFFFF - (c >> 2);
val = ___SMMUL(val, c) << 1;
}
Loopval = val;
// Env off
outlet_o = inlet_i;
// Env on
if (param_on) {
outlet_o = ___SMMUL(inlet_i, i) << 5;
i += step;
}