|
|
@ -33,8 +33,7 @@ extern config_t configuration; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
// override default sysex size settings
|
|
|
|
// override default sysex size settings
|
|
|
|
struct MicroDexedSettings : public midi::DefaultSettings |
|
|
|
struct MicroDexedSettings : public midi::DefaultSettings { |
|
|
|
{ |
|
|
|
|
|
|
|
static const unsigned SysExMaxSize = 4104; // Accept SysEx messages up to 1024 bytes long.
|
|
|
|
static const unsigned SysExMaxSize = 4104; // Accept SysEx messages up to 1024 bytes long.
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -71,38 +70,37 @@ void MD_sendControlChange(uint8_t channel, uint8_t cc, uint8_t value); |
|
|
|
#define MIDI_BY_USB_HOST "MIDI_USB_HOST" |
|
|
|
#define MIDI_BY_USB_HOST "MIDI_USB_HOST" |
|
|
|
#define MIDI_BY_USB "USB_MIDI" |
|
|
|
#define MIDI_BY_USB "USB_MIDI" |
|
|
|
|
|
|
|
|
|
|
|
void handle_generic(byte inChannel, byte inData1, byte inData2, const char *midi_device, midi::MidiType event) |
|
|
|
void handle_generic(byte inChannel, byte inData1, byte inData2, const char *midi_device, midi::MidiType event) { |
|
|
|
{ |
|
|
|
|
|
|
|
char text[10]; |
|
|
|
char text[10]; |
|
|
|
|
|
|
|
|
|
|
|
switch(event) { |
|
|
|
switch (event) { |
|
|
|
case midi::NoteOn: |
|
|
|
case midi::NoteOn: |
|
|
|
handleNoteOn(inChannel, inData1, inData2); |
|
|
|
handleNoteOn(inChannel, inData1, inData2); |
|
|
|
strlcpy(text, "NoteOn",sizeof(text)); |
|
|
|
strlcpy(text, "NoteOn", sizeof(text)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case midi::NoteOff: |
|
|
|
case midi::NoteOff: |
|
|
|
handleNoteOff(inChannel, inData1, inData2); |
|
|
|
handleNoteOff(inChannel, inData1, inData2); |
|
|
|
strlcpy(text, "NoteOff",sizeof(text)); |
|
|
|
strlcpy(text, "NoteOff", sizeof(text)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case midi::ControlChange: |
|
|
|
case midi::ControlChange: |
|
|
|
handleControlChange(inChannel, inData1, inData2); |
|
|
|
handleControlChange(inChannel, inData1, inData2); |
|
|
|
strlcpy(text, "CC",sizeof(text)); |
|
|
|
strlcpy(text, "CC", sizeof(text)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case midi::AfterTouchChannel: |
|
|
|
case midi::AfterTouchChannel: |
|
|
|
handleAfterTouch(inChannel, inData1); |
|
|
|
handleAfterTouch(inChannel, inData1); |
|
|
|
strlcpy(text, "Mono AT",sizeof(text)); |
|
|
|
strlcpy(text, "Mono AT", sizeof(text)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case midi::PitchBend: |
|
|
|
case midi::PitchBend: |
|
|
|
handlePitchBend(inChannel, inData1); |
|
|
|
handlePitchBend(inChannel, inData1); |
|
|
|
strlcpy(text, "PB",sizeof(text)); |
|
|
|
strlcpy(text, "PB", sizeof(text)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case midi::ProgramChange: |
|
|
|
case midi::ProgramChange: |
|
|
|
handleProgramChange(inChannel, inData1); |
|
|
|
handleProgramChange(inChannel, inData1); |
|
|
|
strlcpy(text, "PC",sizeof(text)); |
|
|
|
strlcpy(text, "PC", sizeof(text)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case midi::AfterTouchPoly: |
|
|
|
case midi::AfterTouchPoly: |
|
|
|
handleAfterTouchPoly(inChannel, inData1, inData2); |
|
|
|
handleAfterTouchPoly(inChannel, inData1, inData2); |
|
|
|
strlcpy(text, "Poly AT",sizeof(text)); |
|
|
|
strlcpy(text, "Poly AT", sizeof(text)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
break; |
|
|
|
break; |
|
|
@ -112,11 +110,10 @@ void handle_generic(byte inChannel, byte inData1, byte inData2, const char *midi |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
// MIDI THRU
|
|
|
|
// MIDI THRU
|
|
|
|
if (configuration.sys.soft_midi_thru == 1) |
|
|
|
if (configuration.sys.soft_midi_thru == 1) { |
|
|
|
{ |
|
|
|
|
|
|
|
#ifdef MIDI_DEVICE_USB |
|
|
|
#ifdef MIDI_DEVICE_USB |
|
|
|
if(strcmp(MIDI_BY_USB, midi_device)) { |
|
|
|
if (strcmp(MIDI_BY_USB, midi_device)) { |
|
|
|
switch(event) { |
|
|
|
switch (event) { |
|
|
|
case midi::NoteOn: |
|
|
|
case midi::NoteOn: |
|
|
|
usbMIDI.sendNoteOn(inData1, inData2, inChannel); |
|
|
|
usbMIDI.sendNoteOn(inData1, inData2, inChannel); |
|
|
|
break; |
|
|
|
break; |
|
|
@ -141,15 +138,15 @@ void handle_generic(byte inChannel, byte inData1, byte inData2, const char *midi |
|
|
|
default: |
|
|
|
default: |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.print(F(" THRU->MIDI_USB")); |
|
|
|
Serial.print(F(" THRU->MIDI_USB")); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#ifdef MIDI_DEVICE_DIN |
|
|
|
#ifdef MIDI_DEVICE_DIN |
|
|
|
if(strcmp(MIDI_BY_DIN, midi_device)) { |
|
|
|
if (strcmp(MIDI_BY_DIN, midi_device)) { |
|
|
|
switch(event) { |
|
|
|
switch (event) { |
|
|
|
case midi::NoteOn: |
|
|
|
case midi::NoteOn: |
|
|
|
midi_serial.sendNoteOn(inData1, inData2, inChannel); |
|
|
|
midi_serial.sendNoteOn(inData1, inData2, inChannel); |
|
|
|
break; |
|
|
|
break; |
|
|
@ -174,15 +171,15 @@ void handle_generic(byte inChannel, byte inData1, byte inData2, const char *midi |
|
|
|
default: |
|
|
|
default: |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.print(F(" THRU->MIDI_DIN")); |
|
|
|
Serial.print(F(" THRU->MIDI_DIN")); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#ifdef MIDI_DEVICE_USB_HOST |
|
|
|
#ifdef MIDI_DEVICE_USB_HOST |
|
|
|
if(strcmp(MIDI_BY_USB_HOST, midi_device)) { |
|
|
|
if (strcmp(MIDI_BY_USB_HOST, midi_device)) { |
|
|
|
switch(event) { |
|
|
|
switch (event) { |
|
|
|
case midi::NoteOn: |
|
|
|
case midi::NoteOn: |
|
|
|
midi_usb.sendNoteOn(inData1, inData2, inChannel); |
|
|
|
midi_usb.sendNoteOn(inData1, inData2, inChannel); |
|
|
|
break; |
|
|
|
break; |
|
|
@ -207,9 +204,9 @@ void handle_generic(byte inChannel, byte inData1, byte inData2, const char *midi |
|
|
|
default: |
|
|
|
default: |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.print(F(" THRU->MIDI_USB_HOST")); |
|
|
|
Serial.print(F(" THRU->MIDI_USB_HOST")); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
@ -226,32 +223,31 @@ void handleSystemExclusive_generic(byte *data, uint len, const char *midi_device |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
// MIDI THRU
|
|
|
|
// MIDI THRU
|
|
|
|
if (configuration.sys.soft_midi_thru == 1) |
|
|
|
if (configuration.sys.soft_midi_thru == 1) { |
|
|
|
{ |
|
|
|
|
|
|
|
#ifdef MIDI_DEVICE_USB |
|
|
|
#ifdef MIDI_DEVICE_USB |
|
|
|
if(strcmp(MIDI_BY_USB, midi_device)) { |
|
|
|
if (strcmp(MIDI_BY_USB, midi_device)) { |
|
|
|
usbMIDI.sendSysEx(len, data); |
|
|
|
usbMIDI.sendSysEx(len, data); |
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.print(F(" THRU->MIDI_USB")); |
|
|
|
Serial.print(F(" THRU->MIDI_USB")); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#ifdef MIDI_DEVICE_DIN |
|
|
|
#ifdef MIDI_DEVICE_DIN |
|
|
|
if(strcmp(MIDI_BY_DIN, midi_device)) { |
|
|
|
if (strcmp(MIDI_BY_DIN, midi_device)) { |
|
|
|
midi_serial.sendSysEx(len, data); |
|
|
|
midi_serial.sendSysEx(len, data); |
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.print(F(" THRU->MIDI_DIN")); |
|
|
|
Serial.print(F(" THRU->MIDI_DIN")); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#ifdef MIDI_DEVICE_USB_HOST |
|
|
|
#ifdef MIDI_DEVICE_USB_HOST |
|
|
|
if(strcmp(MIDI_BY_USB_HOST, midi_device)) { |
|
|
|
if (strcmp(MIDI_BY_USB_HOST, midi_device)) { |
|
|
|
midi_usb.sendSysEx(len, data); |
|
|
|
midi_usb.sendSysEx(len, data); |
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.print(F(" THRU->MIDI_USB_HOST")); |
|
|
|
Serial.print(F(" THRU->MIDI_USB_HOST")); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
@ -261,22 +257,21 @@ void handleSystemExclusive_generic(byte *data, uint len, const char *midi_device |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleSystemCommon_generic(byte inData1, const char *midi_device, midi::MidiType event) |
|
|
|
void handleSystemCommon_generic(byte inData1, const char *midi_device, midi::MidiType event) { |
|
|
|
{ |
|
|
|
|
|
|
|
char text[10]; |
|
|
|
char text[10]; |
|
|
|
|
|
|
|
|
|
|
|
switch(event) { |
|
|
|
switch (event) { |
|
|
|
case midi::TimeCodeQuarterFrame: |
|
|
|
case midi::TimeCodeQuarterFrame: |
|
|
|
handleTimeCodeQuarterFrame(inData1); |
|
|
|
handleTimeCodeQuarterFrame(inData1); |
|
|
|
strlcpy(text, "TimeCodeQuarterFrame",sizeof(text)); |
|
|
|
strlcpy(text, "TimeCodeQuarterFrame", sizeof(text)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case midi::SongSelect: |
|
|
|
case midi::SongSelect: |
|
|
|
handleSongSelect(inData1); |
|
|
|
handleSongSelect(inData1); |
|
|
|
strlcpy(text, "SongSelect",sizeof(text)); |
|
|
|
strlcpy(text, "SongSelect", sizeof(text)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case midi::TuneRequest: |
|
|
|
case midi::TuneRequest: |
|
|
|
handleTuneRequest(); |
|
|
|
handleTuneRequest(); |
|
|
|
strlcpy(text, "TuneRequest",sizeof(text)); |
|
|
|
strlcpy(text, "TuneRequest", sizeof(text)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
break; |
|
|
|
break; |
|
|
@ -286,11 +281,10 @@ void handleSystemCommon_generic(byte inData1, const char *midi_device, midi::Mid |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
// MIDI THRU
|
|
|
|
// MIDI THRU
|
|
|
|
if (configuration.sys.soft_midi_thru == 1) |
|
|
|
if (configuration.sys.soft_midi_thru == 1) { |
|
|
|
{ |
|
|
|
|
|
|
|
#ifdef MIDI_DEVICE_USB |
|
|
|
#ifdef MIDI_DEVICE_USB |
|
|
|
if(strcmp(MIDI_BY_USB, midi_device)) { |
|
|
|
if (strcmp(MIDI_BY_USB, midi_device)) { |
|
|
|
switch(event) { |
|
|
|
switch (event) { |
|
|
|
case midi::TimeCodeQuarterFrame: |
|
|
|
case midi::TimeCodeQuarterFrame: |
|
|
|
usbMIDI.sendTimeCodeQuarterFrame(0xF1, inData1); |
|
|
|
usbMIDI.sendTimeCodeQuarterFrame(0xF1, inData1); |
|
|
|
break; |
|
|
|
break; |
|
|
@ -303,15 +297,15 @@ void handleSystemCommon_generic(byte inData1, const char *midi_device, midi::Mid |
|
|
|
default: |
|
|
|
default: |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.print(F(" THRU->MIDI_USB")); |
|
|
|
Serial.print(F(" THRU->MIDI_USB")); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#ifdef MIDI_DEVICE_DIN |
|
|
|
#ifdef MIDI_DEVICE_DIN |
|
|
|
if(strcmp(MIDI_BY_DIN, midi_device)) { |
|
|
|
if (strcmp(MIDI_BY_DIN, midi_device)) { |
|
|
|
switch(event) { |
|
|
|
switch (event) { |
|
|
|
case midi::TimeCodeQuarterFrame: |
|
|
|
case midi::TimeCodeQuarterFrame: |
|
|
|
midi_serial.sendTimeCodeQuarterFrame(inData1); |
|
|
|
midi_serial.sendTimeCodeQuarterFrame(inData1); |
|
|
|
break; |
|
|
|
break; |
|
|
@ -324,15 +318,15 @@ void handleSystemCommon_generic(byte inData1, const char *midi_device, midi::Mid |
|
|
|
default: |
|
|
|
default: |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.print(F(" THRU->MIDI_DIN")); |
|
|
|
Serial.print(F(" THRU->MIDI_DIN")); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#ifdef MIDI_DEVICE_USB_HOST |
|
|
|
#ifdef MIDI_DEVICE_USB_HOST |
|
|
|
if(strcmp(MIDI_BY_USB_HOST, midi_device)) { |
|
|
|
if (strcmp(MIDI_BY_USB_HOST, midi_device)) { |
|
|
|
switch(event) { |
|
|
|
switch (event) { |
|
|
|
case midi::TimeCodeQuarterFrame: |
|
|
|
case midi::TimeCodeQuarterFrame: |
|
|
|
midi_usb.sendTimeCodeQuarterFrame(0xF1, inData1); |
|
|
|
midi_usb.sendTimeCodeQuarterFrame(0xF1, inData1); |
|
|
|
break; |
|
|
|
break; |
|
|
@ -345,9 +339,9 @@ void handleSystemCommon_generic(byte inData1, const char *midi_device, midi::Mid |
|
|
|
default: |
|
|
|
default: |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.print(F(" THRU->MIDI_USB_HOST")); |
|
|
|
Serial.print(F(" THRU->MIDI_USB_HOST")); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
@ -357,34 +351,33 @@ void handleSystemCommon_generic(byte inData1, const char *midi_device, midi::Mid |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleRealtime_generic(const char *midi_device, midi::MidiType event) |
|
|
|
void handleRealtime_generic(const char *midi_device, midi::MidiType event) { |
|
|
|
{ |
|
|
|
|
|
|
|
char text[10]; |
|
|
|
char text[10]; |
|
|
|
|
|
|
|
|
|
|
|
switch(event) { |
|
|
|
switch (event) { |
|
|
|
case midi::Clock: |
|
|
|
case midi::Clock: |
|
|
|
handleClock(); |
|
|
|
handleClock(); |
|
|
|
strlcpy(text, "Clock",sizeof(text)); |
|
|
|
strlcpy(text, "Clock", sizeof(text)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case midi::Start: |
|
|
|
case midi::Start: |
|
|
|
handleStart(); |
|
|
|
handleStart(); |
|
|
|
strlcpy(text, "Start",sizeof(text)); |
|
|
|
strlcpy(text, "Start", sizeof(text)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case midi::Continue: |
|
|
|
case midi::Continue: |
|
|
|
handleContinue(); |
|
|
|
handleContinue(); |
|
|
|
strlcpy(text, "Continue",sizeof(text)); |
|
|
|
strlcpy(text, "Continue", sizeof(text)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case midi::Stop: |
|
|
|
case midi::Stop: |
|
|
|
handleStop(); |
|
|
|
handleStop(); |
|
|
|
strlcpy(text, "Stop",sizeof(text)); |
|
|
|
strlcpy(text, "Stop", sizeof(text)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case midi::ActiveSensing: |
|
|
|
case midi::ActiveSensing: |
|
|
|
handleActiveSensing(); |
|
|
|
handleActiveSensing(); |
|
|
|
strlcpy(text, "ActiveSensing",sizeof(text)); |
|
|
|
strlcpy(text, "ActiveSensing", sizeof(text)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case midi::SystemReset: |
|
|
|
case midi::SystemReset: |
|
|
|
handleSystemReset(); |
|
|
|
handleSystemReset(); |
|
|
|
strlcpy(text, "SystemReset",sizeof(text)); |
|
|
|
strlcpy(text, "SystemReset", sizeof(text)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
break; |
|
|
|
break; |
|
|
@ -394,32 +387,31 @@ void handleRealtime_generic(const char *midi_device, midi::MidiType event) |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
// MIDI THRU
|
|
|
|
// MIDI THRU
|
|
|
|
if (configuration.sys.soft_midi_thru == 1) |
|
|
|
if (configuration.sys.soft_midi_thru == 1) { |
|
|
|
{ |
|
|
|
|
|
|
|
#ifdef MIDI_DEVICE_USB |
|
|
|
#ifdef MIDI_DEVICE_USB |
|
|
|
if(strcmp(MIDI_BY_USB, midi_device)) { |
|
|
|
if (strcmp(MIDI_BY_USB, midi_device)) { |
|
|
|
usbMIDI.sendRealTime(event); |
|
|
|
usbMIDI.sendRealTime(event); |
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.print(F(" THRU->MIDI_USB")); |
|
|
|
Serial.print(F(" THRU->MIDI_USB")); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#ifdef MIDI_DEVICE_DIN |
|
|
|
#ifdef MIDI_DEVICE_DIN |
|
|
|
if(strcmp(MIDI_BY_DIN, midi_device)) { |
|
|
|
if (strcmp(MIDI_BY_DIN, midi_device)) { |
|
|
|
midi_serial.sendRealTime(event); |
|
|
|
midi_serial.sendRealTime(event); |
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.print(F(" THRU->MIDI_DIN")); |
|
|
|
Serial.print(F(" THRU->MIDI_DIN")); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#ifdef MIDI_DEVICE_USB_HOST |
|
|
|
#ifdef MIDI_DEVICE_USB_HOST |
|
|
|
if(strcmp(MIDI_BY_USB_HOST, midi_device)) { |
|
|
|
if (strcmp(MIDI_BY_USB_HOST, midi_device)) { |
|
|
|
midi_usb.sendRealTime(event); |
|
|
|
midi_usb.sendRealTime(event); |
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.print(F(" THRU->MIDI_USB_HOST")); |
|
|
|
Serial.print(F(" THRU->MIDI_USB_HOST")); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
@ -487,43 +479,35 @@ void handleRealtime_generic(const char *midi_device, midi::MidiType event) |
|
|
|
*****************************************/ |
|
|
|
*****************************************/ |
|
|
|
#ifdef MIDI_DEVICE_DIN |
|
|
|
#ifdef MIDI_DEVICE_DIN |
|
|
|
|
|
|
|
|
|
|
|
void handleNoteOn_MIDI_DEVICE_DIN(byte inChannel, byte inNoteNumber, byte inVelocity) |
|
|
|
void handleNoteOn_MIDI_DEVICE_DIN(byte inChannel, byte inNoteNumber, byte inVelocity) { |
|
|
|
{ |
|
|
|
|
|
|
|
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_DIN, midi::NoteOn); |
|
|
|
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_DIN, midi::NoteOn); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleNoteOff_MIDI_DEVICE_DIN(byte inChannel, byte inNoteNumber, byte inVelocity) |
|
|
|
void handleNoteOff_MIDI_DEVICE_DIN(byte inChannel, byte inNoteNumber, byte inVelocity) { |
|
|
|
{ |
|
|
|
|
|
|
|
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_DIN, midi::NoteOff); |
|
|
|
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_DIN, midi::NoteOff); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleControlChange_MIDI_DEVICE_DIN(byte inChannel, byte inData1, byte inData2) |
|
|
|
void handleControlChange_MIDI_DEVICE_DIN(byte inChannel, byte inData1, byte inData2) { |
|
|
|
{ |
|
|
|
|
|
|
|
handle_generic(inChannel, inData1, inData2, MIDI_BY_DIN, midi::ControlChange); |
|
|
|
handle_generic(inChannel, inData1, inData2, MIDI_BY_DIN, midi::ControlChange); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleAfterTouch_MIDI_DEVICE_DIN(byte inChannel, byte inPressure) |
|
|
|
void handleAfterTouch_MIDI_DEVICE_DIN(byte inChannel, byte inPressure) { |
|
|
|
{ |
|
|
|
|
|
|
|
handle_generic(inChannel, inPressure, '\0', MIDI_BY_DIN, midi::AfterTouchChannel); |
|
|
|
handle_generic(inChannel, inPressure, '\0', MIDI_BY_DIN, midi::AfterTouchChannel); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handlePitchBend_MIDI_DEVICE_DIN(byte inChannel, int inPitch) |
|
|
|
void handlePitchBend_MIDI_DEVICE_DIN(byte inChannel, int inPitch) { |
|
|
|
{ |
|
|
|
|
|
|
|
handle_generic(inChannel, inPitch, '\0', MIDI_BY_DIN, midi::PitchBend); |
|
|
|
handle_generic(inChannel, inPitch, '\0', MIDI_BY_DIN, midi::PitchBend); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleProgramChange_MIDI_DEVICE_DIN(byte inChannel, byte inProgram) |
|
|
|
void handleProgramChange_MIDI_DEVICE_DIN(byte inChannel, byte inProgram) { |
|
|
|
{ |
|
|
|
|
|
|
|
handle_generic(inChannel, inProgram, '\0', MIDI_BY_DIN, midi::ProgramChange); |
|
|
|
handle_generic(inChannel, inProgram, '\0', MIDI_BY_DIN, midi::ProgramChange); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleAfterTouchPoly_MIDI_DEVICE_DIN(byte inChannel, byte inNoteNumber, byte inVelocity) |
|
|
|
void handleAfterTouchPoly_MIDI_DEVICE_DIN(byte inChannel, byte inNoteNumber, byte inVelocity) { |
|
|
|
{ |
|
|
|
|
|
|
|
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_DIN, midi::AfterTouchPoly); |
|
|
|
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_DIN, midi::AfterTouchPoly); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleSystemExclusive_MIDI_DEVICE_DIN(byte * data, uint len) |
|
|
|
void handleSystemExclusive_MIDI_DEVICE_DIN(byte *data, uint len) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleSystemExclusive_generic(data, len, MIDI_BY_DIN); |
|
|
|
handleSystemExclusive_generic(data, len, MIDI_BY_DIN); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -553,48 +537,39 @@ void handleSystemExclusive_MIDI_DEVICE_DIN(byte * data, uint len) |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} */ |
|
|
|
} */ |
|
|
|
|
|
|
|
|
|
|
|
void handleTimeCodeQuarterFrame_MIDI_DEVICE_DIN(byte data) |
|
|
|
void handleTimeCodeQuarterFrame_MIDI_DEVICE_DIN(byte data) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleSystemCommon_generic(data, MIDI_BY_DIN, midi::TimeCodeQuarterFrame); |
|
|
|
handleSystemCommon_generic(data, MIDI_BY_DIN, midi::TimeCodeQuarterFrame); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleSongSelect_MIDI_DEVICE_DIN(byte inSong) |
|
|
|
void handleSongSelect_MIDI_DEVICE_DIN(byte inSong) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleSystemCommon_generic(inSong, MIDI_BY_DIN, midi::SongSelect); |
|
|
|
handleSystemCommon_generic(inSong, MIDI_BY_DIN, midi::SongSelect); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleTuneRequest_MIDI_DEVICE_DIN(void) |
|
|
|
void handleTuneRequest_MIDI_DEVICE_DIN(void) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleSystemCommon_generic('\0', MIDI_BY_DIN, midi::TuneRequest); |
|
|
|
handleSystemCommon_generic('\0', MIDI_BY_DIN, midi::TuneRequest); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleClock_MIDI_DEVICE_DIN(void) |
|
|
|
void handleClock_MIDI_DEVICE_DIN(void) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleRealtime_generic(MIDI_BY_DIN, midi::Clock); |
|
|
|
handleRealtime_generic(MIDI_BY_DIN, midi::Clock); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleStart_MIDI_DEVICE_DIN(void) |
|
|
|
void handleStart_MIDI_DEVICE_DIN(void) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleRealtime_generic(MIDI_BY_DIN, midi::Start); |
|
|
|
handleRealtime_generic(MIDI_BY_DIN, midi::Start); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleContinue_MIDI_DEVICE_DIN(void) |
|
|
|
void handleContinue_MIDI_DEVICE_DIN(void) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleRealtime_generic(MIDI_BY_DIN, midi::Continue); |
|
|
|
handleRealtime_generic(MIDI_BY_DIN, midi::Continue); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleStop_MIDI_DEVICE_DIN(void) |
|
|
|
void handleStop_MIDI_DEVICE_DIN(void) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleRealtime_generic(MIDI_BY_DIN, midi::Stop); |
|
|
|
handleRealtime_generic(MIDI_BY_DIN, midi::Stop); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleActiveSensing_MIDI_DEVICE_DIN(void) |
|
|
|
void handleActiveSensing_MIDI_DEVICE_DIN(void) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleRealtime_generic(MIDI_BY_DIN, midi::ActiveSensing); |
|
|
|
handleRealtime_generic(MIDI_BY_DIN, midi::ActiveSensing); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleSystemReset_MIDI_DEVICE_DIN(void) |
|
|
|
void handleSystemReset_MIDI_DEVICE_DIN(void) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleRealtime_generic(MIDI_BY_DIN, midi::SystemReset); |
|
|
|
handleRealtime_generic(MIDI_BY_DIN, midi::SystemReset); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -608,43 +583,35 @@ void handleSystemReset_MIDI_DEVICE_DIN(void) |
|
|
|
MIDI_DEVICE_USB_HOST |
|
|
|
MIDI_DEVICE_USB_HOST |
|
|
|
*****************************************/ |
|
|
|
*****************************************/ |
|
|
|
#ifdef MIDI_DEVICE_USB_HOST |
|
|
|
#ifdef MIDI_DEVICE_USB_HOST |
|
|
|
void handleNoteOn_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNoteNumber, byte inVelocity) |
|
|
|
void handleNoteOn_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNoteNumber, byte inVelocity) { |
|
|
|
{ |
|
|
|
|
|
|
|
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_USB_HOST, midi::NoteOn); |
|
|
|
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_USB_HOST, midi::NoteOn); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleNoteOff_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNoteNumber, byte inVelocity) |
|
|
|
void handleNoteOff_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNoteNumber, byte inVelocity) { |
|
|
|
{ |
|
|
|
|
|
|
|
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_USB_HOST, midi::NoteOff); |
|
|
|
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_USB_HOST, midi::NoteOff); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleControlChange_MIDI_DEVICE_USB_HOST(byte inChannel, byte inData1, byte inData2) |
|
|
|
void handleControlChange_MIDI_DEVICE_USB_HOST(byte inChannel, byte inData1, byte inData2) { |
|
|
|
{ |
|
|
|
|
|
|
|
handle_generic(inChannel, inData1, inData2, MIDI_BY_USB_HOST, midi::ControlChange); |
|
|
|
handle_generic(inChannel, inData1, inData2, MIDI_BY_USB_HOST, midi::ControlChange); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleAfterTouch_MIDI_DEVICE_USB_HOST(byte inChannel, byte inPressure) |
|
|
|
void handleAfterTouch_MIDI_DEVICE_USB_HOST(byte inChannel, byte inPressure) { |
|
|
|
{ |
|
|
|
|
|
|
|
handle_generic(inChannel, inPressure, '\0', MIDI_BY_USB_HOST, midi::AfterTouchChannel); |
|
|
|
handle_generic(inChannel, inPressure, '\0', MIDI_BY_USB_HOST, midi::AfterTouchChannel); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handlePitchBend_MIDI_DEVICE_USB_HOST(byte inChannel, int inPitch) |
|
|
|
void handlePitchBend_MIDI_DEVICE_USB_HOST(byte inChannel, int inPitch) { |
|
|
|
{ |
|
|
|
|
|
|
|
handle_generic(inChannel, inPitch, '\0', MIDI_BY_USB_HOST, midi::PitchBend); |
|
|
|
handle_generic(inChannel, inPitch, '\0', MIDI_BY_USB_HOST, midi::PitchBend); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleProgramChange_MIDI_DEVICE_USB_HOST(byte inChannel, byte inPitch) |
|
|
|
void handleProgramChange_MIDI_DEVICE_USB_HOST(byte inChannel, byte inPitch) { |
|
|
|
{ |
|
|
|
|
|
|
|
handle_generic(inChannel, inPitch, '\0', MIDI_BY_USB_HOST, midi::ProgramChange); |
|
|
|
handle_generic(inChannel, inPitch, '\0', MIDI_BY_USB_HOST, midi::ProgramChange); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleAfterTouchPoly_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNoteNumber, byte inVelocity) |
|
|
|
void handleAfterTouchPoly_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNoteNumber, byte inVelocity) { |
|
|
|
{ |
|
|
|
|
|
|
|
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_USB_HOST, midi::AfterTouchPoly); |
|
|
|
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_USB_HOST, midi::AfterTouchPoly); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleSystemExclusive_MIDI_DEVICE_USB_HOST(byte * data, uint len) |
|
|
|
void handleSystemExclusive_MIDI_DEVICE_USB_HOST(byte *data, uint len) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleSystemExclusive_generic(data, len, MIDI_BY_USB_HOST); |
|
|
|
handleSystemExclusive_generic(data, len, MIDI_BY_USB_HOST); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -674,48 +641,39 @@ void handleSystemExclusive_MIDI_DEVICE_USB_HOST(byte * data, uint len) |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} */ |
|
|
|
} */ |
|
|
|
|
|
|
|
|
|
|
|
void handleTimeCodeQuarterFrame_MIDI_DEVICE_USB_HOST(midi::DataByte data) |
|
|
|
void handleTimeCodeQuarterFrame_MIDI_DEVICE_USB_HOST(midi::DataByte data) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleSystemCommon_generic(data, MIDI_BY_USB_HOST, midi::TimeCodeQuarterFrame); |
|
|
|
handleSystemCommon_generic(data, MIDI_BY_USB_HOST, midi::TimeCodeQuarterFrame); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleSongSelect_MIDI_DEVICE_USB_HOST(byte inSong) |
|
|
|
void handleSongSelect_MIDI_DEVICE_USB_HOST(byte inSong) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleSystemCommon_generic(inSong, MIDI_BY_USB_HOST, midi::SongSelect); |
|
|
|
handleSystemCommon_generic(inSong, MIDI_BY_USB_HOST, midi::SongSelect); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleTuneRequest_MIDI_DEVICE_USB_HOST(void) |
|
|
|
void handleTuneRequest_MIDI_DEVICE_USB_HOST(void) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleSystemCommon_generic('\0', MIDI_BY_USB_HOST, midi::TuneRequest); |
|
|
|
handleSystemCommon_generic('\0', MIDI_BY_USB_HOST, midi::TuneRequest); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleClock_MIDI_DEVICE_USB_HOST(void) |
|
|
|
void handleClock_MIDI_DEVICE_USB_HOST(void) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleRealtime_generic(MIDI_BY_USB_HOST, midi::Clock); |
|
|
|
handleRealtime_generic(MIDI_BY_USB_HOST, midi::Clock); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleStart_MIDI_DEVICE_USB_HOST(void) |
|
|
|
void handleStart_MIDI_DEVICE_USB_HOST(void) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleRealtime_generic(MIDI_BY_USB_HOST, midi::Start); |
|
|
|
handleRealtime_generic(MIDI_BY_USB_HOST, midi::Start); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleContinue_MIDI_DEVICE_USB_HOST(void) |
|
|
|
void handleContinue_MIDI_DEVICE_USB_HOST(void) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleRealtime_generic(MIDI_BY_USB_HOST, midi::Continue); |
|
|
|
handleRealtime_generic(MIDI_BY_USB_HOST, midi::Continue); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleStop_MIDI_DEVICE_USB_HOST(void) |
|
|
|
void handleStop_MIDI_DEVICE_USB_HOST(void) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleRealtime_generic(MIDI_BY_USB_HOST, midi::Stop); |
|
|
|
handleRealtime_generic(MIDI_BY_USB_HOST, midi::Stop); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleActiveSensing_MIDI_DEVICE_USB_HOST(void) |
|
|
|
void handleActiveSensing_MIDI_DEVICE_USB_HOST(void) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleRealtime_generic(MIDI_BY_USB_HOST, midi::ActiveSensing); |
|
|
|
handleRealtime_generic(MIDI_BY_USB_HOST, midi::ActiveSensing); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleSystemReset_MIDI_DEVICE_USB_HOST(void) |
|
|
|
void handleSystemReset_MIDI_DEVICE_USB_HOST(void) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleRealtime_generic(MIDI_BY_USB_HOST, midi::SystemReset); |
|
|
|
handleRealtime_generic(MIDI_BY_USB_HOST, midi::SystemReset); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -729,43 +687,35 @@ void handleSystemReset_MIDI_DEVICE_USB_HOST(void) |
|
|
|
MIDI_DEVICE_USB |
|
|
|
MIDI_DEVICE_USB |
|
|
|
*****************************************/ |
|
|
|
*****************************************/ |
|
|
|
#ifdef MIDI_DEVICE_USB |
|
|
|
#ifdef MIDI_DEVICE_USB |
|
|
|
void handleNoteOn_MIDI_DEVICE_USB(byte inChannel, byte inNoteNumber, byte inVelocity) |
|
|
|
void handleNoteOn_MIDI_DEVICE_USB(byte inChannel, byte inNoteNumber, byte inVelocity) { |
|
|
|
{ |
|
|
|
|
|
|
|
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_USB, midi::NoteOn); |
|
|
|
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_USB, midi::NoteOn); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleNoteOff_MIDI_DEVICE_USB(byte inChannel, byte inNoteNumber, byte inVelocity) |
|
|
|
void handleNoteOff_MIDI_DEVICE_USB(byte inChannel, byte inNoteNumber, byte inVelocity) { |
|
|
|
{ |
|
|
|
|
|
|
|
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_USB, midi::NoteOff); |
|
|
|
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_USB, midi::NoteOff); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleControlChange_MIDI_DEVICE_USB(byte inChannel, byte inData1, byte inData2) |
|
|
|
void handleControlChange_MIDI_DEVICE_USB(byte inChannel, byte inData1, byte inData2) { |
|
|
|
{ |
|
|
|
|
|
|
|
handle_generic(inChannel, inData1, inData2, MIDI_BY_USB, midi::ControlChange); |
|
|
|
handle_generic(inChannel, inData1, inData2, MIDI_BY_USB, midi::ControlChange); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleAfterTouch_MIDI_DEVICE_USB(byte inChannel, byte inPressure) |
|
|
|
void handleAfterTouch_MIDI_DEVICE_USB(byte inChannel, byte inPressure) { |
|
|
|
{ |
|
|
|
|
|
|
|
handle_generic(inChannel, inPressure, '\0', MIDI_BY_USB, midi::AfterTouchChannel); |
|
|
|
handle_generic(inChannel, inPressure, '\0', MIDI_BY_USB, midi::AfterTouchChannel); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handlePitchBend_MIDI_DEVICE_USB(byte inChannel, int inPitch) |
|
|
|
void handlePitchBend_MIDI_DEVICE_USB(byte inChannel, int inPitch) { |
|
|
|
{ |
|
|
|
|
|
|
|
handle_generic(inChannel, inPitch, '\0', MIDI_BY_USB, midi::PitchBend); |
|
|
|
handle_generic(inChannel, inPitch, '\0', MIDI_BY_USB, midi::PitchBend); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleProgramChange_MIDI_DEVICE_USB(byte inChannel, byte inProgram) |
|
|
|
void handleProgramChange_MIDI_DEVICE_USB(byte inChannel, byte inProgram) { |
|
|
|
{ |
|
|
|
|
|
|
|
handle_generic(inChannel, inProgram, '\0', MIDI_BY_USB, midi::ProgramChange); |
|
|
|
handle_generic(inChannel, inProgram, '\0', MIDI_BY_USB, midi::ProgramChange); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleAfterTouchPoly_MIDI_DEVICE_USB(byte inChannel, byte inNoteNumber, byte inVelocity) |
|
|
|
void handleAfterTouchPoly_MIDI_DEVICE_USB(byte inChannel, byte inNoteNumber, byte inVelocity) { |
|
|
|
{ |
|
|
|
|
|
|
|
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_USB, midi::AfterTouchPoly); |
|
|
|
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_USB, midi::AfterTouchPoly); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleSystemExclusive_MIDI_DEVICE_USB(byte * data, uint len) |
|
|
|
void handleSystemExclusive_MIDI_DEVICE_USB(byte *data, uint len) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleSystemExclusive_generic(data, len, MIDI_BY_USB); |
|
|
|
handleSystemExclusive_generic(data, len, MIDI_BY_USB); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -795,48 +745,39 @@ void handleSystemExclusive_MIDI_DEVICE_USB(byte * data, uint len) |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} */ |
|
|
|
} */ |
|
|
|
|
|
|
|
|
|
|
|
void handleTimeCodeQuarterFrame_MIDI_DEVICE_USB(midi::DataByte data) |
|
|
|
void handleTimeCodeQuarterFrame_MIDI_DEVICE_USB(midi::DataByte data) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleSystemCommon_generic(data, MIDI_BY_USB, midi::TimeCodeQuarterFrame); |
|
|
|
handleSystemCommon_generic(data, MIDI_BY_USB, midi::TimeCodeQuarterFrame); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleSongSelect_MIDI_DEVICE_USB(byte inSong) |
|
|
|
void handleSongSelect_MIDI_DEVICE_USB(byte inSong) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleSystemCommon_generic(inSong, MIDI_BY_USB, midi::SongSelect); |
|
|
|
handleSystemCommon_generic(inSong, MIDI_BY_USB, midi::SongSelect); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleTuneRequest_MIDI_DEVICE_USB(void) |
|
|
|
void handleTuneRequest_MIDI_DEVICE_USB(void) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleSystemCommon_generic('\0', MIDI_BY_USB, midi::TuneRequest); |
|
|
|
handleSystemCommon_generic('\0', MIDI_BY_USB, midi::TuneRequest); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleClock_MIDI_DEVICE_USB(void) |
|
|
|
void handleClock_MIDI_DEVICE_USB(void) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleRealtime_generic(MIDI_BY_USB, midi::Clock); |
|
|
|
handleRealtime_generic(MIDI_BY_USB, midi::Clock); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleStart_MIDI_DEVICE_USB(void) |
|
|
|
void handleStart_MIDI_DEVICE_USB(void) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleRealtime_generic(MIDI_BY_USB, midi::Start); |
|
|
|
handleRealtime_generic(MIDI_BY_USB, midi::Start); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleContinue_MIDI_DEVICE_USB(void) |
|
|
|
void handleContinue_MIDI_DEVICE_USB(void) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleRealtime_generic(MIDI_BY_USB, midi::Continue); |
|
|
|
handleRealtime_generic(MIDI_BY_USB, midi::Continue); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleStop_MIDI_DEVICE_USB(void) |
|
|
|
void handleStop_MIDI_DEVICE_USB(void) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleRealtime_generic(MIDI_BY_USB, midi::Stop); |
|
|
|
handleRealtime_generic(MIDI_BY_USB, midi::Stop); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleActiveSensing_MIDI_DEVICE_USB(void) |
|
|
|
void handleActiveSensing_MIDI_DEVICE_USB(void) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleRealtime_generic(MIDI_BY_USB, midi::ActiveSensing); |
|
|
|
handleRealtime_generic(MIDI_BY_USB, midi::ActiveSensing); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleSystemReset_MIDI_DEVICE_USB(void) |
|
|
|
void handleSystemReset_MIDI_DEVICE_USB(void) { |
|
|
|
{ |
|
|
|
|
|
|
|
handleRealtime_generic(MIDI_BY_USB, midi::SystemReset); |
|
|
|
handleRealtime_generic(MIDI_BY_USB, midi::SystemReset); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -846,8 +787,7 @@ void handleSystemReset_MIDI_DEVICE_USB(void) |
|
|
|
} */ |
|
|
|
} */ |
|
|
|
#endif // MIDI_DEVICE_USB
|
|
|
|
#endif // MIDI_DEVICE_USB
|
|
|
|
|
|
|
|
|
|
|
|
FLASHMEM void MD_sendControlChange(uint8_t channel, uint8_t cc, uint8_t value) |
|
|
|
FLASHMEM void MD_sendControlChange(uint8_t channel, uint8_t cc, uint8_t value) { |
|
|
|
{ |
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.print(F("[MD] SendControlChange CH:")); |
|
|
|
Serial.print(F("[MD] SendControlChange CH:")); |
|
|
|
Serial.print(channel, DEC); |
|
|
|
Serial.print(channel, DEC); |
|
|
@ -882,8 +822,7 @@ FLASHMEM void MD_sendControlChange(uint8_t channel, uint8_t cc, uint8_t value) |
|
|
|
/*****************************************
|
|
|
|
/*****************************************
|
|
|
|
HELPER FUNCTIONS |
|
|
|
HELPER FUNCTIONS |
|
|
|
*****************************************/ |
|
|
|
*****************************************/ |
|
|
|
FLASHMEM void setup_midi_devices(void) |
|
|
|
FLASHMEM void setup_midi_devices(void) { |
|
|
|
{ |
|
|
|
|
|
|
|
#ifdef MIDI_DEVICE_DIN |
|
|
|
#ifdef MIDI_DEVICE_DIN |
|
|
|
// Start serial MIDI
|
|
|
|
// Start serial MIDI
|
|
|
|
midi_serial.begin(DEFAULT_MIDI_CHANNEL); |
|
|
|
midi_serial.begin(DEFAULT_MIDI_CHANNEL); |
|
|
@ -966,8 +905,7 @@ FLASHMEM void setup_midi_devices(void) |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
FLASHMEM void check_midi_devices(void) |
|
|
|
FLASHMEM void check_midi_devices(void) { |
|
|
|
{ |
|
|
|
|
|
|
|
#ifdef MIDI_DEVICE_DIN |
|
|
|
#ifdef MIDI_DEVICE_DIN |
|
|
|
midi_serial.read(); |
|
|
|
midi_serial.read(); |
|
|
|
#endif |
|
|
|
#endif |
|
|
@ -980,8 +918,7 @@ FLASHMEM void check_midi_devices(void) |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
FLASHMEM void send_sysex_voice(uint8_t midi_channel, uint8_t* data) |
|
|
|
FLASHMEM void send_sysex_voice(uint8_t midi_channel, uint8_t *data) { |
|
|
|
{ |
|
|
|
|
|
|
|
uint8_t checksum = 0; |
|
|
|
uint8_t checksum = 0; |
|
|
|
uint8_t vd[161]; |
|
|
|
uint8_t vd[161]; |
|
|
|
|
|
|
|
|
|
|
@ -992,8 +929,7 @@ FLASHMEM void send_sysex_voice(uint8_t midi_channel, uint8_t* data) |
|
|
|
vd[2] = 0x00; // Format number (0=1 voice)
|
|
|
|
vd[2] = 0x00; // Format number (0=1 voice)
|
|
|
|
vd[3] = 0x01; // Byte count MSB
|
|
|
|
vd[3] = 0x01; // Byte count MSB
|
|
|
|
vd[4] = 0x1B; // Byte count LSB
|
|
|
|
vd[4] = 0x1B; // Byte count LSB
|
|
|
|
for (uint8_t n = 0; n < 155; n++) |
|
|
|
for (uint8_t n = 0; n < 155; n++) { |
|
|
|
{ |
|
|
|
|
|
|
|
checksum -= data[n]; |
|
|
|
checksum -= data[n]; |
|
|
|
vd[5 + n] = data[n]; |
|
|
|
vd[5 + n] = data[n]; |
|
|
|
} |
|
|
|
} |
|
|
@ -1011,8 +947,7 @@ FLASHMEM void send_sysex_voice(uint8_t midi_channel, uint8_t* data) |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
FLASHMEM void send_sysex_bank(uint8_t midi_channel, uint8_t* bank_data) |
|
|
|
FLASHMEM void send_sysex_bank(uint8_t midi_channel, uint8_t *bank_data) { |
|
|
|
{ |
|
|
|
|
|
|
|
#ifdef MIDI_DEVICE_DIN |
|
|
|
#ifdef MIDI_DEVICE_DIN |
|
|
|
midi_serial.sendSysEx(4104, bank_data); // Send to DIN MIDI
|
|
|
|
midi_serial.sendSysEx(4104, bank_data); // Send to DIN MIDI
|
|
|
|
#endif |
|
|
|
#endif |
|
|
@ -1020,29 +955,25 @@ FLASHMEM void send_sysex_bank(uint8_t midi_channel, uint8_t* bank_data) |
|
|
|
// Sysex bank dump is splitted due to Windows USB driver limitations
|
|
|
|
// Sysex bank dump is splitted due to Windows USB driver limitations
|
|
|
|
usbMIDI.sendSysEx(2048, bank_data, true); // Send to USB MIDI
|
|
|
|
usbMIDI.sendSysEx(2048, bank_data, true); // Send to USB MIDI
|
|
|
|
delay(50); |
|
|
|
delay(50); |
|
|
|
usbMIDI.sendSysEx(2048, bank_data+2048, true); |
|
|
|
usbMIDI.sendSysEx(2048, bank_data + 2048, true); |
|
|
|
delay(50); |
|
|
|
delay(50); |
|
|
|
usbMIDI.sendSysEx(8, bank_data+4096, true); |
|
|
|
usbMIDI.sendSysEx(8, bank_data + 4096, true); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#ifdef MIDI_DEVICE_USB_HOST |
|
|
|
#ifdef MIDI_DEVICE_USB_HOST |
|
|
|
midi_usb.sendSysEx(4104, bank_data); // Send to USB-HOST MIDI
|
|
|
|
midi_usb.sendSysEx(4104, bank_data); // Send to USB-HOST MIDI
|
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
FLASHMEM void send_sysex_param(uint8_t midi_channel, uint8_t var, uint8_t val, uint8_t param_group) |
|
|
|
FLASHMEM void send_sysex_param(uint8_t midi_channel, uint8_t var, uint8_t val, uint8_t param_group) { |
|
|
|
{ |
|
|
|
|
|
|
|
uint8_t s[5]; |
|
|
|
uint8_t s[5]; |
|
|
|
|
|
|
|
|
|
|
|
s[0] = 0x43; // ID=Yamaha
|
|
|
|
s[0] = 0x43; // ID=Yamaha
|
|
|
|
s[1] = midi_channel; // Sub-status and MIDI channel
|
|
|
|
s[1] = midi_channel; // Sub-status and MIDI channel
|
|
|
|
s[2] = (param_group & 5) << 2; // Format number (0=1 voice)
|
|
|
|
s[2] = (param_group & 5) << 2; // Format number (0=1 voice)
|
|
|
|
if (param_group == 0) |
|
|
|
if (param_group == 0) { |
|
|
|
{ |
|
|
|
|
|
|
|
s[2] |= 1; |
|
|
|
s[2] |= 1; |
|
|
|
s[3] = var & 0x7f; |
|
|
|
s[3] = var & 0x7f; |
|
|
|
} |
|
|
|
} else { |
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
s[3] = var & 0x7f; |
|
|
|
s[3] = var & 0x7f; |
|
|
|
} |
|
|
|
} |
|
|
|
s[4] = val & 0x7f; |
|
|
|
s[4] = val & 0x7f; |
|
|
|