frac32.positive rate
frac32 output
frac32 r1
frac32 r2
frac32.u.map max
frac32.u.map min
frac32.s.map.lfopitch smooth
int32_t val;
int32_t gate;
int64_t rnd1;
int64_t rnd2;
int64_t rnd3;
int64_t rnd4;
int ntrig1;
int32_t gote;
int32_t smooth1;
int32_t smooth2;
val = 0;
rnd1 = (int32_t)(GenerateRandomNumber()) >> 4;
rnd2 = (int32_t)(GenerateRandomNumber()) >> 4;
ntrig1 = 0;
smooth1 = 0;
smooth2 = 0;
if ((gate == 0) && !ntrig1) {
rnd1 = ((int32_t)(GenerateRandomNumber()) >> 5) + (1 << 26);
rnd2 = ((int32_t)(GenerateRandomNumber()) >> 5) + (1 << 26);
ntrig1 = 1;
} else if (!((gate) > 0)) {
ntrig1 = 0;
}
rnd3 =
___SMMUL(rnd1 << 3, (param_max - param_min) << 2) + param_min + inlet_rate;
rnd4 =
___SMMUL(rnd2 << 3, (param_max - param_min) << 2) + param_min + inlet_rate;
rnd3 = rnd3 > 0 ? rnd3 : -rnd3;
rnd4 = rnd4 > 0 ? rnd4 : -rnd4;
rnd3 = ((1 << 27) - rnd3) > 0 ? (1 << 27) - rnd3 : -(1 << 27) + rnd3;
rnd4 = ((1 << 27) - rnd4) > 0 ? (1 << 27) - rnd4 : -(1 << 27) + rnd4;
rnd3 = (1 << 27) - rnd3;
rnd4 = (1 << 27) - rnd4;
int32_t f;
MTOF(param_smooth, f);
smooth1 = ___SMMLA((rnd3 - smooth1) << 1, f, smooth1);
smooth2 = ___SMMLA((rnd4 - smooth2) << 1, f, smooth2);
if (gate > val) {
val = ___SMMLA(val - gate, (-1 << 27) + smooth1, val);
} else {
val = ___SMMLA(val - gate, (-1 << 27) + smooth2, val);
}
outlet_out = val;
if ((val >= gate - 10000000) && (val <= gate + 10000000)) {
gate = (gate > 0 ? 0 : (1 << 27));
}
outlet_r1 = smooth1;
outlet_r2 = smooth2;