|
50 | 50 | #ifdef ML_SYNTH_INLINE_DECLARATION |
51 | 51 |
|
52 | 52 |
|
53 | | -void Midi_Setup(); |
54 | | -void Midi_Process(); |
| 53 | +#define MIDI_CHANNEL_MASK 0x10 |
| 54 | +#define MIDI_CHANNEL_0 0x01 |
| 55 | +#define MIDI_CHANNEL_1 0x02 |
| 56 | +#define MIDI_CHANNEL_2 0x04 |
| 57 | +#define MIDI_CHANNEL_3 0x08 |
| 58 | + |
| 59 | + |
| 60 | +void Midi_Setup(void); |
| 61 | +void Midi_Process(void); |
55 | 62 |
|
56 | 63 | #ifdef MIDI_VIA_USB_ENABLED |
57 | 64 | void Midi_HandleShortMsg(uint8_t *data, uint8_t cable __attribute__((unused))); |
@@ -270,7 +277,10 @@ inline void Midi_CC_Map(uint8_t channel, uint8_t data1, uint8_t data2, struct mi |
270 | 277 | { |
271 | 278 | for (int i = 0; i < mapSize; i++) |
272 | 279 | { |
273 | | - if ((controlMapping[i].channel == channel) && (controlMapping[i].data1 == data1)) |
| 280 | + if ( |
| 281 | + ((controlMapping[i].channel == channel) && (controlMapping[i].data1 == data1)) |
| 282 | + || (((controlMapping[i].channel & 0x10) != 0) && ((controlMapping[i].channel & (1 << channel)) != 0) && (controlMapping[i].data1 == data1)) |
| 283 | + ) |
274 | 284 | { |
275 | 285 | if (controlMapping[i].callback_mid != NULL) |
276 | 286 | { |
@@ -479,8 +489,12 @@ void Midi_Setup() |
479 | 489 | Serial1.begin(MIDI_SERIAL1_BAUDRATE, SERIAL_8N1, MIDI_RX1_PIN); |
480 | 490 | #endif |
481 | 491 | pinMode(MIDI_RX1_PIN, INPUT_PULLUP); /* can be connected to open collector output */ |
| 492 | +#else |
| 493 | +#ifdef TEENSYDUINO |
| 494 | + Serial.printf("Setup Serial1 with %d baud with rx: RX1 pin (PIN 0)\n", MIDI_SERIAL1_BAUDRATE); |
482 | 495 | #else |
483 | 496 | Serial.printf("Setup Serial1 with %d baud with rx: RX1 pin\n", MIDI_SERIAL1_BAUDRATE); |
| 497 | +#endif |
484 | 498 | Serial1.begin(MIDI_SERIAL1_BAUDRATE); |
485 | 499 | #endif |
486 | 500 |
|
|
0 commit comments