|
|
@@ -82,16 +82,17 @@ struct MIDI_CC : Module { |
|
|
|
|
|
|
|
void processCC(midi::Message msg) { |
|
|
|
uint8_t cc = msg.getNote(); |
|
|
|
// Allow CC to be negative if the 8th bit is set. |
|
|
|
// The gamepad driver abuses this, for example. |
|
|
|
// Cast uint8_t to int8_t |
|
|
|
int8_t value = msg.bytes[2]; |
|
|
|
value = clamp(value, -127, 127); |
|
|
|
// Learn |
|
|
|
if (learningId >= 0 && values[cc] != msg.data2) { |
|
|
|
if (learningId >= 0 && values[cc] != value) { |
|
|
|
learnedCcs[learningId] = cc; |
|
|
|
learningId = -1; |
|
|
|
} |
|
|
|
// Allow CC to be negative if the 8th bit is set. |
|
|
|
// The gamepad driver abuses this, for example. |
|
|
|
// Cast uint8_t to int8_t |
|
|
|
int8_t value = msg.data2; |
|
|
|
values[cc] = clamp(value, -127, 127); |
|
|
|
values[cc] = value; |
|
|
|
} |
|
|
|
|
|
|
|
json_t *dataToJson() override { |
|
|
|