Added debug output for MIDI events.

Added USB MIDI name.
master
Holger Wirtz 6 years ago
parent b5d4743693
commit 2e529a0e25
  1. 113
      MicroMDAEPiano.ino
  2. 11
      name.c

@ -337,38 +337,74 @@ void loop()
void handleNoteOn_MIDI_DEVICE_DIN(byte inChannel, byte inNumber, byte inVelocity) void handleNoteOn_MIDI_DEVICE_DIN(byte inChannel, byte inNumber, byte inVelocity)
{ {
handleNoteOn(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_MERGE_THRU
#ifdef MIDI_DEVICE_USB_HOST #ifdef MIDI_DEVICE_USB_HOST
midi_usb.send(midi::NoteOn, inNumber, inVelocity, inChannel); midi_usb.send(midi::NoteOn, inNumber, inVelocity, inChannel);
#ifdef DEBUG
Serial.print(F(" THRU->MIDI_USB_HOST"));
#endif
#endif #endif
#ifdef MIDI_DEVICE_USB #ifdef MIDI_DEVICE_USB
midi_onboard_usb.send(midi::NoteOn, inNumber, inVelocity, inChannel); 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
#endif #endif
} }
void handleNoteOff_MIDI_DEVICE_DIN(byte inChannel, byte inNumber, byte inVelocity) 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_MERGE_THRU
#ifdef MIDI_DEVICE_USB_HOST #ifdef MIDI_DEVICE_USB_HOST
midi_usb.send(midi::NoteOff, inNumber, inVelocity, inChannel); midi_usb.send(midi::NoteOff, inNumber, inVelocity, inChannel);
#ifdef DEBUG
Serial.print(F(" THRU->MIDI_USB_HOST"));
#endif
#endif #endif
#ifdef MIDI_DEVICE_USB #ifdef MIDI_DEVICE_USB
midi_onboard_usb.send(midi::NoteOff, inNumber, inVelocity, inChannel); 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
#endif #endif
} }
void handleControlChange_MIDI_DEVICE_DIN(byte inChannel, byte inData1, byte inData2) 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_MERGE_THRU
#ifdef MIDI_DEVICE_USB_HOST #ifdef MIDI_DEVICE_USB_HOST
midi_usb.send(midi::ControlChange, inData1, inData2, inChannel); midi_usb.send(midi::ControlChange, inData1, inData2, inChannel);
#ifdef DEBUG
Serial.print(F(" THRU->MIDI_USB_HOST"));
#endif
#endif #endif
#ifdef MIDI_DEVICE_USB #ifdef MIDI_DEVICE_USB
midi_onboard_usb.send(midi::ControlChange, inData1, inData2, inChannel); 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 #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) void handleNoteOn_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNumber, byte inVelocity)
{ {
handleNoteOn(inChannel, inNumber, inVelocity); handleNoteOn(inChannel, inNumber, inVelocity);
#ifdef DEBUG
Serial.print(F("[MIDI_USB_HOST] NoteOn"));
#endif
#ifdef MIDI_MERGE_THRU #ifdef MIDI_MERGE_THRU
#ifdef MIDI_DEVICE_DIN #ifdef MIDI_DEVICE_DIN
midi_serial.send(midi::NoteOn, inNumber, inVelocity, inChannel); midi_serial.send(midi::NoteOn, inNumber, inVelocity, inChannel);
#ifdef DEBUG
Serial.print(F(" THRU->MIDI_DIN"));
#endif
#endif #endif
#ifdef MIDI_DEVICE_USB #ifdef MIDI_DEVICE_USB
midi_onboard_usb.send(midi::NoteOn, inNumber, inVelocity, inChannel); 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
#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) void handleNoteOff_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNumber, byte inVelocity)
{ {
handleNoteOff(inChannel, inNumber, inVelocity); handleNoteOff(inChannel, inNumber, inVelocity);
#ifdef DEBUG
Serial.print(F("[MIDI_USB_HOST] NoteOff"));
#endif
#ifdef MIDI_MERGE_THRU #ifdef MIDI_MERGE_THRU
#ifdef MIDI_DEVICE_DIN #ifdef MIDI_DEVICE_DIN
midi_serial.send(midi::NoteOff, inNumber, inVelocity, inChannel); midi_serial.send(midi::NoteOff, inNumber, inVelocity, inChannel);
#ifdef DEBUG
Serial.print(F(" THRU->MIDI_DIN"));
#endif
#endif #endif
#ifdef MIDI_DEVICE_USB #ifdef MIDI_DEVICE_USB
midi_onboard_usb.send(midi::NoteOff, inNumber, inVelocity, inChannel); 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
#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) void handleControlChange_MIDI_DEVICE_USB_HOST(byte inChannel, byte inData1, byte inData2)
{ {
handleControlChange(inChannel, inData1, inData2); handleControlChange(inChannel, inData1, inData2);
#ifdef DEBUG
Serial.print(F("[MIDI_USB_HOST] CC"));
#endif
#ifdef MIDI_MERGE_THRU #ifdef MIDI_MERGE_THRU
#ifdef MIDI_DEVICE_DIN #ifdef MIDI_DEVICE_DIN
midi_serial.send(midi::ControlChange, inData1, inData2, inChannel); midi_serial.send(midi::ControlChange, inData1, inData2, inChannel);
#ifdef DEBUG
Serial.print(F(" THRU->MIDI_DIN"));
#endif
#endif #endif
#ifdef MIDI_DEVICE_USB #ifdef MIDI_DEVICE_USB
midi_onboard_usb.send(midi::ControlChange, inData1, inData2, inChannel); 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 #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) void handleNoteOn_MIDI_DEVICE_USB(byte inChannel, byte inNumber, byte inVelocity)
{ {
handleNoteOn(inChannel, inNumber, inVelocity); handleNoteOn(inChannel, inNumber, inVelocity);
#ifdef DEBUG
Serial.print(F("[MIDI_USB] NoteOn"));
#endif
#ifdef MIDI_MERGE_THRU #ifdef MIDI_MERGE_THRU
#ifdef MIDI_DEVICE_DIN #ifdef MIDI_DEVICE_DIN
midi_serial.send(midi::NoteOn, inNumber, inVelocity, inChannel); midi_serial.send(midi::NoteOn, inNumber, inVelocity, inChannel);
#ifdef DEBUG
Serial.print(F(" THRU->MIDI_DIN"));
#endif
#endif #endif
#ifdef MIDI_DEVICE_USB_HOST #ifdef MIDI_DEVICE_USB_HOST
midi_usb.send(midi::NoteOn, inNumber, inVelocity, inChannel); 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
#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) void handleNoteOff_MIDI_DEVICE_USB(byte inChannel, byte inNumber, byte inVelocity)
{ {
handleNoteOff(inChannel, inNumber, inVelocity); handleNoteOff(inChannel, inNumber, inVelocity);
#ifdef DEBUG
Serial.print(F("[MIDI_USB] NoteOff"));
#endif
#ifdef MIDI_MERGE_THRU #ifdef MIDI_MERGE_THRU
#ifdef MIDI_DEVICE_DIN #ifdef MIDI_DEVICE_DIN
midi_serial.send(midi::NoteOff, inNumber, inVelocity, inChannel); midi_serial.send(midi::NoteOff, inNumber, inVelocity, inChannel);
#ifdef DEBUG
Serial.print(F(" THRU->MIDI_DIN"));
#endif
#endif #endif
#ifdef MIDI_DEVICE_USB_HOST #ifdef MIDI_DEVICE_USB_HOST
midi_usb.send(midi::NoteOff, inNumber, inVelocity, inChannel); 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
#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) void handleControlChange_MIDI_DEVICE_USB(byte inChannel, byte inData1, byte inData2)
{ {
handleControlChange(inChannel, inData1, inData2); handleControlChange(inChannel, inData1, inData2);
#ifdef DEBUG
Serial.print(F("[MIDI_USB] CC"));
#endif
#ifdef MIDI_MERGE_THRU #ifdef MIDI_MERGE_THRU
#ifdef MIDI_DEVICE_DIN #ifdef MIDI_DEVICE_DIN
midi_serial.send(midi::ControlChange, inData1, inData2, inChannel); midi_serial.send(midi::ControlChange, inData1, inData2, inChannel);
#ifdef DEBUG
Serial.print(F(" THRU->MIDI_DIN"));
#endif
#endif #endif
#ifdef MIDI_DEVICE_USB_HOST #ifdef MIDI_DEVICE_USB_HOST
midi_usb.send(midi::ControlChange, inData1, inData2, inChannel); 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 #endif
} }

@ -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
};
Loading…
Cancel
Save