pulse-on-change(byte)

xod/core/pulse-on-change(byte)

Emits a pulse every time input value changes.
pulse-on-change(byte)
@/pulse-on-change(byte)
Emits a pulse every time input value changes.
INbyte
pulse-on-change(byte)
OUT
IN
OUTpulse

C++ implementation

node {
    uint8_t sample = 0;

    void evaluate(Context ctx) {
        auto newValue = getValue<input_IN>(ctx);

        if (!isSettingUp() && newValue != sample)
            emitValue<output_OUT>(ctx, 1);

        sample = newValue;
    }
}

Tabular tests

INOUT
00hno-pulse
01hpulse
0Chpulse
0Chno-pulse
00010111bpulse
17hno-pulse
23dno-pulse