diff options
Diffstat (limited to 'gui/src')
| -rw-r--r-- | gui/src/ofApp.cpp | 44 | ||||
| -rw-r--r-- | gui/src/ofApp.h | 10 |
2 files changed, 35 insertions, 19 deletions
diff --git a/gui/src/ofApp.cpp b/gui/src/ofApp.cpp index 57c5b51..1457b74 100644 --- a/gui/src/ofApp.cpp +++ b/gui/src/ofApp.cpp @@ -50,6 +50,11 @@ void ofApp::setup(){ framecounter=0; + //============================ MIDI + + midiIn.listPorts(); + midiIn.openPort(0); + midiIn.addListener(this); //======================================= //positioning interface @@ -843,23 +848,26 @@ void ofApp::dragEvent(ofDragInfo dragInfo){ } - //printf("%s at %i %i \n",dragInfo.files.begin(),dragInfo.position.x,dragInfo.position.y); - //std::string filenames; - //cout << dragInfo.files.begin()->c_str()<<","<<dragInfo.position.x<<","<<dragInfo.position.y<<std::endl; - - //for (auto f = dragInfo.files.begin(); f != dragInfo.files.end(); f++){ - // cout << f->c_str()<<","<<dragInfo.position.x<<","<<dragInfo.position.y<<std::endl; - //if (f!=dragInfo.files.begin()){ - // filenames=filenames+", "; - //} - //} - // filenames=filenames+*f; - - // if (dragInfo.position.y<200){ - // sets[0].addfiles(dragInfo.files); //,dragInfo.position); - // } - // else sets[1].addfiles(dragInfo.files); //,dragInfo.position); +void ofApp::newMidiMessage(ofxMidiMessage& msg) { + //column 0 for general controls - - //} + int offset; + + //=============================================== + offset=0; + + if (msg.channel==1&&msg.control==1+offset){ + //pot + } + if (msg.channel==1&&msg.control==65+offset){ + //top button + } + if (msg.channel==1&&msg.control==73+offset){ + //bottom button + } + if (msg.channel==1&&msg.control==81+offset){ + //fader + laser_intensity=msg.value*2; + } +} diff --git a/gui/src/ofApp.h b/gui/src/ofApp.h index 5f26ad1..6148613 100644 --- a/gui/src/ofApp.h +++ b/gui/src/ofApp.h @@ -10,6 +10,7 @@ #include "lineSegmenter.h" #include "ofxXmlSettings.h" #include "ofxClipper.h" +#include "ofxMidi.h" enum Source{ TEST, @@ -20,7 +21,7 @@ enum Source{ Source_end }; -class ofApp: public ofBaseApp { +class ofApp: public ofBaseApp, public ofxMidiListener { public: void setup(); @@ -38,6 +39,8 @@ class ofApp: public ofBaseApp { void mouseExited(int x, int y); void windowResized(int w, int h); void dragEvent(ofDragInfo dragInfo); + + void newMidiMessage(ofxMidiMessage& eventArgs); void updateOutput(ofEventArgs & args); void drawOutput(ofEventArgs & args); @@ -110,6 +113,11 @@ class ofApp: public ofBaseApp { ofxFloatSlider segmenter_length; ofxIntSlider segmenter_number; + //======================================= //MIDI + + ofxMidiIn midiIn; + ofxMidiMessage midiMessage; + //======================================= //video player ofVideoPlayer movie; |
