frac32 in
frac32 mod
frac32 switch
frac32 A
frac32 B
bool32.tgl switch
frac32.u.map mod
int32.hradio mode
int32_t v27 = 1 << 27;
int32_t A;
int32_t B;
int32_t DIV(int32_t in, int32_t quant) {
quant = (quant < 0 ? -quant : quant) + 2;
int32_t hq = quant >> 1;
int32_t dest = (in / quant);
dest += in < 0 ? -1 : 0;
int32_t left = in - dest * quant;
A = (left > hq ? hq : left) + dest * hq;
B = (left < hq ? 0 : left - hq) + dest * hq;
};
int32_t PAN(int32_t in, int32_t pan) {
int32_t PN = __SSAT(pan, 28) + v27 << 2;
B = ___SMMUL(in << 2, PN);
A = in - B;
};
int32_t SD(int32_t in, int32_t S) {
A = in + S >> 1;
B = in - S >> 1;
}
int32_t MM(int32_t in, int32_t S) {
A = in > S ? in : S;
B = in > S ? S : in;
}
int32_t mod = mod + inlet_mod;
switch (param_mode) {
case 0:
DIV(inlet_in, mod);
break;
case 1:
PAN(inlet_in, mod);
break;
case 2:
SD(inlet_in, mod);
break;
case 3:
MM(inlet_in, mod);
break;
}
if ((param_switch > 0) || (inlet_switch > 0)) {
outlet_A = B;
outlet_B = A;
} else {
outlet_A = A;
outlet_B = B;
}