summaryrefslogtreecommitdiff
path: root/04_playobjects/src/testApp.cpp
diff options
context:
space:
mode:
Diffstat (limited to '04_playobjects/src/testApp.cpp')
-rw-r--r--04_playobjects/src/testApp.cpp23
1 files changed, 23 insertions, 0 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);
}