A library to send and receive MIDI messages over USB using the default USB-MIDI drivers on Win/Mac

Dependents:   USBMIDI_HelloWorld USBMIDI_DrumExample USBMIDI_MonoSynth MIDI_Interface_ver_1 ... more

Committer:
simon
Date:
Sun Feb 20 13:10:05 2011 +0000
Revision:
1:ff74eabe02cd
Parent:
0:56b095524cf2
Child:
2:10d694d6ccdc
First version, supporting most USB MIDI functionality

Who changed what in which revision?

UserRevisionLine numberNew contents of line
simon 1:ff74eabe02cd 1 /** @license The MIT License
simon 1:ff74eabe02cd 2 * Copyright (c) 2011 mux, simon
simon 1:ff74eabe02cd 3 *
simon 1:ff74eabe02cd 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
simon 1:ff74eabe02cd 5 * of this software and associated documentation files (the "Software"), to deal
simon 1:ff74eabe02cd 6 * in the Software without restriction, including without limitation the rights
simon 1:ff74eabe02cd 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
simon 1:ff74eabe02cd 8 * copies of the Software, and to permit persons to whom the Software is
simon 1:ff74eabe02cd 9 * furnished to do so, subject to the following conditions:
simon 1:ff74eabe02cd 10 *
simon 1:ff74eabe02cd 11 * The above copyright notice and this permission notice shall be included in
simon 1:ff74eabe02cd 12 * all copies or substantial portions of the Software.
simon 1:ff74eabe02cd 13 *
simon 1:ff74eabe02cd 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
simon 1:ff74eabe02cd 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
simon 1:ff74eabe02cd 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
simon 1:ff74eabe02cd 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
simon 1:ff74eabe02cd 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
simon 1:ff74eabe02cd 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
simon 1:ff74eabe02cd 20 * THE SOFTWARE.
simon 1:ff74eabe02cd 21 */
simon 1:ff74eabe02cd 22
simon 0:56b095524cf2 23 #ifndef MBED_USBMIDI_H
simon 0:56b095524cf2 24 #define MBED_USBMIDI_H
simon 0:56b095524cf2 25
simon 0:56b095524cf2 26 #include "MIDIMessage.h"
simon 0:56b095524cf2 27
simon 1:ff74eabe02cd 28 /** USBMIDI interface class for sending and receiving MIDI messages over USB */
simon 0:56b095524cf2 29 class USBMIDI {
simon 0:56b095524cf2 30 public:
simon 1:ff74eabe02cd 31
simon 1:ff74eabe02cd 32 /** Create the USBMIDI interface */
simon 1:ff74eabe02cd 33 USBMIDI();
simon 1:ff74eabe02cd 34
simon 1:ff74eabe02cd 35 /** Send a MIDIMessage
simon 1:ff74eabe02cd 36 * @param m The MIDIMessage to send
simon 1:ff74eabe02cd 37 */
simon 1:ff74eabe02cd 38 void write(MIDIMessage m);
simon 1:ff74eabe02cd 39
simon 1:ff74eabe02cd 40 /** Check if it possible to send a MIDIMessage
simon 1:ff74eabe02cd 41 * @returns True if there's an empty buffer for sending a MIDIMessage, otherwise False
simon 1:ff74eabe02cd 42 */
simon 1:ff74eabe02cd 43 bool writeable();
simon 1:ff74eabe02cd 44
simon 1:ff74eabe02cd 45 /** Attach a callback for when a MIDIEvent is received */
simon 1:ff74eabe02cd 46 void attach(void (*fptr)(MIDIMessage));
simon 1:ff74eabe02cd 47
simon 0:56b095524cf2 48 };
simon 0:56b095524cf2 49
simon 0:56b095524cf2 50 #endif