bool32 gate
frac32.positive out
int32.hradio divd
bool32.tgl cycle
frac32.u.map a
frac32.u.map d
frac32.u.map h
int val;
bool has_peaked;
int holdcount;
val = 0;
has_peaked = 0;
holdcount = 0;
if (inlet_gate) {
if (val < 1 << 27 && !has_peaked) {
val = val + (1 + (((1 << 27) - param_a) >> 14));
if (val >= 1 << 27) {
val = (1 << 27) - 1;
if (param_cycle)
has_peaked = true;
}
}
if (val > 0 && has_peaked && param_cycle) {
if (holdcount < (param_h >> 11))
holdcount++;
else {
val = val = val - (1 + (((1 << 27) - param_d) >> (14 - param_divd)));
if (val < 0)
val = 0;
if (!val) {
has_peaked = false;
holdcount = 0;
}
}
}
}
if (!inlet_gate && val > 0) {
val = val - (1 + (((1 << 27) - param_d) >> (14 - param_divd)));
if (val < 0)
val = 0;
has_peaked = false;
}
outlet_out = val;