summaryrefslogtreecommitdiff
path: root/04_playobjects
diff options
context:
space:
mode:
authorComment <tim@gray.(none)>2013-06-18 00:18:18 +0100
committerComment <tim@gray.(none)>2013-06-18 00:18:18 +0100
commit020abd861215e391c6664c1f63d4dc0cf2fab833 (patch)
tree64a3623c9125f7f71c0992871cbcb484467d9f75 /04_playobjects
parent64a6e2cefebfe5f6d767f709ad8ca60362f47c0f (diff)
osc control
Diffstat (limited to '04_playobjects')
-rw-r--r--04_playobjects/addons.make1
-rw-r--r--04_playobjects/src/testApp.cpp23
-rw-r--r--04_playobjects/src/testApp.h15
3 files changed, 38 insertions, 1 deletions
diff --git a/04_playobjects/addons.make b/04_playobjects/addons.make
index 0b4df47..8777481 100644
--- a/04_playobjects/addons.make
+++ b/04_playobjects/addons.make
@@ -3,3 +3,4 @@ ofxFenster
ofxGui
ofxXmlSettings
ofxMayaCam
+ofxOsc \ No newline at end of file
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;
};