int32 24ppq
frac32buffer o
bool ptrig = 0;
int32_t phasor1 = 0;
int32_t phasor2 = 0;
int32_t ramp = 0;
int stage = 0;
int factor = 24;
int ppq = inlet_24ppq;
int32_t factor4 = factor << 2;
if (factor4 * (ppq / (factor4)) == ppq && !ptrig) {
ptrig = 1;
stage = 1;
ramp = 1 << 27;
} else if (factor * (ppq / factor) == ppq && !ptrig) {
ptrig = 1;
stage = 2;
ramp = 0b00001000000000000000000000000000;
} else if (!((factor * (ppq / factor)) == ppq))
ptrig = 0;
if (stage)
;
ramp -= 0b00000000000110000000000000000000;
if (ramp < 0) {
ramp = 0;
stage = 0;
}
phasor1 += 0b000000010100000000000000000000000;
phasor2 += 0b000000001010000000000000000000000;
outlet_o = ___SMMUL(ramp, stage == 0 ? 0 : (stage == 1 ? phasor1 : phasor2));