bool32 on
bool32 reverse
int32 connect to "Ksamples" on my clock2timing module. Use ratioVCAI to set ratio to host tempo
int32 repeat
frac32 Ksize
frac32buffer in
frac32buffer out
bool32 rec
frac32.u.map size
int32 repeat
bool32.tgl duck
combo size
static const uint32_t LENGTHPOW = (attr_size);
static const uint32_t LENGTH = (1 << attr_size);
static const uint32_t LENGTHMASK = ((1 << attr_size) - 1);
int32_t *array;
uint32_t writepos;
uint32_t phase;
int32_t size;
int32_t times;
int32_t rec;
int32_t out;
int32_t aut;
int32_t window;
int32_t val;
int ttrig;
int32_t on;
int32_t repeat;
int32_t ON;
static int32_t _array[attr_poly][1 << attr_size]
__attribute__((section(".sdram")));
array = &_array[parent->polyIndex][0];
int i;
writepos = 0;
for (i = 0; i < LENGTH; i++)
array[i] = 0;
size = param_size;
size = ___SMMUL(size << 3, size << 2);
size = ___SMMUL(__USAT(size + inlet_Ksize, 27) << 3, LENGTH << 2) + inlet_size;
repeat = inlet_repeat + param_repeat;
outlet_rec = rec;
//(on>0?on-rec:on)
ON += (((on > 0 ? on - (rec << 27) : on) - ON) >> 5);
if ((inlet_in > 0) && (!(ttrig))) {
ttrig = 1;
on = inlet_on > 0 ? (1 << 27) : 0;
} else if (inlet_in < 0) {
ttrig = 0;
}
out = ___SMMUL(((1 << 27) - ON * (param_duck)) << 3, inlet_in << 2);
if ((!(on > 0)) || (rec > 0)) {
writepos = (writepos + 1) & LENGTHMASK;
array[writepos] = __SSAT(out, 28);
}
if (!(inlet_on > 0)) {
times = 0;
phase = 0;
}
if (on > 0) {
phase += 1;
phase = phase - ((phase / size) * size);
times = phase == 0 ? times + 1 : times;
times = times - ((times / repeat) * repeat);
rec = times >= (repeat - 1) ? 1 : 0;
}
aut = array[(writepos + (inlet_reverse > 0 ? -phase : phase - size)) &
LENGTHMASK];
// aut+=array[(writepos-phase)&LENGTHMASK]>>1;
outlet_out = out + ___SMMUL(ON << 3, aut << 2);