bool32.rising button
bool32.pulse update
bool32.pulse loopupdate
bool32 short1
bool32 short2
bool32 short3
bool32 short4
bool32 long
bool32 verylong
int32 count
int32 clicks
int32 time
int32_t count;
int32_t held;
int32_t Held;
int hold1;
int hold2;
int preprint;
int prevprint;
int print;
int Clicks;
int clicks;
int trig;
int ttrig;
int HOLD;
int prevtrig;
int Short1;
int Short2;
int Short3;
int Short4;
if (inlet_button > 0) {
held += 1;
Held = held;
} else {
held = 0;
}
count += 1;
if ((inlet_button > 0) && (count >= param_time)) {
count = 0;
}
count = count > param_time ? param_time : count;
// print when end is reached
if ((count >= param_time) && (!(ttrig))) {
Clicks = clicks;
clicks = 0;
if (Held >= param_time) {
if (Held < (param_time << 1))
hold1 = hold1 > 0 ? 0 : 1;
if (Held >= (param_time << 1))
hold2 = hold2 > 0 ? 0 : 1;
} else if (Clicks == 1) {
Short1 = Short1 > 0 ? 0 : 1;
}
if (Clicks == 2) {
Short2 = Short2 > 0 ? 0 : 1;
}
if (Clicks == 3) {
Short3 = Short3 > 0 ? 0 : 1;
}
if (Clicks >= 4) {
Short4 = Short4 > 0 ? 0 : 1;
}
ttrig = 1;
} else if (count < param_time) {
ttrig = 0;
}
if ((count < param_time) && (!(trig)) && (inlet_button > 0)) {
clicks += 1;
trig = 1;
} else if (inlet_button == 0) {
trig = 0;
}
outlet_short1 = Short1;
outlet_short2 = Short2;
outlet_short3 = Short3;
outlet_short4 = Short4;
outlet_long = hold1;
outlet_verylong = hold2;
outlet_count = count;
outlet_clicks = Clicks;
outlet_update = ttrig;
outlet_loopupdate = count == 0 ? 1 : 0;
prevtrig = ttrig;