frac32.positive scan
frac32.bipolar offset
frac32.bipolar PW
frac32.bipolar x
frac32.bipolar y
frac32 note1
frac32 note2
frac32 note3
frac32 note4
bool32 active
frac32buffer out
frac32.s.map detune
frac32.s.map PW
int32 key
frac32.s.map.pitch pitch
uint32_t phase[8];
uint32_t phose[8];
uint32_t phise[8];
int32_t wave[8];
int32_t freq[8];
int i;
int32_t base[12] = {0, 0, 2, 2, 4, 5, 5, 7, 7, 9, 9, 11};
int32_t sum[4];
int m1trig[4];
int m2trig[4];
int note[4];
int octave[4];
int32_t marph[4];
int32_t mirph[4];
int32_t morph[4];
int32_t LP1;
int32_t LP2;
int32_t HP;
int32_t PW;
int32_t pu;
int32_t x1;
int32_t x2;
int32_t y1;
int32_t y2;
int32_t mix1;
int32_t mix2;
int32_t mix3;
if (inlet_active > 0) {
for (i = 0; i < 4; i++) {
int32_t a;
a = (inlet_scan + i * inlet_offset) & ((1 << 27) - 1);
morph[i] = a < (1 << 26) ? a << 1 : (1 << 27) - ((a - (1 << 26)) << 1);
morph[i] = (morph[i] - (1 << 26)) * 8 / 6 + (1 << 26);
marph[i] = marph[i] + ((morph[i] - marph[i]) >> 1);
morph[i] = marph[i] < 0 ? 0 : marph[i];
morph[i] = morph[i] > (1 << 27) ? (1 << 27) : morph[i];
}
note[0] = (inlet_note1 + param_pitch) >> 21;
note[1] = (inlet_note2 + param_pitch) >> 21;
note[2] = (inlet_note3 + param_pitch) >> 21;
note[3] = (inlet_note4 + param_pitch) >> 21;
int key = (param_key * 7) - (param_key * 7) / 12 * 12;
for (i = 0; i < 4; i++) {
octave[i] = note[i] / 12;
note[i] = note[i] - octave[i] * 12;
note[i] = note[i] < 0 ? note[i] + 11 : note[i];
if ((morph[i] == 0) && (!(m1trig[i]))) {
MTOFEXTENDED((((base[note[i]] + octave[i] * 12)) << 21) + (key << 21) +
i * 53,
freq[i * 2])
m1trig[i] = 1;
} else if (!(morph[i] == 0)) {
m1trig[i] = 0;
}
if (!(morph[i] == (1 << 27)) && (!(m2trig[i]))) {
MTOFEXTENDED((((base[note[i]] + octave[i] * 12)) << 21) + (key << 21) +
i * 47,
freq[i * 2 + 1])
m2trig[i] = 1;
} else if ((morph[i] == (1 << 27))) {
m2trig[i] = 0;
}
}
pu = ((param_PW + inlet_PW + (1 << 27)) & ((1 << 28) - 1)) - (1 << 27);
x1 = (1 << 26) + (inlet_x >> 1);
x2 = (1 << 27) - x1;
y1 = (1 << 26) + (inlet_y >> 1);
y2 = (1 << 27) - y1;
}
if (inlet_active > 0) {
PW = PW + ((pu - PW) >> 8);
for (i = 0; i < 4; i++) {
mirph[i] = mirph[i] + ((marph[i] - mirph[i]) >> 8);
morph[i] = mirph[i] < 0 ? 0 : mirph[i];
morph[i] = morph[i] > (1 << 27) ? (1 << 27) : morph[i];
}
for (i = 0; i < 8; i++) {
phase[i] += freq[i] + ((i * param_detune) >> 10);
if (PW >= 0) {
phose[i] = (___SMMUL(phase[i] >> 1, phase[i] >> 1) << 2);
} else if (PW < 0) {
phose[i] = ((1 << 32) - 1) - phase[i];
phose[i] = ___SMMUL(phose[i] >> 1, phose[i] >> 1) << 2;
phose[i] = (((1 << 32) - 1) - phose[i]);
}
phise[i] =
((___SMMUL(phase[i] >> 2, ((1 << 27) - (PW >= 0 ? PW : -PW)) << 3)
<< 3) +
((___SMMUL(phose[i] >> 1, (PW > 0 ? PW : -PW) << 3) << 2)))
<< 1;
SINE2TINTERP(phise[i], wave[i])
}
for (i = 0; i < 4; i++) {
sum[i] = ___SMMUL(morph[i], wave[i * 2]) +
___SMMUL((1 << 27) - morph[i], wave[i * 2 + 1]);
}
mix1 = ___SMMUL(x1 << 2, sum[0] << 3) + ___SMMUL(x2 << 2, sum[1] << 3);
mix2 = ___SMMUL(x1 << 2, sum[2] << 3) + ___SMMUL(x2 << 2, sum[3] << 3);
mix3 = ___SMMUL(y1 << 2, mix1 << 3) + ___SMMUL(y2 << 2, mix2);
LP1 = LP1 + (((mix3)-LP1) >> 2);
HP = HP + ((LP1 - HP) >> 12);
outlet_out = LP1 - HP;
// outlet_out=wave[0]>>5;
}