bool32.rising trig
int32 waveform
int32 octave
frac32buffer out
frac32 env
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
frac32.s.map E2C
frac32.s.map waveLvl
frac32.s.map start
frac32.u.map.filterq reso
int32.hradio mode
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;
int32_t tableread(int32_t phase){
};
low = 0;
band = 0;
int32_t F1;
MTOF(-param_Pdec, F1)
int32_t F2;
MTOF(-param_Vdec, F2)
int32_t F3;
MTOF(-param_Ndec, F3)
int32_t F4;
MTOF(-param_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;
}
count += 1;
count = count > param_hold ? param_hold : count;
int32_t LENGTHMASK = attr_table.LENGTHMASK * attr_table.Waveforms;
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(param_gain << 2, VENV << 3) * 3;
int32_t NENV = ___SMMUL(Nenv << 3, Nenv << 2);
NENV = ___SMMUL(NENV << 3, NENV << 2);
NENV = ___SMMUL(NENV << 3, param_noiseLvl << 2);
int32_t WENV = ___SMMUL((1 << 27) - Wenv << 3, param_waveLvl << 2);
WENV = ___SMMUL(WENV << 3, WENV << 2) << 3;
WENV = ___SMMUL(WENV << 3, WENV << 2) << 3;
int32_t freq;
MTOFEXTENDED(param_pitch + ___SMMUL(param_Pamt << 3, PENV << 2), freq)
int32_t damp = (0x80 << 24) - (param_reso << 4);
damp = ___SMMUL(damp, damp);
int32_t alpha;
int32_t fraq;
MTOFEXTENDED(param_cut, alpha);
SINE2TINTERP(alpha, fraq);
int32_t octave = param_octave + inlet_octave;
int32_t cut;
MTOF(param_LP + ___SMMUL(param_E2C << 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) - (param_cut + (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 > 0 ? param_mode : 0) {
case 0:
out = low;
break;
case 1:
out = high;
break;
case 2:
out = band;
break;
case 3:
out = notch;
break;
default:
out = low;
break;
}
noise = out << 4;
phase += freq;
table = ___SMMUL(attr_table.array[((((phase + (param_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, param_sineLvl << 2) +
(___SMMUL((noise >> 2) +
(___SMMUL(noise, Noise << 3) << 3),
NENV << 2) +
table)
<< 2,
VENV << 2)
<< 1,
28);
val = ___SMMLA((wave - val) << 1, cut, val);
outlet_out = val;