; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! no edit below here ....
MidiMsgDetect(hInput,midiMsg,wMsg) ; Midi input section in "under the hood" calls this function each time a midi message is received. Then the midi message is broken up into parts for manipulation. See http://www.midi.org/techspecs/midimessages.php (decimal values).
{
globalstatusbyte,chan,note,cc,byte1,byte2,stb
statusbyte:=midiMsg&0xFF ; EXTRACT THE STATUS BYTE (WHAT KIND OF MIDI MESSAGE IS IT?)
chan:=(statusbyte&0x0f)+1 ; WHAT MIDI CHANNEL IS THE MESSAGE ON?
byte1:=(midiMsg>>8)&0xFF ; THIS IS DATA1 VALUE = NOTE NUMBER OR CC NUMBER
byte2:=(midiMsg>>16)&0xFF ; DATA2 VALUE IS NOTE VELEOCITY OR CC VALUE
pitchb:=(byte2<<7)|byte1 ;(midiMsg >> 8) & 0x7F7F masking to extract the pbs
if statusbytebetween176and191 ; test for cc
stb:="CC" ; if so then set stp to cc
if statusbytebetween144and159
stb:="NoteOn"
if statusbytebetween128and143
stb:="NoteOff"
if statusbytebetween224and239
stb:="PitchB"
gosub,ShowMidiInMessage ; show updated midi input message on midi monitor gui.
gosub,MidiRules ; run the label in file MidiRules.ahk Edit that file.