frac32buffer wave input
frac32buffer sync
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);
int16_t *array;
uint32_t writepos;
uint32_t cnt;
uint32_t Time;
bool trg;
uint32_t pos;
bool Trg;
uint32_t set;
uint32_t env;
uint32_t form;
int32_t left;
static int16_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;
writepos = (writepos + 1) & LENGTHMASK;
array[writepos] = __SSAT(inlet_in >> 14, 16);
cnt += 1;
if ((inlet_in > 0) && !trg) {
trg = 1;
cnt = 0;
} else if (inlet_in <= 0) {
trg = 0;
}
env -= env >> 2;
left -= left >> 3;
if ((inlet_sync > 0) && !Trg) {
left += ___SMMUL(env, array[(writepos - form) & LENGTHMASK] << 16);
Trg = 1;
form = set;
set = cnt;
env = (1 << 30);
} else if (inlet_sync <= 0) {
Trg = 0;
}
outlet_out =
___SMMUL((1 << 30) - env, array[(writepos - set) & LENGTHMASK] << 16);
outlet_out += ___SMMUL(env, array[(writepos - form) & LENGTHMASK] << 16) + left;