int32 length in kticks
int32 adds to 'factor'
bool32.risingfalling or 'mode'
bool32.rising reset phase
frac32 phase 0. till 64.
int32 step index from 0 to 'steps'
bool32.pulse 24 ppq pulse
bool32.tgl 0 = multiply, 1 = divide
int32 multiplication or division factor
combo how many steps per bar?
uint32_t Phase;
uint32_t r;
uint64_t freq;
uint32_t base;
uint8_t factor;
uint8_t steps;
uint32_t prev;
uint32_t ppq;
Phase = 0;
r = 1;
factor = inlet_factor + param_factor;
base = (param_mode || inlet_mode) ? (inlet_kticks * factor)
: (inlet_kticks / factor);
freq = (int)(281474976710656.f / (base * (128 << 7)));
steps = 29 - attr_steps;
{
if (inlet_reset && r) {
Phase = 0;
r = 0;
} else {
if (!inlet_reset)
r = 1;
Phase += freq >> 2;
}
outlet_phase = (Phase >> 5);
outlet_step = (Phase >> steps);
ppq = ((Phase >> 25) * 3) >> 2;
if (ppq != prev) {
outlet_24ppq = 1;
prev = ppq;
} else
outlet_24ppq = 0;
}