filter-by-channel

e/midi/filter-by-channel

Allows only messages with a specific channel to pass through. If a message is not channel specific (like system messages), it will still be let through.
filter-by-channel
@/filter-by-channel
Allows only messages with a specific channel to pass through. If a message is not channel specific (like system messages), it will still be let through.
CHnumber
Messages with this channel number will be let through
MSG@/message
INpulse
filter-by-channel
OUT
IN
FMSG
CH
MSG
OUTpulse
Pulses when a new message is passed through
FMSG@/message
Filtered message
To use the node in your project you should have the e/midi 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 }}

bool isChannelMessage(uint8_t msgType) {
    return msgType >= 0x80 && msgType <= 0xE0;
}

void evaluate(Context ctx) {
    if (!isInputDirty<input_IN>(ctx))
        return;

    auto desiredChannel = getValue<input_CH>(ctx);
    auto msg = getValue<input_MSG>(ctx);

    if (!isChannelMessage(msg.type) || msg.channel == desiredChannel) {
        emitValue<output_FMSG>(ctx, msg);
        emitValue<output_OUT>(ctx, 1);
    }
}