diff --git a/MicroMDAEPiano.ino b/MicroMDAEPiano.ino index 51f7038..9f0efef 100644 --- a/MicroMDAEPiano.ino +++ b/MicroMDAEPiano.ino @@ -337,38 +337,74 @@ void loop() 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) + 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) + 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 } @@ -378,12 +414,24 @@ void handleControlChange_MIDI_DEVICE_DIN(byte inChannel, byte inData1, byte inDa 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 } @@ -391,12 +439,25 @@ void handleNoteOn_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNumber, byte inVel 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 } @@ -404,12 +465,24 @@ void handleNoteOff_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNumber, byte inVe 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 } @@ -419,12 +492,24 @@ void handleControlChange_MIDI_DEVICE_USB_HOST(byte inChannel, byte inData1, byte 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 } @@ -432,12 +517,24 @@ void handleNoteOn_MIDI_DEVICE_USB(byte inChannel, byte inNumber, byte inVelocity 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 } @@ -445,12 +542,24 @@ void handleNoteOff_MIDI_DEVICE_USB(byte inChannel, byte inNumber, byte inVelocit 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 } diff --git a/name.c b/name.c new file mode 100644 index 0000000..f08fcfb --- /dev/null +++ b/name.c @@ -0,0 +1,11 @@ +#include "usb_names.h" +#define MIDI_NAME {'M','i','c','r','o','M','D','A','E','p','i','a','n','o'} +#define MIDI_NAME_LEN 14 + +// Do not change this part. This exact format is required by USB. + +struct usb_string_descriptor_struct usb_string_product_name = { + 2 + MIDI_NAME_LEN * 2, + 3, + MIDI_NAME +};