From 04bc6345764e55ae249a622030f26496a0586541 Mon Sep 17 00:00:00 2001 From: Comment Date: Tue, 18 Jun 2013 22:34:30 +0100 Subject: steaming pile of crap --- 03_play/src/testApp.cpp | 23 +++--- .../bin/data/TRSS_nesbitt_recordings.xml | 91 ++++++++++++++++++++++ 04_playobjects/src/testApp.cpp | 30 ++++--- 04_playobjects/src/testApp.h | 75 +++++++++++++++--- 4 files changed, 186 insertions(+), 33 deletions(-) create mode 100644 04_playobjects/bin/data/TRSS_nesbitt_recordings.xml diff --git a/03_play/src/testApp.cpp b/03_play/src/testApp.cpp index c8dc261..1688ef3 100644 --- a/03_play/src/testApp.cpp +++ b/03_play/src/testApp.cpp @@ -8,7 +8,7 @@ void testApp::setup() { verdana.loadFont(ofToDataPath("verdana.ttf"), 10); playing=0; - numDevices=2; + numDevices=1; string filename="TRSS_nesbitt_recordings.xml"; @@ -48,27 +48,28 @@ void testApp::setup() { void testApp::startPlayers(){ for (int deviceID = 0; deviceID < numDevices; deviceID++){ //openNIPlayers[deviceID].stop(); - //openNIPlayers[deviceID].setup(false); - //openNIPlayers[deviceID].start(); + openNIPlayers[deviceID].setup(true); + usleep(100000); + openNIPlayers[deviceID].start(); openNIPlayers[deviceID].startPlayer(ofToDataPath(recs[playing].data[deviceID])); - openNIPlayers[deviceID].setSpeed(0.01f); + //openNIPlayers[deviceID].setSpeed(0.01f); //openNIPlayers[deviceID].setPaused(true); - soundplayer.stop(); + //soundplayer.stop(); - if (recs[playing].audio!=""){ - soundplayer.loadSound(recs[playing].audio); - soundplayer.play(); - soundplayer.setPosition(offset); - } + //if (recs[playing].audio!=""){ + // soundplayer.loadSound(recs[playing].audio); + // soundplayer.play(); + // soundplayer.setPosition(offset); + //} } } //-------------------------------------------------------------- void testApp::update(){ for (int deviceID = 0; deviceID < numDevices; deviceID++){ - openNIPlayers[deviceID].setFrame(frame); + //openNIPlayers[deviceID].setFrame(frame); openNIPlayers[deviceID].update(); } } diff --git a/04_playobjects/bin/data/TRSS_nesbitt_recordings.xml b/04_playobjects/bin/data/TRSS_nesbitt_recordings.xml new file mode 100644 index 0000000..550aae0 --- /dev/null +++ b/04_playobjects/bin/data/TRSS_nesbitt_recordings.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +#48 tracks +#36 audio, long ones 1,24,36 +#11 segments in poem +# long + take + take + long + take + long seems correct! +# how wrong we can be \ No newline at end of file diff --git a/04_playobjects/src/testApp.cpp b/04_playobjects/src/testApp.cpp index c1850f9..6351282 100644 --- a/04_playobjects/src/testApp.cpp +++ b/04_playobjects/src/testApp.cpp @@ -21,7 +21,9 @@ void testApp::setup() { for (int i=0;i1) players[i].addPlayer(XML.getAttribute("rec","right","",i)); + if (numDevices==2) { + players[i].addPlayer(XML.getAttribute("rec","right","",i)); + } players[i].audio=XML.getAttribute("rec","audio","",i); } } @@ -34,20 +36,14 @@ void testApp::setup() { receiver.setup(OSCPORT); - user.setUseMaskTexture(true); - user.setUsePointCloud(true); - user.setPointCloudDrawSize(2); // this is the size of the glPoint that will be drawn for the point cloud - user.setPointCloudResolution(2); // this is the step size between points for the cloud -> eg., this sets it to every second point - - drawmovies=false;drawcloud=true; + drawmovies=false;drawcloud=false; } void testApp::startPlayers(int newplayer){ if (playing>-1) players[playing].stop(); - soundplayer.stop(); usleep(100000); playing=newplayer; - players[playing].play(user); + players[playing].play(); } //-------------------------------------------------------------- @@ -82,8 +78,19 @@ void testApp::draw(){ ofPushMatrix(); - if (drawmovies) players[playing].drawWindows(); - if (drawmovies) players[playing].drawCloud(); + if (playing>-1) { + if (drawmovies) { + players[playing].drawWindows(); + } + + if (drawcloud) { + cam.begin(); + ofTranslate(ofGetWidth()/2, ofGetHeight()/2,0); + players[playing].drawCloud(); + ofDrawAxis(100); + cam.end(); + } + } ofPopMatrix(); @@ -93,6 +100,7 @@ void testApp::draw(){ msg += "\nclip: "+ofToString(playing); if (playing>-1) msg += "\n"+players[playing].audio; msg += "\noffset: "+ofToString(offset); + if (drawcloud>-1) msg += "\nwith cloud"; verdana.drawString(msg, 10, 10); } diff --git a/04_playobjects/src/testApp.h b/04_playobjects/src/testApp.h index 0de2207..32e6dad 100644 --- a/04_playobjects/src/testApp.h +++ b/04_playobjects/src/testApp.h @@ -4,6 +4,7 @@ #include "ofxOpenNI.h" #include "ofMain.h" #include "ofxXmlSettings.h" +#include "ofxMayaCam.h" #include "ofxOsc.h" @@ -35,21 +36,22 @@ class syncOniPlayer{ //players[players.size()-1]->start(); //players[players.size()-1]->startPlayer(name); } - void play(ofxOpenNIUser user){ + void play(){ for (int i=0;isetSafeThreading(true); - players[i]->setupFromONI(filenames[i],true); - players[i]->addUserGenerator(); - players[i]->setRegister(true); + players[i]->setupFromONI(filenames[i],false); + //players[i]->addDepthGenerator(); + //players[i]->addImageGenerator(); + //players[i]->setRegister(true); players[i]->setLooped(false); - players[i]->setBaseUserClass(user); + //players[i]->setBaseUserClass(user); players[i]->start(); //players[players.size()-1]->setSpeed(1.0f); if (audio!="") { soundplayer.loadSound(audio); soundplayer.play(); - } + }; } } void update(){ @@ -63,29 +65,81 @@ class syncOniPlayer{ players[i]->setPaused(true); } } + int getCurrentFrame(){ + if (players.size()) return players[0]->getCurrentFrame(); + else return -1; + } void drawWindows(){ for (int i=0;idrawDepth(50, 0,520,390); players[i]->drawImage(600, 0,520,390); } } void drawCloud(){ + /* + int num=0; for (int i=0;igetNumTrackedUsers(); for (int nID = 0; nID < numUsers; nID++){ ofxOpenNIUser & user = players[i]->getTrackedUser(nID); - user.drawMask(); + //user.drawMask(); ofPushMatrix(); - ofTranslate(ofGetWidth()/2, ofGetHeight()/2, -1000); + ofTranslate(0,0,-1000); user.drawPointCloud(); ofPopMatrix(); } + num+=numUsers; ofDisableBlendMode(); ofPopMatrix(); } + return num; + */ + //cerr<<"drawing "<getDepthGenerator().GetDepthMap(); + //uint16_t* depthpixels=depthmap.getPixels(); + int range=2500; + + if (players[i]==NULL) { + cerr<<"more spooky shit....!"; + return; + } + int dmw=players[i]->getWidth(); + + for (int i=0;igetWidth();i+=2) { + + glBegin(GL_LINES); + + for (int j=0;jgetHeight();j+=2) { + + + + ofPoint p= players[i]->projectiveToWorld(ofPoint(i,j,(float)(depthmap[j*dmw+i]))); + //ofPoint p= projectiveToWorld(ofPoint(i,j,(float)depthmap[j*dmw+i])); + + if (p.z == 0 || p.z>range) continue; // gets rid of background -> still a bit weird if userID > 0... //&& isCPBkgnd + //ofColor color = kinect->getColorAt(x,y); //userID); + //if (col) glColor4ub((unsigned char)color.r, (unsigned char)color.g, (unsigned char)color.b, (unsigned char)color.a); + // else + + + glColor4ub((unsigned char)255, (unsigned char)255, (unsigned char)255, (unsigned char)255); + glVertex3f(p.x, p.y, p.z); + //if (i==320&&j==160) cerr<<"world point: "< players; - ofSoundPlayer soundplayer; - ofxOscReceiver receiver; bool drawmovies,drawcloud; int offset; + + ofxMayaCam cam; }; -- cgit v1.2.3