frac32buffer in
frac32 rate
frac32buffer out
int32_t pulse;
int32_t mem;
int32_t divi;
int32_t trig;
// trigger
divi = ___SMMUL(inlet_rate << 3, inlet_rate << 2);
divi = ___SMMUL(divi << 1, divi);
divi = ___SMMUL(divi, divi);
if (pulse > divi && !trig) {
pulse = 0;
trig = 1;
mem = inlet_in;
} else {
pulse += 1;
trig = 0;
}
outlet_out = mem;
if (inlet_rate == 0)
outlet_out = inlet_in;