frac32 frq1
frac32 frq2
frac32 frq3
frac32 frq4
frac32 frq5
frac32 bw1
frac32 bw2
frac32 bw3
frac32 bw4
frac32 bw5
frac32 gain1
frac32 gain2
frac32 gain3
frac32 gain4
frac32 gain5
frac32buffer phase
frac32buffer throat
frac32buffer out
uint32_t phase;
uint32_t Phase[5];
float32_t frq[5];
float32_t BW[5];
float32_t dBgain[5];
int32_t Sine[5];
int i;
int trig;
int32_t throat;
frq[0] = ((float)inlet_frq1) / (1 << 16);
frq[1] = ((float)inlet_frq2) / (1 << 16);
frq[2] = ((float)inlet_frq3) / (1 << 16);
frq[3] = ((float)inlet_frq4) / (1 << 16);
frq[4] = ((float)inlet_frq5) / (1 << 16);
dBgain[0] = ((float)inlet_gain1) / (1 << 21);
dBgain[1] = ((float)inlet_gain2) / (1 << 21);
dBgain[2] = ((float)inlet_gain3) / (1 << 21);
dBgain[3] = ((float)inlet_gain4) / (1 << 21);
dBgain[4] = ((float)inlet_gain5) / (1 << 21);
BW[0] = ((float)inlet_bw1) / (1 << 16);
BW[1] = ((float)inlet_bw2) / (1 << 16);
BW[2] = ((float)inlet_bw3) / (1 << 16);
BW[3] = ((float)inlet_bw4) / (1 << 16);
BW[4] = ((float)inlet_bw5) / (1 << 16);
for (i = 0; i < 5; i++) {
dBgain[i] = powf(0.5, -dBgain[i] / 6);
}
phase = inlet_phase;
throat = inlet_throat;
int32_t wave = 0;
for (i = 0; i < 5; i++) {
Phase[i] += (frq[i] / (60000 >> 5)) * (1 << 20);
Phase[i] = Phase[i] & ((1 << 27) - 1);
if ((phase > (1 << 26)) && (!(trig)))
// if((throat>(0)) &&(!(trig)))
{
Phase[i] = 0;
trig = 1;
} else if (phase < (1 << 26))
// else if (throat<(0))
{
trig = 0;
}
uint32_t Ephase[5];
Ephase[i] = ___SMMUL(Phase[i] << 3, Phase[i] << 2);
// Ephase[i]=___SMMUL(Ephase[i]<<3,Ephase[i]<<2);
SINE2TINTERP(Phase[i] << 5, Sine[i])
wave += ___SMMUL(throat << 1, (Sine[i]));
}
int32_t sone;
SINE2TINTERP(wave << 1, sone)
outlet_out = sone >> 5;
// outlet_sine=sine>>5;