Jannes De Brabandere / USBDevice

Fork of USBDevice by mbed official

Files at this revision

API Documentation at this revision

Comitter:
alfaleader
Date:
Wed Jun 10 12:05:20 2015 +0000
Parent:
56:151ba33713ff
Child:
58:1039760d84c5
Commit message:
Added Midi Realtime (Clock) Message

Changed in this revision

USBMIDI/MIDIMessage.h Show annotated file Show diff for this revision Revisions of this file
USBMIDI/USBMIDI.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/USBMIDI/MIDIMessage.h	Mon Jun 08 08:15:25 2015 +0100
+++ b/USBMIDI/MIDIMessage.h	Wed Jun 10 12:05:20 2015 +0000
@@ -38,6 +38,10 @@
 // Program Change        0xC Program    -
 // Channel Aftertouch    0xD Pressure   -
 // Pitch Wheel           0xE LSB        MSB
+// MIDI Timing Clock     0xF8
+// MIDI Start            0xFA
+// MIDI Continue         0xFB
+// MIDI Stop             0xFC
 
 #define CABLE_NUM (0<<4)
 
@@ -197,7 +201,11 @@
         ChannelAftertouchType,
         PitchWheelType,
         AllNotesOffType,
-        SysExType
+        SysExType,
+        TimingType,
+        StartType,
+        ContinueType,
+        StopType  
     };
 
     /** Read the message type
@@ -219,7 +227,15 @@
             case 0xC: return ProgramChangeType;
             case 0xD: return ChannelAftertouchType;
             case 0xE: return PitchWheelType;
-            case 0xF: return SysExType;
+            case 0xF: : switch(data[1] & 0x0F){ //if sysex, see if it is something for midi clock
+                case 0x8: return TimingType;
+                case 0xA: return StartType;
+                case 0xB: return ContinueType;
+                case 0xC: return StopType;
+                default: return SysExType;
+                }
+            
+            
             default: return ErrorType;
         }
     }
--- a/USBMIDI/USBMIDI.cpp	Mon Jun 08 08:15:25 2015 +0100
+++ b/USBMIDI/USBMIDI.cpp	Wed Jun 10 12:05:20 2015 +0000
@@ -168,9 +168,9 @@
 
 uint8_t * USBMIDI::stringIproductDesc() {
     static uint8_t stringIproductDescriptor[] = {
-        0x16,                                                       //bLength
+        0x16,                                                       //bLength = size string + 2
         STRING_DESCRIPTOR,                                          //bDescriptorType 0x03
-        'M',0,'b',0,'e',0,'d',0,' ',0,'A',0,'u',0,'d',0,'i',0,'o',0 //bString iProduct - Mbed Audio
+        'E',0,'y',0,'e',0,'s',0,'t',0,'h',0,'e',0,'t',0,'i',0,'c',0 //bString iProduct - Mbed Audio
     };
     return stringIproductDescriptor;
 }