frac32.positive trig
frac32 pitch
frac32 hit
frac32buffer out
frac32.u.map pitch
frac32.u.map hit
frac32.u.map tail
int32_t real1;
int32_t imaginary1;
float32_t f0;
float32_t sinw0;
float32_t cosw0;
float32_t pi;
float32_t Fs;
float32_t f1;
int32_t out;
int32_t v27 = (1 << 27);
int32_t V30 = (30 << 21);
int32_t val1;
int32_t val2;
int32_t V48 = 48 << 21;
int32_t Cal(int32_t pitch, int32_t tail) {
pitch = __SSAT(pitch, 28) - (12 << 21);
float32_t power = powf(2, ((float)(pitch)) / (12 << 21));
f0 = 440 * power;
int32_t res = __USAT(V48 + (tail >> 2), 27);
res = v27 - res;
res = ___SMMUL(res << 3, res << 2);
res = v27 - ___SMMUL(res << 2, res << 3);
float32_t ras = ((float)res) / (1 << 27);
float r =
0.0001 * power + 1 - (1 - ((float)res + (1 << 30)) / (9 << 27)) / power;
float32_t w0 = 2 * pi * f0 / Fs;
sinw0 = sinf(w0) * r;
cosw0 = cosf(w0) * r;
};
int32_t sum;
uint32_t state;
int32_t count;
int32_t ntrig;
pi = 3.1415926535897932384626433832795028841971693993751058209749445;
Fs = 48000;
imaginary1 = 0;
real1 = 0;
state = 0;
count = 0;
ntrig = 0;
int32_t frq;
int32_t pitch = -V30 + (param_pitch >> 1) + (sum >> 1) + inlet_pitch;
Cal(pitch, param_tail);
int32_t SIN1 = sinw0 * (1 << 27);
int32_t COS1 = cosw0 * (1 << 27);
SIN1 = SIN1 << 3;
COS1 = COS1 << 3;
if ((inlet_trig > 0) && !ntrig) {
state = 1;
count = inlet_trig >> 22;
ntrig = 1;
} else {
if (!(inlet_trig > 0))
ntrig = 0;
}
sum = 0;
int32_t damp;
MTOF(param_hit, damp);
int32_t out;
if (count > 0) {
count--;
if (state & 1) {
state = (state >> 1) ^ 0xC;
out = 1 << 27;
} else {
state = (state >> 1);
out = -1 << 27;
}
} else
out = 0;
val1 = ___SMMLA(((out)-val1) << 1, damp, val1);
val2 = ___SMMLA((val1 - val2) << 1, damp >> 1, val2);
imaginary1 = ___SMMUL(real1 << 2, SIN1) + ___SMMUL(imaginary1 << 2, COS1);
real1 = (val1 - val2) + ___SMMUL(real1 << 2, COS1) -
___SMMUL(imaginary1 << 2, SIN1);
outlet_out = imaginary1;
imaginary1 = __SSAT(imaginary1, 27);
sum += (imaginary1 > 0 ? imaginary1 : -imaginary1) >> 4;