2to3-pulse-dispenser-with-overflow

bjbaylon/utilities-for-menus/2to3-pulse-dispenser-with-overflow

A patch to assign two input pulses to one of three pssible outputs each with overflow option to chain more dispensers.
2to3-pulse-dispenser-with-overflow
@/2to3-pulse-dispenser-with-overflow
A patch to assign two input pulses to one of three pssible outputs each with overflow option to chain more dispensers.
InApulse
The input pulse to be send to one of the A outputs.
InBpulse
The input pulse to be send to one of the B outputs.
IDXnumber
Index number to select the output that will transmit the IN pulse.
2to3-pulse-dispenser-with-overflow
OA1
OB1
OA2
OB2
OA3
OB3
OVR
InA
InB
IDX
OVRnumber
Output of overflow (IDX - 3) count to additional pulse dispensers.
OB3pulse
Pulse out when there is a pulse on InB and IDX = 3.
OA3pulse
Pulse out when there is a pulse on InA and IDX = 3.
OB2pulse
Pulse out when there is a pulse on InB and IDX = 2.
OA2pulse
Pulse out when there is a pulse on InA and IDX = 2.
OB1pulse
Pulse out when there is a pulse on InB and IDX =1.
OA1pulse
Pulse out when there is a pulse on InA 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);

    emitValue<output_OVR>(ctx, (index - 3));

    if (index < 0){
        return;
    }

     if (isInputDirty<input_InA>(ctx)){
        switch (index) {
            case 0:
                break;
            case 1:
                emitValue<output_OA1>(ctx, true);
                break;
            case 2:
                emitValue<output_OA2>(ctx, true);
                break;
            case 3:
                emitValue<output_OA3>(ctx, true);
                break;
        }
     }

    if (isInputDirty<input_InB>(ctx)){
        switch (index) {
            case 0:
                break;
            case 1:
                emitValue<output_OB1>(ctx, true);
                break;
            case 2:
                emitValue<output_OB2>(ctx, true);
                break;
            case 3:
                emitValue<output_OB3>(ctx, true);
                break;
        }
    }
}