From ee3cf1b92e37712261950b33528b0bb0614f98fa Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Thu, 7 Feb 2019 13:20:28 +0100 Subject: [PATCH] MIDI functions outsourced to midi_devices.* --- MicroMDAEPiano.ino | 293 +---------------------------------------- midi_devices.cpp | 319 +++++++++++++++++++++++++++++++++++++++++++++ midi_devices.h | 44 +++++++ 3 files changed, 367 insertions(+), 289 deletions(-) create mode 100644 midi_devices.cpp create mode 100644 midi_devices.h diff --git a/MicroMDAEPiano.ino b/MicroMDAEPiano.ino index 791abd1..506bd98 100644 --- a/MicroMDAEPiano.ino +++ b/MicroMDAEPiano.ino @@ -34,18 +34,12 @@ #else #include "mdaEPianoData.h" #endif -#if defined(MIDI_DEVICE_USB) -#include -#endif -#ifdef MIDI_DEVICE_USB_HOST -#include -#endif #include #include "Encoder4.h" +#include "midi_devices.h" #include "LiquidCrystalPlus_I2C.h" #include "UI.h" - //************************************************************************************************* //* GLOBAL VARIABLES //************************************************************************************************* @@ -89,20 +83,6 @@ AudioConnection patchCord13(volume_l, 0, pt8211_1, 0); // Objects mdaEPiano* ep; -#ifdef MIDI_DEVICE_DIN -MIDI_CREATE_INSTANCE(HardwareSerial, MIDI_DEVICE_DIN, midi_serial); -#endif -#ifdef MIDI_DEVICE_USB_HOST -USBHost usb_host; -MIDIDevice midi_usb(usb_host); -#endif -#ifdef MIDI_DEVICE_USB -static const unsigned sUsbTransportBufferSize = 16; -typedef midi::UsbTransport UsbTransport; -UsbTransport sUsbTransport; -MIDI_CREATE_INSTANCE(UsbTransport, sUsbTransport, midi_onboard_usb); -#endif - // Variables uint8_t midi_channel = DEFAULT_MIDI_CHANNEL; uint32_t xrun = 0; @@ -167,32 +147,7 @@ void setup() // read initial EEPROM variables initial_values_from_eeprom(); -#ifdef MIDI_DEVICE_DIN - // Start serial MIDI - midi_serial.begin(DEFAULT_MIDI_CHANNEL); - midi_serial.setHandleNoteOn(handleNoteOn_MIDI_DEVICE_DIN); - midi_serial.setHandleNoteOff(handleNoteOff_MIDI_DEVICE_DIN); - midi_serial.setHandleControlChange(handleControlChange_MIDI_DEVICE_DIN); - Serial.println(F("MIDI_DEVICE_DIN enabled")); -#endif - - // start up USB host -#ifdef MIDI_DEVICE_USB_HOST - usb_host.begin(); - midi_usb.setHandleNoteOn(handleNoteOn_MIDI_DEVICE_USB_HOST); - midi_usb.setHandleNoteOff(handleNoteOff_MIDI_DEVICE_USB_HOST); - midi_usb.setHandleControlChange(handleControlChange_MIDI_DEVICE_USB_HOST); - Serial.println(F("MIDI_DEVICE_USB_HOST enabled.")); -#endif - - // check for onboard USB-MIDI -#ifdef MIDI_DEVICE_USB - midi_onboard_usb.begin(); - midi_onboard_usb.setHandleNoteOn(handleNoteOn_MIDI_DEVICE_USB); - midi_onboard_usb.setHandleNoteOff(handleNoteOff_MIDI_DEVICE_USB); - midi_onboard_usb.setHandleControlChange(handleControlChange_MIDI_DEVICE_USB); - Serial.println(F("MIDI_DEVICE_USB enabled.")); -#endif + setup_midi_devices(); // start audio card AudioNoInterrupts(); @@ -317,253 +272,13 @@ void loop() queue_r.playBuffer(); queue_l.playBuffer(); } -#ifdef MIDI_DEVICE_DIN - midi_serial.read(); -#endif -#ifdef MIDI_DEVICE_USB_HOST - usb_host.Task(); - midi_usb.read(); -#endif -#ifdef MIDI_DEVICE_USB - midi_onboard_usb.read(); -#endif + + check_midi_devices(); } //************************************************************************************************* //* PROGRAM FUNCTIONS //************************************************************************************************* -#ifdef MIDI_DEVICE_DIN -void handleNoteOn_MIDI_DEVICE_DIN(byte inChannel, byte inNumber, byte inVelocity) -{ - handleNoteOn(byte inChannel, byte inNumber, byte inVelocity); -#ifdef DEBUG - Serial.print(F("[MIDI_DIN] NoteOn")); -#endif -#ifdef MIDI_MERGE_THRU -#ifdef MIDI_DEVICE_USB_HOST - midi_usb.send(midi::NoteOn, inNumber, inVelocity, inChannel); -#ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); -#endif -#endif -#ifdef MIDI_DEVICE_USB - midi_onboard_usb.send(midi::NoteOn, inNumber, inVelocity, inChannel); -#ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); -#endif -#endif -#ifdef DEBUG - Serial.println(); -#endif -#endif -} - -void handleNoteOff_MIDI_DEVICE_DIN(byte inChannel, byte inNumber, byte inVelocity) -{ - handleNoteOff(byte inChannel, byte inNumber, byte inVelocity); -#ifdef DEBUG - Serial.print(F("[MIDI_DIN] NoteOff")); -#endif -#ifdef MIDI_MERGE_THRU -#ifdef MIDI_DEVICE_USB_HOST - midi_usb.send(midi::NoteOff, inNumber, inVelocity, inChannel); -#ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); -#endif -#endif -#ifdef MIDI_DEVICE_USB - midi_onboard_usb.send(midi::NoteOff, inNumber, inVelocity, inChannel); -#ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); -#endif -#endif -#ifdef DEBUG - Serial.println(); -#endif -#endif -} - -void handleControlChange_MIDI_DEVICE_DIN(byte inChannel, byte inData1, byte inData2) -{ - handleControlChange(byte inChannel, byte inData1, byte inData2); -#ifdef DEBUG - Serial.print(F("[MIDI_DIN] CC")); -#endif -#ifdef MIDI_MERGE_THRU -#ifdef MIDI_DEVICE_USB_HOST - midi_usb.send(midi::ControlChange, inData1, inData2, inChannel); -#ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); -#endif -#endif -#ifdef MIDI_DEVICE_USB - midi_onboard_usb.send(midi::ControlChange, inData1, inData2, inChannel); -#ifdef DEBUG - Serial.print(F( "THRU->MIDI_USB")); -#endif -#endif -#ifdef DEBUG - Serial.println(); -#endif -#endif -} -#endif - -#ifdef MIDI_DEVICE_USB_HOST -void handleNoteOn_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNumber, byte inVelocity) -{ - handleNoteOn(inChannel, inNumber, inVelocity); -#ifdef DEBUG - Serial.print(F("[MIDI_USB_HOST] NoteOn")); -#endif -#ifdef MIDI_MERGE_THRU -#ifdef MIDI_DEVICE_DIN - midi_serial.send(midi::NoteOn, inNumber, inVelocity, inChannel); -#ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); -#endif -#endif -#ifdef MIDI_DEVICE_USB - midi_onboard_usb.send(midi::NoteOn, inNumber, inVelocity, inChannel); -#ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); -#endif -#endif -#ifdef DEBUG - Serial.println(); -#endif -#endif -} - -void handleNoteOff_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNumber, byte inVelocity) -{ - handleNoteOff(inChannel, inNumber, inVelocity); -#ifdef DEBUG - Serial.print(F("[MIDI_USB_HOST] NoteOff")); -#endif - -#ifdef MIDI_MERGE_THRU -#ifdef MIDI_DEVICE_DIN - midi_serial.send(midi::NoteOff, inNumber, inVelocity, inChannel); -#ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); -#endif -#endif -#ifdef MIDI_DEVICE_USB - midi_onboard_usb.send(midi::NoteOff, inNumber, inVelocity, inChannel); -#ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); -#endif -#endif -#ifdef DEBUG - Serial.println(); -#endif -#endif -} - -void handleControlChange_MIDI_DEVICE_USB_HOST(byte inChannel, byte inData1, byte inData2) -{ - handleControlChange(inChannel, inData1, inData2); -#ifdef DEBUG - Serial.print(F("[MIDI_USB_HOST] CC")); -#endif -#ifdef MIDI_MERGE_THRU -#ifdef MIDI_DEVICE_DIN - midi_serial.send(midi::ControlChange, inData1, inData2, inChannel); -#ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); -#endif -#endif -#ifdef MIDI_DEVICE_USB - midi_onboard_usb.send(midi::ControlChange, inData1, inData2, inChannel); -#ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB")); -#endif -#endif -#ifdef DEBUG - Serial.println(); -#endif -#endif -} -#endif - -#ifdef MIDI_DEVICE_USB -void handleNoteOn_MIDI_DEVICE_USB(byte inChannel, byte inNumber, byte inVelocity) -{ - handleNoteOn(inChannel, inNumber, inVelocity); -#ifdef DEBUG - Serial.print(F("[MIDI_USB] NoteOn")); -#endif -#ifdef MIDI_MERGE_THRU -#ifdef MIDI_DEVICE_DIN - midi_serial.send(midi::NoteOn, inNumber, inVelocity, inChannel); -#ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); -#endif -#endif -#ifdef MIDI_DEVICE_USB_HOST - midi_usb.send(midi::NoteOn, inNumber, inVelocity, inChannel); -#ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); -#endif -#endif -#ifdef DEBUG - Serial.println(); -#endif -#endif -} - -void handleNoteOff_MIDI_DEVICE_USB(byte inChannel, byte inNumber, byte inVelocity) -{ - handleNoteOff(inChannel, inNumber, inVelocity); -#ifdef DEBUG - Serial.print(F("[MIDI_USB] NoteOff")); -#endif -#ifdef MIDI_MERGE_THRU -#ifdef MIDI_DEVICE_DIN - midi_serial.send(midi::NoteOff, inNumber, inVelocity, inChannel); -#ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); -#endif -#endif -#ifdef MIDI_DEVICE_USB_HOST - midi_usb.send(midi::NoteOff, inNumber, inVelocity, inChannel); -#ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); -#endif -#endif -#ifdef DEBUG - Serial.println(); -#endif -#endif -} - -void handleControlChange_MIDI_DEVICE_USB(byte inChannel, byte inData1, byte inData2) -{ - handleControlChange(inChannel, inData1, inData2); -#ifdef DEBUG - Serial.print(F("[MIDI_USB] CC")); -#endif -#ifdef MIDI_MERGE_THRU -#ifdef MIDI_DEVICE_DIN - midi_serial.send(midi::ControlChange, inData1, inData2, inChannel); -#ifdef DEBUG - Serial.print(F(" THRU->MIDI_DIN")); -#endif -#endif -#ifdef MIDI_DEVICE_USB_HOST - midi_usb.send(midi::ControlChange, inData1, inData2, inChannel); -#ifdef DEBUG - Serial.print(F(" THRU->MIDI_USB_HOST")); -#endif -#endif -#ifdef DEBUG - Serial.println(); -#endif -#endif -} -#endif - void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) { if (checkMidiChannel(inChannel)) diff --git a/midi_devices.cpp b/midi_devices.cpp new file mode 100644 index 0000000..05ec6c3 --- /dev/null +++ b/midi_devices.cpp @@ -0,0 +1,319 @@ +/* + MicroMDAEPiano + + MicroMDAEPiano is a port of the MDA-EPiano sound engine + (https://sourceforge.net/projects/mda-vst/) for the Teensy-3.5/3.6 with audio shield. + + (c)2019 H. Wirtz + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#if defined(MIDI_DEVICE_USB) +#include +#endif +#ifdef MIDI_DEVICE_USB_HOST +#include +#endif + +#ifdef MIDI_DEVICE_DIN +MIDI_CREATE_INSTANCE(HardwareSerial, MIDI_DEVICE_DIN, midi_serial); +#endif +#ifdef MIDI_DEVICE_USB_HOST +USBHost usb_host; +MIDIDevice midi_usb(usb_host); +#endif +#ifdef MIDI_DEVICE_USB +static const unsigned sUsbTransportBufferSize = 16; +typedef midi::UsbTransport UsbTransport; +UsbTransport sUsbTransport; +MIDI_CREATE_INSTANCE(UsbTransport, sUsbTransport, midi_onboard_usb); +#endif + +void setup_midi_devices(void) +{ +#ifdef MIDI_DEVICE_DIN + // Start serial MIDI + midi_serial.begin(DEFAULT_MIDI_CHANNEL); + midi_serial.setHandleNoteOn(handleNoteOn_MIDI_DEVICE_DIN); + midi_serial.setHandleNoteOff(handleNoteOff_MIDI_DEVICE_DIN); + midi_serial.setHandleControlChange(handleControlChange_MIDI_DEVICE_DIN); + Serial.println(F("MIDI_DEVICE_DIN enabled")); +#endif + + // start up USB host +#ifdef MIDI_DEVICE_USB_HOST + usb_host.begin(); + midi_usb.setHandleNoteOn(handleNoteOn_MIDI_DEVICE_USB_HOST); + midi_usb.setHandleNoteOff(handleNoteOff_MIDI_DEVICE_USB_HOST); + midi_usb.setHandleControlChange(handleControlChange_MIDI_DEVICE_USB_HOST); + Serial.println(F("MIDI_DEVICE_USB_HOST enabled.")); +#endif + + // check for onboard USB-MIDI +#ifdef MIDI_DEVICE_USB + midi_onboard_usb.begin(); + midi_onboard_usb.setHandleNoteOn(handleNoteOn_MIDI_DEVICE_USB); + midi_onboard_usb.setHandleNoteOff(handleNoteOff_MIDI_DEVICE_USB); + midi_onboard_usb.setHandleControlChange(handleControlChange_MIDI_DEVICE_USB); + Serial.println(F("MIDI_DEVICE_USB enabled.")); +#endif +} + +void check_midi_devices(void) +{ +#ifdef MIDI_DEVICE_DIN + midi_serial.read(); +#endif +#ifdef MIDI_DEVICE_USB_HOST + usb_host.Task(); + midi_usb.read(); +#endif +#ifdef MIDI_DEVICE_USB + midi_onboard_usb.read(); +#endif +} + +#ifdef MIDI_DEVICE_DIN +void handleNoteOn_MIDI_DEVICE_DIN(byte inChannel, byte inNumber, byte inVelocity) +{ + handleNoteOn(byte inChannel, byte inNumber, byte inVelocity); +#ifdef DEBUG + Serial.print(F("[MIDI_DIN] NoteOn")); +#endif +#ifdef MIDI_MERGE_THRU +#ifdef MIDI_DEVICE_USB_HOST + midi_usb.send(midi::NoteOn, inNumber, inVelocity, inChannel); +#ifdef DEBUG + Serial.print(F(" THRU->MIDI_USB_HOST")); +#endif +#endif +#ifdef MIDI_DEVICE_USB + midi_onboard_usb.send(midi::NoteOn, inNumber, inVelocity, inChannel); +#ifdef DEBUG + Serial.print(F(" THRU->MIDI_USB")); +#endif +#endif +#ifdef DEBUG + Serial.println(); +#endif +#endif +} + +void handleNoteOff_MIDI_DEVICE_DIN(byte inChannel, byte inNumber, byte inVelocity) +{ + handleNoteOff(byte inChannel, byte inNumber, byte inVelocity); +#ifdef DEBUG + Serial.print(F("[MIDI_DIN] NoteOff")); +#endif +#ifdef MIDI_MERGE_THRU +#ifdef MIDI_DEVICE_USB_HOST + midi_usb.send(midi::NoteOff, inNumber, inVelocity, inChannel); +#ifdef DEBUG + Serial.print(F(" THRU->MIDI_USB_HOST")); +#endif +#endif +#ifdef MIDI_DEVICE_USB + midi_onboard_usb.send(midi::NoteOff, inNumber, inVelocity, inChannel); +#ifdef DEBUG + Serial.print(F(" THRU->MIDI_USB")); +#endif +#endif +#ifdef DEBUG + Serial.println(); +#endif +#endif +} + +void handleControlChange_MIDI_DEVICE_DIN(byte inChannel, byte inData1, byte inData2) +{ + handleControlChange(byte inChannel, byte inData1, byte inData2); +#ifdef DEBUG + Serial.print(F("[MIDI_DIN] CC")); +#endif +#ifdef MIDI_MERGE_THRU +#ifdef MIDI_DEVICE_USB_HOST + midi_usb.send(midi::ControlChange, inData1, inData2, inChannel); +#ifdef DEBUG + Serial.print(F(" THRU->MIDI_USB_HOST")); +#endif +#endif +#ifdef MIDI_DEVICE_USB + midi_onboard_usb.send(midi::ControlChange, inData1, inData2, inChannel); +#ifdef DEBUG + Serial.print(F( "THRU->MIDI_USB")); +#endif +#endif +#ifdef DEBUG + Serial.println(); +#endif +#endif +} +#endif + +#ifdef MIDI_DEVICE_USB_HOST +void handleNoteOn_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNumber, byte inVelocity) +{ + handleNoteOn(inChannel, inNumber, inVelocity); +#ifdef DEBUG + Serial.print(F("[MIDI_USB_HOST] NoteOn")); +#endif +#ifdef MIDI_MERGE_THRU +#ifdef MIDI_DEVICE_DIN + midi_serial.send(midi::NoteOn, inNumber, inVelocity, inChannel); +#ifdef DEBUG + Serial.print(F(" THRU->MIDI_DIN")); +#endif +#endif +#ifdef MIDI_DEVICE_USB + midi_onboard_usb.send(midi::NoteOn, inNumber, inVelocity, inChannel); +#ifdef DEBUG + Serial.print(F(" THRU->MIDI_USB")); +#endif +#endif +#ifdef DEBUG + Serial.println(); +#endif +#endif +} + +void handleNoteOff_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNumber, byte inVelocity) +{ + handleNoteOff(inChannel, inNumber, inVelocity); +#ifdef DEBUG + Serial.print(F("[MIDI_USB_HOST] NoteOff")); +#endif + +#ifdef MIDI_MERGE_THRU +#ifdef MIDI_DEVICE_DIN + midi_serial.send(midi::NoteOff, inNumber, inVelocity, inChannel); +#ifdef DEBUG + Serial.print(F(" THRU->MIDI_DIN")); +#endif +#endif +#ifdef MIDI_DEVICE_USB + midi_onboard_usb.send(midi::NoteOff, inNumber, inVelocity, inChannel); +#ifdef DEBUG + Serial.print(F(" THRU->MIDI_USB")); +#endif +#endif +#ifdef DEBUG + Serial.println(); +#endif +#endif +} + +void handleControlChange_MIDI_DEVICE_USB_HOST(byte inChannel, byte inData1, byte inData2) +{ + handleControlChange(inChannel, inData1, inData2); +#ifdef DEBUG + Serial.print(F("[MIDI_USB_HOST] CC")); +#endif +#ifdef MIDI_MERGE_THRU +#ifdef MIDI_DEVICE_DIN + midi_serial.send(midi::ControlChange, inData1, inData2, inChannel); +#ifdef DEBUG + Serial.print(F(" THRU->MIDI_DIN")); +#endif +#endif +#ifdef MIDI_DEVICE_USB + midi_onboard_usb.send(midi::ControlChange, inData1, inData2, inChannel); +#ifdef DEBUG + Serial.print(F(" THRU->MIDI_USB")); +#endif +#endif +#ifdef DEBUG + Serial.println(); +#endif +#endif +} +#endif + +#ifdef MIDI_DEVICE_USB +void handleNoteOn_MIDI_DEVICE_USB(byte inChannel, byte inNumber, byte inVelocity) +{ + handleNoteOn(inChannel, inNumber, inVelocity); +#ifdef DEBUG + Serial.print(F("[MIDI_USB] NoteOn")); +#endif +#ifdef MIDI_MERGE_THRU +#ifdef MIDI_DEVICE_DIN + midi_serial.send(midi::NoteOn, inNumber, inVelocity, inChannel); +#ifdef DEBUG + Serial.print(F(" THRU->MIDI_DIN")); +#endif +#endif +#ifdef MIDI_DEVICE_USB_HOST + midi_usb.send(midi::NoteOn, inNumber, inVelocity, inChannel); +#ifdef DEBUG + Serial.print(F(" THRU->MIDI_USB_HOST")); +#endif +#endif +#ifdef DEBUG + Serial.println(); +#endif +#endif +} + +void handleNoteOff_MIDI_DEVICE_USB(byte inChannel, byte inNumber, byte inVelocity) +{ + handleNoteOff(inChannel, inNumber, inVelocity); +#ifdef DEBUG + Serial.print(F("[MIDI_USB] NoteOff")); +#endif +#ifdef MIDI_MERGE_THRU +#ifdef MIDI_DEVICE_DIN + midi_serial.send(midi::NoteOff, inNumber, inVelocity, inChannel); +#ifdef DEBUG + Serial.print(F(" THRU->MIDI_DIN")); +#endif +#endif +#ifdef MIDI_DEVICE_USB_HOST + midi_usb.send(midi::NoteOff, inNumber, inVelocity, inChannel); +#ifdef DEBUG + Serial.print(F(" THRU->MIDI_USB_HOST")); +#endif +#endif +#ifdef DEBUG + Serial.println(); +#endif +#endif +} + +void handleControlChange_MIDI_DEVICE_USB(byte inChannel, byte inData1, byte inData2) +{ + handleControlChange(inChannel, inData1, inData2); +#ifdef DEBUG + Serial.print(F("[MIDI_USB] CC")); +#endif +#ifdef MIDI_MERGE_THRU +#ifdef MIDI_DEVICE_DIN + midi_serial.send(midi::ControlChange, inData1, inData2, inChannel); +#ifdef DEBUG + Serial.print(F(" THRU->MIDI_DIN")); +#endif +#endif +#ifdef MIDI_DEVICE_USB_HOST + midi_usb.send(midi::ControlChange, inData1, inData2, inChannel); +#ifdef DEBUG + Serial.print(F(" THRU->MIDI_USB_HOST")); +#endif +#endif +#ifdef DEBUG + Serial.println(); +#endif +#endif +} +#endif diff --git a/midi_devices.h b/midi_devices.h new file mode 100644 index 0000000..963777d --- /dev/null +++ b/midi_devices.h @@ -0,0 +1,44 @@ +/* + MicroMDAEPiano + + MicroMDAEPiano is a port of the MDA-EPiano sound engine + (https://sourceforge.net/projects/mda-vst/) for the Teensy-3.5/3.6 with audio shield. + + (c)2019 H. Wirtz + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MIDI_DEVICES_H +#define MIDI_DEVICES_H + +void setup_midi_devices(void); +void check_midi_devices(void); +#ifdef MIDI_DEVICE_DIN +void handleNoteOn_MIDI_DEVICE_DIN(byte inChannel, byte inNumber, byte inVelocity); +void handleNoteOff_MIDI_DEVICE_DIN(byte inChannel, byte inNumber, byte inVelocity); +void handleControlChange_MIDI_DEVICE_DIN(byte inChannel, byte inData1, byte inData2); +#endif +#ifdef MIDI_DEVICE_USB_HOST +void handleNoteOn_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNumber, byte inVelocity); +void handleNoteOff_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNumber, byte inVelocity); +void handleControlChange_MIDI_DEVICE_USB_HOST(byte inChannel, byte inData1, byte inData2); +#endif +#ifdef MIDI_DEVICE_USB +void handleNoteOn_MIDI_DEVICE_USB(byte inChannel, byte inNumber, byte inVelocity); +void handleNoteOff_MIDI_DEVICE_USB(byte inChannel, byte inNumber, byte inVelocity); +void handleControlChange_MIDI_DEVICE_USB(byte inChannel, byte inData1, byte inData2); +#endif +#endif