bool32 closed
bool32 half
bool32 open
frac32 vel
frac32 pitch1
frac32 pitch2
frac32 FMW1
frac32 FMW2
frac32 mix
frac32 mixmod
frac32 noise
int32 waveform
frac32buffer out
int32 div
frac32.s.map.pitch pitch1
frac32.s.map.pitch pitch2
frac32.s.map.pitch HP
bool32.tgl SS
bool32.tgl 2open
frac32.u.map noise
frac32.u.map mix2
frac32.s.map FMW1
frac32.s.map FMW2
frac32.s.map mixmod
int32 W1
int32 W2
int32 quant2
int32 start2
int32 step2
frac32.u.map.kdecaytime Dclosed
frac32.u.map.kdecaytime Dhalf
frac32.u.map.kdecaytime Dopen
objref table
int32_t i;
int strig;
int Strig;
int STrig;
int gtrig;
int32_t env;
uint32_t phase1;
uint32_t phase2;
int trig;
int dir;
uint32_t cnt;
int32_t MIX1a;
int32_t MIX1b;
int32_t MIX2a;
int32_t MIX2b;
int32_t smooth1;
int32_t smooth2;
uint32_t W[2];
uint32_t w1;
int32_t F;
int32_t mix[2];
int32_t MX(int32_t T) {
T = T > 0 ? T : -T;
T = T & ((1 << 28) - 1);
F = T > (1 << 27) ? (1 << 28) - T : T;
}
int32_t decay;
int32_t tablemix(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);
}
int32_t M1step;
int32_t M1prv;
int32_t M2step;
int32_t M2prv;
int32_t val1;
int32_t val2;
int32_t val3;
int32_t prev1;
int32_t prev2;
int32_t PREV;
uint32_t Phase2;
int32_t offset;
prev1 = 0;
prev2 = 0;
dir = 1;
int SS;
if (inlet_open > 0) {
MTOF(-param_Dopen, decay);
SS = param_SS && param_2open > 0 ? 1 : 0;
}
if (inlet_half > 0) {
MTOF(-param_Dhalf, decay);
SS = param_SS;
}
if (inlet_closed > 0) {
MTOF(-param_Dclosed, decay);
SS = param_SS;
}
int trig = inlet_open + inlet_half + inlet_closed;
if ((trig > 0) && !gtrig) {
gtrig = 1;
env = (1 << 27);
} else if (trig == 0) {
gtrig = 0;
}
env = ___SMMLA(-env << 1, decay << 1, env);
int32_t freq1;
MTOFEXTENDED(param_pitch1 + inlet_pitch1, freq1)
int32_t FMW1 =
___SMMUL(freq1 << 5,
___SMMUL(param_FMW1 + inlet_FMW1 << 3, (1 << 27) - env << 2) << 3);
FMW1 = ___SMMUL(FMW1 << 2, inlet_vel << 2) + (FMW1 >> 1);
int32_t freq2;
MTOFEXTENDED(param_pitch2 + inlet_pitch2 + ((1 << 21) * 1.57568723347), freq2)
int32_t HP;
MTOF(param_HP, HP)
int32_t FMW2 =
___SMMUL(freq2 << 5,
___SMMUL(param_FMW2 + inlet_FMW2 << 3, (1 << 27) - env << 2) << 3);
FMW2 = ___SMMUL(FMW2 << 2, inlet_vel << 2) + (FMW2 >> 1);
int32_t MiX1 =
param_mix2 + inlet_mix +
___SMMUL((param_mixmod + inlet_mixmod) / param_quant2 << 4, env << 2);
MX(MiX1);
MiX1 = F;
smooth1 += (MiX1 - smooth1) >> 4;
MiX1 = smooth1;
int32_t Noise = param_noise + inlet_noise;
int32_t step1 = param_step2;
float32_t ratio = (float32_t)(attr_table.maxLvl) / 64;
MIX1a = MiX1;
W[0] = ((MIX1a >> 4) * param_quant2) >> 23;
MIX1a = (MIX1a - (W[0] << 27) / param_quant2) * param_quant2;
W[0] = W[0] * step1 + param_start2 + param_W2 + inlet_waveform;
W[1] = W[0] + step1;
for (i = 0; i < 2; i++) {
W[i] = W[i] < 0 ? -W[i] : W[i];
W[i] = (W[i] - (W[i] / attr_table.Waveforms) * attr_table.Waveforms);
W[i] = W[i] * attr_table.LENGTH;
}
outlet_div = param_quant2;
int32_t W2 = param_W1 + inlet_waveform;
W2 = W2 - W2 / attr_table.Waveforms * attr_table.Waveforms;
W2 = W2 << attr_table.LENGTHPOW;
int32_t noise;
if ((phase1 < (1 << 31)) && !STrig) {
STrig = 1;
if (SS > 0) {
dir = -dir;
}
noise = ___SMMUL((int32_t)(GenerateRandomNumber() >> 2), Noise << 3);
} else if ((phase1 > (1 << 31)) && STrig) {
STrig = 0;
}
phase1 += freq1 + ___SMMUL(FMW1 << 3, mix[1] << 2);
uint32_t p1 = (phase1 >> 32 - attr_table.LENGTHPOW);
uint32_t Mit = ((phase1 << attr_table.LENGTHPOW) >> 2) & 0x3FFFFFFF;
phase2 += (freq2 + ___SMMUL(FMW2 << 3, mix[0] << 2)) * dir;
uint32_t p2 = (phase2 >> 32 - attr_table.LENGTHPOW);
uint32_t MiT = ((phase2 << attr_table.LENGTHPOW) >> 2) & 0x3FFFFFFF;
int32_t out1;
int32_t out2;
int32_t out3;
out1 = ___SMMUL(attr_table.array[p1 + W[0]] << 2, (1 << 30) - Mit);
out1 += ___SMMUL(
attr_table.array[((p1 + 1) & attr_table.LENGTHMASK) + W[0]] << 2, Mit);
out2 = ___SMMUL(attr_table.array[p1 + W[1]] << 2, (1 << 30) - Mit);
out2 += ___SMMUL(
attr_table.array[((p1 + 1) & attr_table.LENGTHMASK) + W[1]] << 2, Mit);
out3 = ___SMMUL(attr_table.array[p2 + W2] << 2, (1 << 30) - MiT);
out3 += ___SMMUL(attr_table.array[((p2 + 1) & attr_table.LENGTHMASK) + W2] << 2,
MiT);
tablemix(0, out1, out2, MIX1a);
mix[1] = out3 + noise;
mix[0] = ___SMMUL(mix[0] << 2, mix[1] << 2);
val1 = ___SMMLA((mix[0] - val1) << 1, HP, val1);
mix[0] = (mix[0]) - val1;
outlet_out = ___SMMUL(mix[0] << 3, env << 3);