MCPcopy Create free account
hub / github.com/VCVRack/Rack / processMessage

Method processMessage

src/core/MIDI_Gate.cpp:100–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98 }
99
100 void processMessage(const midi::Message& msg) {
101 switch (msg.getStatus()) {
102 // note off
103 case 0x8: {
104 releaseNote(msg.getChannel(), msg.getNote());
105 } break;
106 // note on
107 case 0x9: {
108 uint8_t velocity = msg.getValue();
109 if (velocity > 0) {
110 pressNote(msg.getChannel(), msg.getNote(), velocity);
111 }
112 else {
113 // Note-on event with velocity 0 is an alternative for note-off event.
114 releaseNote(msg.getChannel(), msg.getNote());
115 }
116 } break;
117 // polyphonic pressure/aftertouch
118 case 0xa: {
119 if (velocityMode == AFTERTOUCH_MODE) {
120 uint8_t c = mpeMode ? msg.getChannel() : 0;
121 uint8_t note = msg.getNote();
122 uint8_t velocity = msg.getValue();
123 for (int i = 0; i < 16; i++) {
124 if (learnedNotes[i] == note) {
125 velocities[i][c] = velocity;
126 }
127 }
128 }
129 } break;
130 // channel pressure/aftertouch
131 case 0xd: {
132 if (velocityMode == AFTERTOUCH_MODE) {
133 uint8_t c = mpeMode ? msg.getChannel() : 0;
134 uint8_t velocity = msg.getNote();
135 for (int i = 0; i < 16; i++) {
136 velocities[i][c] = velocity;
137 }
138 }
139 } break;
140 default: break;
141 }
142 }
143
144 void pressNote(uint8_t channel, uint8_t note, uint8_t vel) {
145 int c = mpeMode ? channel : 0;

Callers

nothing calls this directly

Calls 4

getStatusMethod · 0.80
getNoteMethod · 0.80
getChannelMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected