handle-aftertouch-channel-pressure

copsmusic/midi-basic/handle-aftertouch-channel-pressure

Analyze if the MIDI msg is a channel aftertouch msg and send output channel aftertouch data
handle-aftertouch-channel-pressure
@/handle-aftertouch-channel-pressure
Analyze if the MIDI msg is a channel aftertouch msg and send output channel aftertouch data
TRGpulse
Trigger the node when a message is received for analyse
CH_INnumber
Channel of the msg
Typenumber
Type of the msg
Data1number
handle-aftertouch-channel-pressure
Sent
CH
Vel
TRG
CH_IN
Type
Data1
Velnumber
Velocity of the aftertouch
CHnumber
Channel
Sentpulse
Triggered when channel pressure aftertouch is sent
To use the node in your project you should have the copsmusic/midi-basic 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 type;
    int data1;
    int channel;
        
    if (isInputDirty<input_TRG>(ctx)) {

        channel = getValue<input_CH_IN>(ctx);
        type    = getValue<input_Type>(ctx);
        data1   = getValue<input_Data1>(ctx);

        if (type == 208) {     //Aftertouch
            
            emitValue<output_CH>(ctx,channel);  
            emitValue<output_Vel>(ctx,data1);
            emitValue<output_Sent>(ctx,1);
        }
    }
}