int32 Use int-control to set "power length" (see delay module for corresponding "power values"
frac32 Connect to the Clock2Timing module (sss->Clock2Timing)
frac32buffer wave
frac32.positive res
frac32.s.map.kpitch rate
objref delayname
uint64_t phase;
uint64_t phrase;
int64_t val;
int64_t ctrl1;
int64_t ctrl2;
int32_t ctrl3;
int64_t next1;
int64_t next2;
int64_t next3;
int64_t prev;
int64_t ccomp;
int64_t tri;
int trg;
int64_t dir;
int64_t val2;
int64_t out;
outlet_res = ctrl1 << 28 - inlet_length;
int64_t freq;
MTOFEXTENDED(param_rate - (50 << 21), freq);
if (inlet_Hz) {
freq = ((inlet_Hz) / 44 * 30);
}
if (phase > (1 << 27)) {
trg = 1;
phase = (phase + freq) & ((1 << 27) - 1);
} else {
trg = 0;
phase += freq;
}
if (trg == 1) {
ctrl3 = ctrl2;
ctrl2 = ctrl1;
if (ctrl1 >= ((1 << inlet_length - 1))) {
dir = 1;
}
if (ctrl1 <= 1) {
dir = 0;
}
if (dir == 0) {
ctrl1 += 1;
}
if (dir == 1) {
ctrl1 -= 1;
}
}
ccomp = (1 << 27) - phase;
uint32_t delay1 = attr_delayname.writepos - ctrl3 - BUFSIZE + buffer_index;
next1 = attr_delayname.array[delay1 & attr_delayname.LENGTHMASK] << 14;
uint32_t delay2 = attr_delayname.writepos - ctrl2 - BUFSIZE + buffer_index;
next2 = attr_delayname.array[delay2 & attr_delayname.LENGTHMASK] << 14;
uint32_t delay3 = attr_delayname.writepos - ctrl1 - BUFSIZE + buffer_index;
next3 = attr_delayname.array[delay3 & attr_delayname.LENGTHMASK] << 14;
out = (___SMMUL(ccomp << 3, next1 << 2) + next2 +
___SMMUL(phase << 3, next3 << 2)) >>
1;
val2 = val2 + ((out << 32) - val2) >> 1;
outlet_out = (val2) >> 32;
// outlet_out=next1;
//(__USAT(param_time + inlet_time,27)>>(27-attr_delayname.LENGTHPOW))