Created
September 28, 2016 10:55
-
-
Save tobetchi/6f11ad0020564a1e4853cb495713ac14 to your computer and use it in GitHub Desktop.
openFrameworks MIDI recieve sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ofMain.h" | |
#include "ofApp.h" | |
int main( ){ | |
ofSetupOpenGL(1024, 768, OF_WINDOW); | |
ofRunApp(new ofApp()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ofApp.h" | |
void ofApp::setup() { | |
// MIDI Setup | |
midiIn.listPorts(); | |
midiIn.openPort("Launchpad"); | |
midiIn.addListener(this); | |
} | |
void ofApp::newMidiMessage(ofxMidiMessage& msg) { | |
std::cout << "status:" << ofxMidiMessage::getStatusString(msg.status); | |
std::cout << " channel:" << msg.channel; | |
std::cout << " pitch:" << msg.pitch; | |
std::cout << " velocity:" << msg.velocity; | |
std::cout << " control:" << msg.control; | |
std::cout << " value:" << msg.value; | |
std::cout << " dt:" << msg.deltatime; | |
std::cout << std::endl; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include "ofMain.h" | |
#include "ofxMidi.h" | |
class ofApp : public ofBaseApp, public ofxMidiListener { | |
public: | |
void setup(); | |
private: | |
ofxMidiIn midiIn; | |
void newMidiMessage(ofxMidiMessage& msg); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment