frac32 next
frac32 stepsize
bool32 trig
int32 steps
bool32 next
frac32 out
int32 count
int32 steps
int32_t count;
int32_t former;
int32_t next;
int ctrig;
int ttrig;
int32_t tcount;
int32_t steps;
int32_t Stepsize;
count = 0;
if ((count == 0) && !ctrig) {
steps = inlet_steps;
ctrig = 1;
former = next;
next = inlet_next;
outlet_next = 1;
} else if (!(count == 0)) {
ctrig = 0;
outlet_next = 0;
}
if ((inlet_trig > 0) && !ttrig) {
ttrig = 1;
count += 1;
count = count - (count / steps) * steps;
Stepsize = inlet_stepsize;
} else if (inlet_trig == 0) {
ttrig = 0;
}
tcount = count * (___SMMUL(Stepsize << 3, steps - 1 << 2) + 1);
tcount = tcount - (tcount / steps) * steps;
outlet_out = former + ((next - former)) * tcount / steps;
outlet_count = count;
outlet_steps = steps;