1to7-pulse-dispenser

bjbaylon/utilities-for-menus/1to7-pulse-dispenser

A patch to assign an input pulse to one of seven pssible outputs.
1to7-pulse-dispenser
@/1to7-pulse-dispenser
A patch to assign an input pulse to one of seven pssible outputs.
INpulse
The input pulse to be sended to one of the outputs.
IDXnumber
Index number to select the output that will transmit the IN pulse.
1to7-pulse-dispenser
IN
OUT1
OUT2
OUT3
OUT4
OUT5
OUT6
OUT7
IDX
OUT7pulse
Pulse out when there is a pulse on IN and IDX = 7.
OUT6pulse
Pulse out when there is a pulse on IN and IDX = 6.
OUT5pulse
Pulse out when there is a pulse on IN and IDX = 5.
OUT4pulse
Pulse out when there is a pulse on IN and IDX = 4.
OUT3pulse
Pulse out when there is a pulse on IN and IDX = 3.
OUT2pulse
Pulse out when there is a pulse on IN and IDX =2.
OUT1pulse
Pulse out when there is a pulse on IN and IDX = 1.
To use the node in your project you should have the bjbaylon/utilities-for-menus 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

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    int index = getValue<input_IDX>(ctx);
    if (index < 0  || index > 7){return;}
     if (isInputDirty<input_IN>(ctx)){
        switch (index) {
            case 0:
                break;
            case 1:
                emitValue<output_OUT1>(ctx, true);
                break;
            case 2:
                emitValue<output_OUT2>(ctx, true);
                break;
            case 3:
                emitValue<output_OUT3>(ctx, true);
                break;
            case 4:
                emitValue<output_OUT4>(ctx, true);
                break;
            case 5:
                emitValue<output_OUT5>(ctx, true);
                break;
            case 6:
                emitValue<output_OUT6>(ctx, true);
                break;
            case 7:
                emitValue<output_OUT7>(ctx, true);
                break;
            case 8:
                break;
        }
     }
}