frac32 ofs1
frac32 mod1
frac32 ofs2
frac32 mod2
frac32 ofs3
frac32 mod3
frac32buffer in
int32 Md1
int32 Md2
int32 Md3
frac32buffer out
int32 Mode1
int32 Mode2
int32 Mode3
frac32.u.map mix1
frac32.u.map mix2
frac32.u.map mix3
frac32.s.map gainIn
frac32.s.map mod1
frac32.s.map ofs1
frac32.s.map mod2
frac32.s.map ofs2
frac32.s.map mod3
frac32.s.map ofs3
int32_t audio;
int32_t LP;
int32_t HP;
int32_t audia;
int32_t val[3];
int32_t f;
int32_t cccomp;
int32_t mode1(int32_t input, int32_t modulate, int instance, int32_t extra) {
audio = input > 0 ? input + ___SMMUL((input - (1 << 27)) << 3, modulate << 2)
: input + ___SMMUL((input + (1 << 27)) << 3, modulate << 2);
}
int32_t mode2(int32_t input, int32_t modulate, int instance, int32_t extra) {
int32_t sine;
SINE2TINTERP((input << 3) + ___SMMUL(input << 5, modulate << 4), sine)
audio = sine >> 4;
}
int32_t mode3(int32_t input, int32_t modulate, int instance, int32_t extra) {
int32_t sine;
SINE2TINTERP(__SSAT((input << 2) + ___SMMUL(input << 5, modulate << 4), 31),
sine)
audio = sine >> 4;
}
int32_t mode4(int32_t input, int32_t modulate, int instance, int32_t extra) {
int32_t sine;
SINE2TINTERP(__SSAT((input << 2) + ___SMMUL(input << 4, modulate << 4), 30),
sine)
audio = sine >> 4;
}
int32_t mode5(int32_t input, int32_t modulate, int instance, int32_t extra) {
audio = ((input + (1 << 27) + ___SMMUL(modulate << 5, input << 4)) &
((1 << 28) - 1)) -
(1 << 27);
}
int32_t mode6(int32_t input, int32_t modulate, int instance, int32_t extra) {
audio = input / modulate * modulate;
}
int32_t mode7(int32_t input, int32_t modulate, int instance, int32_t extra) {
audio = (((1 << 27) + input + ___SMMUL(modulate << 3, input << 3)) &
((1 << 28) - 1)) -
(1 << 27);
audio = audio > (1 << 27) ? ((1 << 27) - (audio - (1 << 27))) : audio;
audio = audio < (-1 << 27) ? ((-1 << 27) - (audio + (1 << 27))) : audio;
}
int32_t mode8(int32_t input, int32_t modulate, int instance, int32_t extra) {
MTOF(modulate, f)
val[instance] = ___SMMLA(((input - val[instance]) << 1), f, val[instance]);
cccomp = (1 << 26) + (extra >> 1);
audio = val[instance] - ___SMMUL(input << 3, cccomp << 2);
}
int32_t Mode1;
int32_t Mode2;
int32_t Mode3;
Mode1 = (param_Mode1 + inlet_Md1) & 7;
Mode2 = (param_Mode2 + inlet_Md2) & 7;
Mode3 = (param_Mode3 + inlet_Md3) & 7;
int32_t mix1;
int32_t mix2;
int32_t mix3;
mix1 = (1 << 27) - param_mix1;
mix2 = (1 << 27) - param_mix2;
mix3 = (1 << 27) - param_mix3;
audio = inlet_in + ___SMMUL(inlet_in << 3, param_gainIn << 3);
audia = audio;
switch (Mode1 > 0 ? Mode1 : 0) {
case 0:
mode8(audio, param_mod1 + inlet_mod1, 0, inlet_ofs1 + param_ofs1);
break;
case 1:
mode1(audio + inlet_ofs1 + param_ofs1, param_mod1 + inlet_mod1, 0, 0);
break;
case 2:
mode2(audio + inlet_ofs1 + param_ofs1, param_mod1 + inlet_mod1, 0, 0);
break;
case 3:
mode3(audio + inlet_ofs1 + param_ofs1, param_mod1 + inlet_mod1, 0, 0);
break;
case 4:
mode4(audio + inlet_ofs1 + param_ofs1, param_mod1 + inlet_mod1, 0, 0);
break;
case 5:
mode5(audio + inlet_ofs1 + param_ofs1, param_mod1 + inlet_mod1, 0, 0);
break;
case 6:
mode6(audio + inlet_ofs1 + param_ofs1, param_mod1 + inlet_mod1, 0, 0);
break;
case 7:
mode7(audio + inlet_ofs1 + param_ofs1, param_mod1 + inlet_mod1, 0, 0);
break;
}
audio = ___SMMUL(mix1 << 3, audia << 2) + ___SMMUL(param_mix1 << 3, audio << 2);
audia = audio;
switch (Mode2 > 0 ? Mode2 : 0) {
case 0:
mode8(audio, param_mod2 + inlet_mod2, 1, inlet_ofs2 + param_ofs2);
break;
case 1:
mode1(audio + inlet_ofs2 + param_ofs2, param_mod2 + inlet_mod2, 1, 0);
break;
case 2:
mode2(audio + inlet_ofs2 + param_ofs2, param_mod2 + inlet_mod2, 1, 0);
break;
case 3:
mode3(audio + inlet_ofs2 + param_ofs2, param_mod2 + inlet_mod2, 1, 0);
break;
case 4:
mode4(audio + inlet_ofs2 + param_ofs2, param_mod2 + inlet_mod2, 1, 0);
break;
case 5:
mode5(audio + inlet_ofs2 + param_ofs2, param_mod2 + inlet_mod2, 1, 0);
break;
case 6:
mode6(audio + inlet_ofs2 + param_ofs2, param_mod2 + inlet_mod2, 1, 0);
break;
case 7:
mode7(audio + inlet_ofs2 + param_ofs2, param_mod2 + inlet_mod2, 1, 0);
break;
}
audio = ___SMMUL(mix2 << 3, audia << 2) + ___SMMUL(param_mix2 << 3, audio << 2);
audia = audio;
switch (Mode3 > 0 ? Mode3 : 0) {
case 0:
mode8(audio, param_mod3 + inlet_mod3, 2, inlet_ofs3 + param_ofs3);
break;
case 1:
mode1(audio + inlet_ofs3 + param_ofs3, param_mod3 + inlet_mod3, 2, 0);
break;
case 2:
mode2(audio + inlet_ofs3 + param_ofs3, param_mod3 + inlet_mod3, 2, 0);
break;
case 3:
mode3(audio + inlet_ofs3 + param_ofs3, param_mod3 + inlet_mod3, 2, 0);
break;
case 4:
mode4(audio + inlet_ofs3 + param_ofs3, param_mod3 + inlet_mod3, 2, 0);
break;
case 5:
mode5(audio + inlet_ofs3 + param_ofs3, param_mod3 + inlet_mod3, 2, 0);
break;
case 6:
mode6(audio + inlet_ofs3 + param_ofs3, param_mod3 + inlet_mod3, 2, 0);
break;
case 7:
mode7(audio + inlet_ofs3 + param_ofs3, param_mod3 + inlet_mod3, 2, 0);
break;
}
audio = ___SMMUL(mix3 << 3, audia << 2) + ___SMMUL(param_mix3 << 3, audio << 2);
audia = audio;
audio = audio > (1 << 27) ? ((1 << 27) - (audio - (1 << 27))) : audio;
audio = audio < (-1 << 27) ? ((-1 << 27) - (audio + (1 << 27))) : audio;
LP = LP + (((audio >> 1) - LP) >> 1);
HP = HP + ((LP - HP) >> 11);
outlet_out = LP - HP;