bool32.rising trigger
bool32.rising reset
bool32 active
frac32.positive wave
bool32 gate
spinner steps
spinner hits
bool32 bit
int res;
int gate;
int bit;
int steps;
int hits;
int nx;
int ny;
int tx;
int ty;
gate = 0;
res = 0;
bit = 0;
steps = attr_steps;
hits = attr_hits;
tx = 0;
ty = 0;
if (inlet_active > 0) {
if ((inlet_trig > 0) && !gate) {
nx = tx;
ny = ty;
if (ny == 0) {
tx = 1 + (GenerateRandomNumber() % steps);
ty = hits;
bit = 1;
} else {
tx = ny;
ty = nx % ny;
bit = 0;
}
gate = 1;
}
else if (!(inlet_trig > 0))
gate = 0;
outlet_gate = bit;
disp_bit = bit;
outlet_wave = nx * (1 << 22);
}
else {
outlet_wave = 0;
outlet_gate = 0;
}
if ((inlet_rst > 0) && !res) {
tx = 0;
ty = 0;
bit = 0;
res = 1;
}
else if (!(inlet_rst > 0))
res = 0;