frac32 frequency
bool32.rising reset phase
bool32.pulse trg1
bool32 trg2
frac32 sin
uint32_t Phase;
uint32_t r;
uint32_t h;
int trg1;
int trg2;
int trg3;
int trg4;
Phase = 0;
r = 1;
int32_t wave;
if (inlet_reset && r) {
Phase = 0;
r = 0;
} else {
if (!inlet_reset)
r = 1;
Phase += ((inlet_Hz) / 44 * 30);
}
wave = (Phase >> 5);
trg1 = (wave > (1 << 26)) ? (1 << 27) : 0;
trg2 = (1 << 27) - trg1;
outlet_trg1 = trg1 * ((trg3 == 0) ? 1 : 0);
outlet_trg2 = trg2 * ((trg4 == 0) ? 1 : 0);
trg3 = trg1;
trg4 = trg2;
int32_t Sin;
SINE2TINTERP(Phase - (1 << 29), Sin)
outlet_sin = -(Sin >> 5) + (1 << 26);