countupdown

gst/countupdown/countupdown

No description
countupdown
@/countupdown
STEPnumber
INCpulse
DECpulse
RSTpulse
OFFSETnumber
PRESETpulse
countupdown
OUT
STEP
INC
DEC
RST
OFFSET
PRESET
OUTnumber
To use the node in your project you should have the gst/countupdown 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

node {
    void evaluate(Context ctx) {
        Number count = getValue<output_OUT>(ctx);

        if (isInputDirty<input_RST>(ctx))
            count = 0;
        else if (isInputDirty<input_PRESET>(ctx))
            count = getValue<input_OFFSET>(ctx);
        
        
        else if (isInputDirty<input_INC>(ctx))
            count += getValue<input_STEP>(ctx);
        else if ( isInputDirty<input_DEC>(ctx))
            count -= getValue<input_STEP>(ctx);
        emitValue<output_OUT>(ctx, count);
    }
}