handle-control-change

copsmusic/midi-basic/handle-control-change

Analyze if the MIDI msg is a CC msg and send output CC data
handle-control-change
@/handle-control-change
Analyze if the MIDI msg is a CC msg and send output CC data
TRGpulse
Trigger the MIDI CC message analyzer when a MIDI message is received
CH_INnumber
Channel of the msg
Typenumber
Type of the msg
Data1number
First part of the midi msg
Data2number
Second part of the MIDI msg
handle-control-change
TRG
CH_IN
Type
Data1
Data2
CC
CH
CtlNum
CtlVal
CtlValnumber
Controller Value 0-127
CtlNumnumber
Controller Number
CHnumber
Channel
CCpulse
Triggered when a CC is detected
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 data2;
    int channel;
        
    if (isInputDirty<input_TRG>(ctx)) {

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


        if (type ==176) {     //Control Change
            
            emitValue<output_CH>(ctx,channel);  
            emitValue<output_CtlNum>(ctx,data1);
            emitValue<output_CtlVal>(ctx,data2);
            emitValue<output_CC>(ctx,1);

            /*
            Serial.print("channel = "); Serial.println( channel);
            Serial.print("Controller Number = "); Serial.println( data1);
            Serial.print("Controller Value = "); Serial.println( data2);
*/
        }
    }
}