frac32 input 0
frac32 input 1
frac32 input 2
frac32 input 3
frac32 i4
frac32 i5
frac32 i6
frac32 i7
frac32.positive mix
frac32 output
frac32 o01
frac32 o02
frac32 o03
frac32 o04
frac32 o05
frac32 o06
frac32 o07
frac32 o08
frac32 o09
frac32 o10
frac32 o11
frac32 o12
frac32 o13
frac32 o14
frac32 o15
int32 quant01
int32 step01
int32 start01
int32 quant02
int32 step02
int32 start02
int32 quant03
int32 step03
int32 start03
int32 quant04
int32 step04
int32 start04
int32 quant05
int32 step05
int32 start05
int32 quant06
int32 step06
int32 start06
int32 quant07
int32 step07
int32 start07
int32 quant08
int32 step08
int32 start08
int32 quant09
int32 step09
int32 start09
int32 quant10
int32 step10
int32 start10
int32 quant11
int32 step11
int32 start11
int32 quant12
int32 step12
int32 start12
int32 quant13
int32 step13
int32 start13
int32 quant14
int32 step14
int32 start14
int32 quant15
int32 step15
int32 start15
int32 quant16
int32 step16
int32 start16
int32_t mix[16];
int32_t MIX[17];
int32_t P[32];
int32_t input[16];
int32_t quant[16];
int32_t start[16];
int32_t step[16];
int32_t F;
int i;
// bound mix input
int32_t MX(int32_t T) {
T = T > 0 ? T : -T;
T = T & ((1 << 28) - 1);
F = T > (1 << 27) ? (1 << 28) - T : T;
}
// mix
int32_t inputmix(int32_t inst, int32_t WaveA, int32_t WaveB, int32_t Mix) {
mix[inst] = ___SMMUL(((1 << 27) - Mix) << 3, WaveA << 2) +
___SMMUL(Mix << 3, WaveB << 2);
}
input[0] = inlet_i0;
input[1] = inlet_i1;
input[2] = inlet_i2;
input[3] = inlet_i3;
input[4] = inlet_i4;
input[5] = inlet_i5;
input[6] = inlet_i6;
input[7] = inlet_i7;
for (i = 0; i < 8; i++) {
input[i + 8] = -input[i];
}
quant[0] = param_quant01;
quant[1] = param_quant02;
quant[2] = param_quant03;
quant[3] = param_quant04;
quant[4] = param_quant05;
quant[5] = param_quant06;
quant[6] = param_quant07;
quant[7] = param_quant08;
quant[8] = param_quant09;
quant[9] = param_quant10;
quant[10] = param_quant11;
quant[11] = param_quant12;
quant[12] = param_quant13;
quant[13] = param_quant14;
quant[14] = param_quant15;
quant[15] = param_quant16;
step[0] = param_step01;
step[1] = param_step02;
step[2] = param_step03;
step[3] = param_step04;
step[4] = param_step05;
step[5] = param_step06;
step[6] = param_step07;
step[7] = param_step08;
step[8] = param_step09;
step[9] = param_step10;
step[10] = param_step11;
step[11] = param_step12;
step[12] = param_step13;
step[13] = param_step14;
step[14] = param_step15;
step[15] = param_step16;
start[0] = param_start01;
start[1] = param_start02;
start[2] = param_start03;
start[3] = param_start04;
start[4] = param_start05;
start[5] = param_start06;
start[6] = param_start07;
start[7] = param_start08;
start[8] = param_start09;
start[9] = param_start10;
start[10] = param_start11;
start[11] = param_start12;
;
start[12] = param_start13;
start[13] = param_start14;
start[14] = param_start15;
start[15] = param_start16;
MX(inlet_mix);
MIX[0] = F;
for (i = 0; i < 16; i++) {
P[i] = (MIX[0] * quant[i]) >> 27;
MIX[i + 1] = (MIX[0] - (P[i] << 27) / quant[i]) * quant[i];
P[i] = P[i] * step[i];
P[i + 16] = P[i] + step[i] + start[i];
P[i] += start[i];
inputmix(i, input[P[i] & 15], input[P[i + 16] & 15], MIX[i + 1]);
}
outlet_o00 = mix[0];
outlet_o01 = mix[1];
outlet_o02 = mix[2];
outlet_o03 = mix[3];
outlet_o04 = mix[4];
outlet_o05 = mix[5];
outlet_o06 = mix[6];
outlet_o07 = mix[7];
outlet_o08 = mix[8];
outlet_o09 = mix[9];
outlet_o10 = mix[10];
outlet_o11 = mix[11];
outlet_o12 = mix[12];
outlet_o13 = mix[13];
outlet_o14 = mix[14];
outlet_o15 = mix[15];