bool32.rising trigger
frac32 pitch modulation
frac32buffer audio output
frac32.u.map amplitude decay
frac32.u.map pitch envelope decay
frac32.u.map pitch envelope amount
frac32.s.map.pitch basic tuning
frac32.u.map.gain amount of click at the beginning of the kick
int32_t envcounter = 0;
int32_t pitchenvcounter = 0;
int32_t k_decay;
int32_t k_pitchdecay;
int32_t k_pitchenv;
int32_t k_basepitch;
int32_t pitch;
int32_t phasor = 0;
int32_t r;
bool ttrig = 0;
k_decay = ((8500000 - (param_decay >> 4)));
k_pitchdecay = ((8500000 - (param_pitchdecay >> 4)));
k_pitchenv = (param_pitchenvamt << 4);
MTOF(param_basepitch + inlet_pitch, k_basepitch);
if (inlet_t && !ttrig) {
envcounter = (1 << 27);
pitchenvcounter = (1 << 27);
phasor = param_click >> 1;
ttrig = 1;
} else if (!inlet_t)
ttrig = 0;
envcounter = ___SMMLS(envcounter, k_decay, envcounter);
pitchenvcounter = ___SMMLS(pitchenvcounter, k_pitchdecay, pitchenvcounter);
SINE2TINTERP(phasor, r);
r = ___SMMUL(r, envcounter);
pitch = ___SMMLA(pitchenvcounter, k_pitchenv, k_basepitch);
phasor += pitch;
outlet_out = r;