unpack-message

e/midi/unpack-message

Unpacks type, channel number and data bytes from a MIDI message
unpack-message
@/unpack-message
Unpacks type, channel number and data bytes from a MIDI message
MSG@/message
unpack-message
TYPE
CH
D1
D2
MSG
D2byte
Second data byte
D1byte
First data byte
CHbyte
Channel number
TYPEbyte
Message type
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

node {
    void evaluate(Context ctx) {
        auto msg = getValue<input_MSG>(ctx);

        emitValue<output_TYPE>(ctx, msg.type);
        emitValue<output_CH>(ctx, msg.channel);
        emitValue<output_D1>(ctx, msg.data1);
        emitValue<output_D2>(ctx, msg.data2);
    }
}