pass-if

xod/stream/pass-if

Lets values pass through only if COND is true
pass-if
@/pass-if
Lets values pass through only if COND is true
IN1generic t1
A value to be pushed through
IN2pulse
Try to push a new value through
CONDboolean
Decides whether values should be let through
pass-if
OUT1
OUT2
IN1
IN2
COND
OUT2pulse
Pulses when a value passes through
OUT1generic t1
A value that passed through

C++ implementation

#pragma XOD evaluate_on_pin disable
#pragma XOD evaluate_on_pin enable input_IN2

node {
    void evaluate(Context ctx) {
        if (!getValue<input_COND>(ctx))
            return;

        if (!isInputDirty<input_IN2>(ctx))
            return;

        emitValue<output_OUT1>(ctx, getValue<input_IN1>(ctx));
        emitValue<output_OUT2>(ctx, 1);
    }
}