bool32 rst
bool32 tap
frac32 cutoff
frac32 vel
frac32 feed
frac32buffer wave input
frac32buffer out
frac32.s.map feed
bool32.mom rst
frac32.s.map.pitch cutoff
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;
int delays;
int32_t times[16];
int32_t velocity[16];
int32_t f[16];
int32_t g[16];
int32_t val[16];
int gtrig;
int rtrig;
uint32_t count = 0;
int start;
int i;
int32_t out;
static int16_t _array[1 << attr_size] __attribute__((section(".sdram")));
array = &_array[0];
writepos = 0;
for (i = 0; i < LENGTH; i++)
array[i] = 0;
delays = 0;
start = 1;
int rst = inlet_rst + param_rst;
if ((rst > 0) && !rtrig) {
delays = 0;
start = 1;
rtrig = 1;
} else if (rst == 0) {
rtrig = 0;
}
if ((inlet_tap > 0) && !gtrig) {
if (start == 1) {
count = 0;
start = 0;
}
if (delays > 0) {
times[delays - 1] = count;
// MTOF(inlet_cutoff+param_cutoff,f[delays-1])
g[delays - 1] = inlet_cutoff;
velocity[delays - 1] = inlet_vel << 2;
}
delays += 1;
gtrig = 1;
} else if (inlet_tap == 0) {
gtrig = 0;
}
int32_t feed = __SSAT(param_feed + inlet_feed, 27);
if (delays > 0) {
for (i = 0; i < (delays - 1); i++) {
MTOF(g[i] + param_cutoff, f[i])
}
}
writepos = (writepos + 1) & LENGTHMASK;
array[writepos] = __SSAT((inlet_in + ___SMMUL(feed << 2, out << 2)) >> 16, 16);
count += 1;
out = 0;
int32_t tmp;
if (delays > 0) {
for (i = 0; i < (delays - 1); i++) {
tmp =
___SMMUL(array[(writepos - times[i]) & LENGTHMASK] << 19, velocity[i]);
val[i] = ___SMMLA((tmp - val[i]) << 1, f[i], val[i]);
out += val[i];
}
}
outlet_out = out + inlet_in;