diff options
Diffstat (limited to '04_playobjects/src')
| -rw-r--r-- | 04_playobjects/src/testApp.cpp | 23 | ||||
| -rw-r--r-- | 04_playobjects/src/testApp.h | 15 |
2 files changed, 37 insertions, 1 deletions
diff --git a/04_playobjects/src/testApp.cpp b/04_playobjects/src/testApp.cpp index 360d0b0..6b525e1 100644 --- a/04_playobjects/src/testApp.cpp +++ b/04_playobjects/src/testApp.cpp @@ -31,6 +31,8 @@ void testApp::setup() { //ofSetFrameRate(25.0f); offset=0.0f; + + receiver.setup(OSCPORT); } void testApp::startPlayers(int newplayer){ @@ -43,6 +45,26 @@ void testApp::startPlayers(int newplayer){ //-------------------------------------------------------------- void testApp::update(){ + + int newplaying=playing; + + // check for waiting messages + while(receiver.hasWaitingMessages()){ + // get the next message + ofxOscMessage m; + receiver.getNextMessage(&m); + + cerr<<m.getAddress()<<m.getArgAsInt32(0)<<endl; + + // check for mouse moved message + if(m.getAddress() == "/clip/"){ + // the arguments is int32 + newplaying = m.getArgAsInt32(0); + } + } + + if (newplaying!=playing) startPlayers(newplaying); + players[playing].update(); } @@ -61,6 +83,7 @@ void testApp::draw(){ string msg = "MILLIS: " + ofToString(ofGetElapsedTimeMillis()); msg += "\nFPS: " + ofToString(ofGetFrameRate()); msg += "\nclip: "+ofToString(playing); + if (playing>-1) msg += "\n"+players[playing].audio; msg += "\noffset: "+ofToString(offset); verdana.drawString(msg, 10, 10); } diff --git a/04_playobjects/src/testApp.h b/04_playobjects/src/testApp.h index 5bbb0c2..223bc9d 100644 --- a/04_playobjects/src/testApp.h +++ b/04_playobjects/src/testApp.h @@ -5,6 +5,10 @@ #include "ofMain.h" #include "ofxXmlSettings.h" +#include "ofxOsc.h" + +#define OSCPORT 12345 + #define MAX_DEVICES 2 struct record{ @@ -56,7 +60,14 @@ class syncOniPlayer{ players[i]->setPaused(true); } } - void draw(){ + void drawWindows(){ + for (int i=0;i<players.size();i++) { + ofTranslate(0, i * 400); + players[i]->drawDepth(50, 0,520,390); + players[i]->drawImage(600, 0,520,390); + } + } + void drawCloud(){ for (int i=0;i<players.size();i++) { ofTranslate(0, i * 400); players[i]->drawDepth(50, 0,520,390); @@ -117,6 +128,8 @@ public: ofSoundPlayer soundplayer; + ofxOscReceiver receiver; + int offset; }; |
