my midi test

Dependencies:   USBDevice mbed

main.cpp

Committer:
kb10uy
Date:
2014-12-28
Revision:
1:a17d202e9a68
Parent:
0:4fc8ef3908b1

File content as of revision 1:a17d202e9a68:

#include "mbed.h"
#include "USBMIDI.h"
//#include <string>
//#include <sstream>

DigitalOut myled(LED1);
USBMIDI midi;

/*string str;*/
bool valid = false;

void mm(MIDIMessage m) {
    //ostringstream os;
    /*
    switch(m.type()) {
        case MIDIMessage::NoteOnType:
            os << "note on ch" << m.channel() << " key" << m.key();
            break;
        case MIDIMessage::NoteOffType:
            os << "note off ch" << m.channel() << " key" << m.key();
            break;
        case MIDIMessage::ControlChangeType:
            os << "note ctrl chg ch" << m.channel() << " key" << m.key();
            break;
        case MIDIMessage::ProgramChangeType:
            os << "note prog chg ch" << m.channel() << " key" << m.key();
            break;
        case MIDIMessage::AllNotesOffType:
            os << "all notes off";
            break;
    }*/
    //str="received";//os.str();
    val=true;
}

int main() {
    midi.attach(&mm);
    while(1) {
        if (valid) {
            valid=false;
            //printf("%s\r\n",/*str.c_str()*/);
        }
        wait_ms(1);
    }
}