bool32.rising trig
int32 hold
int32 waveform
int32 octave
int32 mode
frac32 Vdec
frac32 Pdec
frac32 Ndec
frac32 Watt
frac32 pitch
frac32 Pamt
frac32 E2C
frac32 sineLvl
frac32 waveLvl
frac32 noiseLvl
frac32 cut
frac32 reso
frac32 start
frac32 gain
frac32 LP
frac32buffer out
frac32 env
frac32.s.map waveLvl
frac32.s.map E2C
frac32.s.map start
frac32.u.map.filterq reso
int32.hradio mode
int32 hold
int32 wave
int32 octave
frac32.u.map.kdecaytime Vdec
frac32.u.map.kdecaytime Pdec
frac32.u.map.kdecaytime Ndec
frac32.u.map.kdecaytime Watt
frac32.s.map.pitch pitch
frac32.s.map.pitch cut
frac32.s.map.pitch LP
frac32.u.map Pamt
frac32.u.map sineLvl
frac32.u.map noiseLvl
frac32.u.map gain
objref table
uint32_t phase;
int32_t sine;
int32_t read;
uint32_t Penv;
uint32_t Venv;
uint32_t Nenv;
uint32_t Wenv;
int gtrig;
int Gtrig;
int32_t noise;
int32_t val;
int32_t table;
int32_t preset;
int32_t count;
int32_t low;
int32_t band;
low = 0;
band = 0;
int32_t F1;
MTOF(-param_Pdec - inlet_Pdec, F1)
int32_t F2;
MTOF(-param_Vdec - inlet_Vdec, F2)
int32_t F3;
MTOF(-param_Ndec - inlet_Ndec, F3)
int32_t F4;
MTOF(-param_Watt - inlet_Watt, F4)
if (count >= param_hold) {
Penv = ___SMMLA(-Penv << 1, F1 << 1, Penv);
Venv = ___SMMLA(-Venv << 1, F2 << 1, Venv);
Nenv = ___SMMLA(-Nenv << 1, F3 << 1, Nenv);
Wenv = ___SMMLA(-Wenv << 1, F4 << 1, Wenv);
}
if ((inlet_trig > 0) && !gtrig) {
gtrig = 1;
Penv = (1 << 27);
Venv = (1 << 27);
Nenv = (1 << 27);
Wenv = (1 << 27);
count = 0;
} else if (inlet_trig == 0) {
gtrig = 0;
}
int hold = param_hold + inlet_hold;
count += 1;
count = count > hold ? hold : count;
int32_t PENV = Penv;
//___SMMUL(Penv<<3,Penv<<2);
PENV = ___SMMUL(PENV << 3, PENV << 2);
int32_t VENV = Venv;
VENV = ___SMMUL(VENV << 3, VENV << 2);
VENV += ___SMMUL(__USAT(param_gain + inlet_gain, 27) << 2, VENV << 3) * 3;
int32_t NENV = ___SMMUL(Nenv << 3, Nenv << 2);
NENV = ___SMMUL(NENV << 3, NENV << 2);
NENV = ___SMMUL(NENV << 3, (__USAT(param_noiseLvl + inlet_noiseLvl, 27)) << 2);
int32_t WENV = ___SMMUL((1 << 27) - Wenv << 3,
__USAT(param_waveLvl + inlet_waveLvl, 27) << 2);
WENV = ___SMMUL(WENV << 3, WENV << 2) << 3;
int32_t freq;
MTOFEXTENDED(param_pitch + inlet_pitch +
___SMMUL(__USAT(param_Pamt + inlet_Pamt, 27) << 3, PENV << 2),
freq)
int32_t damp = (0x80 << 24) - (__USAT(param_reso + inlet_reso, 27) << 4);
damp = ___SMMUL(damp, damp);
int32_t alpha;
int32_t fraq;
MTOFEXTENDED(__SSAT(param_cut + inlet_cut +
___SMMUL(__SSAT(param_E2C + inlet_E2C, 28) << 3,
VENV << 2),
28),
alpha);
SINE2TINTERP(alpha, fraq);
int32_t octave = param_octave + inlet_octave;
int32_t sineLvl = __USAT(param_sineLvl + inlet_sineLvl, 27);
int32_t cut;
MTOF(param_LP + ___SMMUL(__SSAT(param_E2C + inlet_E2C, 28) << 3, VENV << 2),
cut)
preset = (param_wave + inlet_waveform);
preset = preset - preset / attr_table.Waveforms * attr_table.Waveforms;
preset = preset << attr_table.LENGTHPOW;
outlet_env = Penv;
int32_t Noise = (1 << 28) - (__SSAT(param_cut + inlet_cut, 28) + (1 << 27));
if ((inlet_trig > 0) && !Gtrig) {
Gtrig = 1;
phase = 0;
} else if (inlet_trig == 0) {
Gtrig = 0;
}
noise = (int32_t)(GenerateRandomNumber()) >> 5;
int32_t notch = (noise) - (___SMMUL(damp, band) << 1);
low = low + (___SMMUL(fraq, band) << 1);
int32_t high = notch - low;
band = (___SMMUL(fraq, high) << 1) + band;
int32_t out;
switch ((param_mode + inlet_mode) & 3) {
case 0:
out = low;
break;
case 1:
out = high;
break;
case 2:
out = band;
break;
case 3:
out = notch;
break;
}
noise = out << 4;
phase += freq;
table =
___SMMUL(attr_table.array[((((phase + (param_start + inlet_start << 5)) >>
32 - attr_table.LENGTHPOW - octave) &
attr_table.LENGTHMASK) +
preset)]
<< 4,
WENV)
<< 1;
SINE2TINTERP(phase, sine)
int32_t wave;
wave = __SSAT(___SMMUL(___SMMUL(sine >> 2, sineLvl << 2) +
(___SMMUL((noise >> 2) +
(___SMMUL(noise, Noise << 3) << 3),
NENV << 2) +
table)
<< 2,
VENV << 2)
<< 1,
27);
val = ___SMMLA((wave - val) << 1, cut, val);
outlet_out = val;