bool32.rising uses a gate/trigger signal (eg for sequencers)
bool32 resets internal 1st/2nd trigger counter
int32 sets swing position (the higher the value, the later the 2nd trigger will be generated)
bool32.pulse trigOut
int32 swing
int array1[64];
int16_t cnt;
int cot;
int ttrig;
int dtrig;
int swingOn;
int gtrig;
int16_t swingsize;
cnt = 999;
outlet_trigOut = 0;
cnt += 1;
cnt = cnt > 999 ? 999 : cnt;
if ((inlet_trigIn > 0) && (!(ttrig))) {
swingsize = inlet_swing + param_swing;
ttrig = 1;
cot += 1;
cot = cot & 1;
if (cot == 1) {
cnt = 0;
} else if (cot == 0) {
outlet_trigOut = 1;
}
} else if (!(inlet_trigIn > 0)) {
ttrig = 0;
}
swingOn = (cnt > (swingsize));
if (swingOn && (!(dtrig))) {
dtrig = 1;
gtrig = 1;
} else {
gtrig = 0;
if (!(swingOn > 0))
dtrig = 0;
}
outlet_trigOut += gtrig;