frac32buffer in
bool32 on
int32 connect to "Ksamples" on my clock2timing module. Use ratioVCAI to set ratio to host tempo
int32 swing
int32 repeat
frac32 Ksize
frac32 Kswing
frac32 wet
frac32 feed
frac32buffer out
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;
int32_t size;
int32_t times;
int32_t rec;
int32_t out;
int32_t repeat;
int32_t swing;
int i;
static int32_t _array[attr_poly][1 << attr_size]
__attribute__((section(".sdram")));
array = &_array[parent->polyIndex][0];
writepos = 0;
for (i = 0; i < LENGTH; i++)
array[i] = 0;
size = ___SMMUL(__USAT(inlet_Ksize, 27) << 3, LENGTH << 2) + inlet_size;
size = size > 0 ? size : -size;
size = size > 0 ? size : 1;
swing = ___SMMUL(__USAT(inlet_Kswing, 27) << 3, LENGTH << 2) + inlet_swing;
repeat = inlet_repeat;
writepos = (writepos + 1) & LENGTHMASK;
array[writepos] = inlet_on > 0
? __SSAT(inlet_in + ___SMMUL(inlet_feed << 3, out << 2),
28)
: 0;
out = 0;
if (inlet_on > 0) {
for (i = 1; i <= repeat; i++) {
out = __SSAT(
out + ___SMMUL(array[(writepos - i * size + ((i - 1) & 1) * swing) &
LENGTHMASK]
<< 2,
inlet_wet << 3),
28);
}
}
outlet_out = __SSAT(inlet_in + out, 28);