branch

xod/core/branch

Routes an incoming pulse to either of outputs depending on condition
branch
@/branch
Routes an incoming pulse to either of outputs depending on condition
GATEboolean
Value which defines the route for an input pulse
TRIGpulse
Input pulse
branch
GATE
TRIG
T
F
Fpulse
Pulses with `TRIG` when `GATE` is false
Tpulse
Pulses with `TRIG` when `GATE` is true

C++ implementation

#pragma XOD evaluate_on_pin disable
#pragma XOD evaluate_on_pin enable input_TRIG

node {
    void evaluate(Context ctx) {
        if (!isInputDirty<input_TRIG>(ctx))
            return;

        if (getValue<input_GATE>(ctx)) {
            emitValue<output_T>(ctx, 1);
        } else {
            emitValue<output_F>(ctx, 1);
        }
    }
}