frac32buffer wave input
frac32buffer inR
frac32buffer outL
frac32buffer outR
frac32.s.map.kpitch panRate
int32 panSpread
frac32.s.map.pitch rate
frac32.s.map.pitch damp
frac32.u.map feed
frac32.u.map slope
frac32.u.map depth
frac32.u.map spread
frac32.u.map wet
combo size
spinner stages
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 phase;
int32_t in[attr_stages + 1];
int j;
int i;
uint32_t tmp_d;
uint32_t tmp_di;
uint32_t tmp_w1;
uint32_t tmp_w2;
int32_t tmp_a1;
int32_t tmp_a2;
int32_t tmp_r;
int32_t sum;
uint32_t PHASE;
int32_t prev1;
int32_t step1;
int32_t prev2;
int32_t step2;
int32_t Depth;
int32_t Spread;
int32_t damp[attr_stages];
static int16_t _array[(1 << attr_size) * attr_stages]
__attribute__((section(".sdram")));
array = &_array[0];
writepos = 0;
for (i = 0; i < LENGTH * attr_stages; i++)
array[i] = 0;
int32_t freq;
MTOFEXTENDED(param_rate, freq)
freq = freq >> 10;
int32_t panRate;
MTOFEXTENDED(param_panRate, panRate)
panRate = panRate >> 10;
Depth += ((param_depth >> (LENGTHPOW < 11 ? 11 : LENGTHPOW) - 11) - Depth) >> 6;
Spread += (___SMMUL(param_spread << 3, param_spread << 2) - Spread) >> 6;
step1 = (Depth - prev1) >> 4;
int32_t depth = prev1;
prev1 = Depth;
step2 = (Spread - prev2) >> 4;
int32_t spread = prev2;
prev2 = Spread;
int32_t slope = ___SMMUL(param_slope << 3, param_wet << 2);
int32_t cutoff;
MTOF(param_damp, cutoff)
depth += step1;
spread += step2;
int32_t IN = inlet_inL + inlet_inR >> 1;
writepos = (writepos + 1) & LENGTHMASK;
in[0] = __SSAT(((IN >> 1) + ___SMMUL(-(param_feed << 1) * 3, in[1] << 2)) >> 14,
16);
sum = 0;
int32_t sine;
int32_t outL = 0;
int32_t outR = 0;
phase += freq;
PHASE += panRate;
for (i = 0; i < attr_stages; i++) {
array[writepos + i * LENGTH] =
__SSAT(in[i], 15) +
__SSAT(___SMMUL(-(param_feed << 1) * 3, in[i + 1] << 2), 15);
uint32_t Phase = phase + (i * ((1 << 31) / attr_size) << 1);
Phase = Phase > (1 << 31) ? -Phase : Phase;
SINE2TINTERP((i * ((1 << 27) / (attr_size >> 1)) * param_panSpread) + PHASE,
sine)
sine = (sine >> 5) + (1 << 26);
tmp_d = (___SMMUL(depth << 1, Phase) + (i * spread / attr_stages)) &
((1 << 27) - 1);
tmp_di = writepos - (tmp_d >> (27 - LENGTHPOW)) - 1;
tmp_w1 = (tmp_d << (LENGTHPOW + 3)) & 0x3FFFFFFF;
tmp_w2 = (1 << 30) - tmp_w1;
tmp_a1 = array[(tmp_di & LENGTHMASK) + i * LENGTH] << 16;
tmp_a2 = array[((tmp_di + 1) & LENGTHMASK) + i * LENGTH] << 16;
tmp_r = ___SMMUL(tmp_a1, tmp_w1);
tmp_r = ___SMMLA(tmp_a2, tmp_w2, tmp_r);
damp[i] = ___SMMLA((tmp_r - damp[i]) << 1, cutoff, damp[i]);
in[i + 1] = __SSAT(IN + (damp[i] + tmp_r >> 1) >> 14, 15);
sum += ___SMMUL((damp[i] + tmp_r >> 1) << 3, param_slope << 2);
outL += ___SMMUL(___SMMUL((damp[i] + tmp_r >> 1) << 3, slope << 2) << 3,
sine << 2);
outR += ___SMMUL(___SMMUL((damp[i] + tmp_r >> 1) << 3, slope << 2) << 3,
(1 << 27) - sine << 2);
}
outlet_outL = (outL << 1) + inlet_inL;
outlet_outR = (outR << 1) + inlet_inR;