Pulse when moving the current position from MAX to MIN.
PREVpulse
Pulse when moving the current position from MIN to MAX.
CURRnumber
The current position.
To use the node in your project you should have the wkov/colony library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.
C++ implementation
#pragma XOD dirtieness disable
node {
void evaluate(Context ctx) {
Number pos;
if (isSettingUp() || isInputDirty<input_RST>(ctx)) {
emitValue<output_DONE>(ctx, true);
pos = getValue<input_POS>(ctx);
} else {
pos = getValue<output_CURR>(ctx);
}
auto min = getValue<input_MIN>(ctx);
auto max = getValue<input_MAX>(ctx);
if (isInputDirty<input_FWD>(ctx)) {
if (++pos > max) {
emitValue<output_NEXT>(ctx, true);
pos = min;
}
} else if (isInputDirty<input_BWD>(ctx)) {
if (--pos < min) {
emitValue<output_PREV>(ctx, true);
pos = max;
}
} else {
if (pos > max) {
pos = max;
} else if (pos < min) {
pos = min;
}
}
emitValue<output_CURR>(ctx, pos);
}
}