frac32buffer input
frac32buffer in1
frac32.bipolar rate
frac32buffer output
frac32buffer out1
frac32.s.map rate
combo depth
class D64 {
public:
int32_t v[64];
int ind;
void init(void) {
for (int i = 0; i < 64; i++)
v[i] = 0;
ind = 0;
}
void aProc(int32_t &x, int32_t d_q21) {
ind--;
ind &= 63;
v[ind] = x;
int32_t i0 = ((d_q21 >> 21) + ind) & 63;
// q21 q31
x = ___SMMLA(v[(i0 + 1) & 63] - v[i0],
(d_q21 & ((1 << 21) - 1)) << (31 - 21), v[i0] >> 1)
<< 1;
}
};
void rot(int32_t &x, int32_t &y, int32_t c, int32_t s) {
int32_t t = ___SMMLS(y, s, ___SMMUL(x, c)) << 1;
y = ___SMMLA(y, c, ___SMMUL(x, s)) << 1;
x = t;
}
int32_t d0[256], d1[256];
int32_t c[16], s[16];
uint8_t ind0[16], ind1[16];
D64 dA, dB, dC, dD, dE, dF;
int32_t rnd;
uint32_t p, dp;
uint8_t i;
rnd = GenerateRandomNumber();
for (int r = 0; r < 16; r++) {
ind0[r] = (rnd = rnd * 69069 + 1) >> 24;
ind1[r] = (rnd = rnd * 69069 + 1) >> 24;
}
for (int j = 0; j < 256; j++) {
d0[j] = d1[j] = 0;
}
dA.init();
dB.init();
dC.init();
dD.init();
dE.init();
dF.init();
dp = __USAT((inlet_rate + param_rate + (1 << 27)) >> 1, 27);
dp = ___SMMLA(dp, dp, dp >> 5) >> 2;
p += dp;
for (int r = 0; r < 16; r++) {
if (p < dp) {
ind0[r] = (rnd = rnd * 69069 + 1) >> 25;
ind1[r] = ((rnd = rnd * 69069 + 1) >> 25) + 128;
}
// 360/8 = 22.5°
int32_t a = p >> (32 - 29); //[0 1<<29[
if (a > (1 << 28)) {
a = (1 << 29) - a;
}
//[0 1<<28]
int32_t tmp;
SINE2TINTERP(a, tmp)
s[r] = tmp;
a += 1 << 30;
SINE2TINTERP(a, tmp)
c[r] = tmp;
p += 1 << 28;
}
uint32_t p4 = p << 2;
int32_t lfo;
SINE2TINTERP(p4, lfo)
lfo >>= 4;
int32_t modE = ___SMMUL((1 << 27) + lfo, 62 << 25);
int32_t modC = ___SMMUL((1 << 27) - lfo, 62 << 25);
SINE2TINTERP(p4 + 715827882UL, lfo)
lfo >>= 4;
int32_t modF = ___SMMUL((1 << 27) + lfo, 62 << 25);
int32_t modD = ___SMMUL((1 << 27) - lfo, 62 << 25);
SINE2TINTERP(p4 + 1431655765UL, lfo)
lfo >>= 4;
int32_t modA = ___SMMUL((1 << 27) + lfo, 62 << 25);
int32_t modB = ___SMMUL((1 << 27) - lfo, 62 << 25);
d0[i] = inlet_in0;
d1[i] = inlet_in1;
i--;
for (int r = 0; r < 16; r++) {
rot(d0[(uint8_t)(i + ind0[r])], d1[(uint8_t)(i + ind1[r])], c[r], s[r]);
r++;
rot(d1[(uint8_t)(i + ind1[r])], d0[(uint8_t)(i + ind0[r])], c[r], s[r]);
}
dA.aProc(d0[(uint8_t)(i + 35)], modA);
dB.aProc(d1[(uint8_t)(i + 43)], modB);
dC.aProc(d0[(uint8_t)(i + 100)], modC);
dD.aProc(d1[(uint8_t)(i + 91)], modD);
dE.aProc(d0[(uint8_t)(i + 190)], modE);
dF.aProc(d1[(uint8_t)(i + 173)], modF);
outlet_out0 = d0[(uint8_t)(i + attr_depth)];
outlet_out1 = d1[(uint8_t)(i + attr_depth)];