Skip to content

Commit 05606ab

Browse files
support MIDI channel masking
add info text using teensy
1 parent cddecc6 commit 05606ab

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

src/audio_module.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,11 @@ static int16_t *queueTransmitBuffer2;
290290

291291
void Teensy_Setup()
292292
{
293-
#ifdef LED_PIN
294-
pinMode(ledPin, OUTPUT);
295-
#endif
293+
Serial.printf("Teensy Setup\n");
294+
Serial.printf("\tBCK: 21\n");
295+
Serial.printf("\tLRCK: 20\n");
296+
Serial.printf("\tSDOUT: 7\n");
297+
Serial.printf("AudoBlockSamples: %d\n", AUDIO_BLOCK_SAMPLES);
296298
Midi_Setup();
297299
}
298300

src/midi_interface.h

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,15 @@
5050
#ifdef ML_SYNTH_INLINE_DECLARATION
5151

5252

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);
5562

5663
#ifdef MIDI_VIA_USB_ENABLED
5764
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
270277
{
271278
for (int i = 0; i < mapSize; i++)
272279
{
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+
)
274284
{
275285
if (controlMapping[i].callback_mid != NULL)
276286
{
@@ -479,8 +489,12 @@ void Midi_Setup()
479489
Serial1.begin(MIDI_SERIAL1_BAUDRATE, SERIAL_8N1, MIDI_RX1_PIN);
480490
#endif
481491
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);
482495
#else
483496
Serial.printf("Setup Serial1 with %d baud with rx: RX1 pin\n", MIDI_SERIAL1_BAUDRATE);
497+
#endif
484498
Serial1.begin(MIDI_SERIAL1_BAUDRATE);
485499
#endif
486500

0 commit comments

Comments
 (0)