summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim <tim@Admins-Mac-Pro-2.local>2013-06-17 18:21:21 +0100
committerTim <tim@Admins-Mac-Pro-2.local>2013-06-17 18:21:21 +0100
commitb776ee99b8030346d4952aa81e5ec4535bb8aa3f (patch)
tree98f036ce90ee07c59032b1770f105f7938229069
parent2395f29308fb424eaf9b9ebb08022568a117b0f0 (diff)
OSX problems
-rw-r--r--04_playobjects/src/testApp.cpp14
-rw-r--r--04_playobjects/src/testApp.h26
-rw-r--r--05_pointcloud/src/testApp.cpp28
-rw-r--r--05_pointcloud/src/testApp.h1
4 files changed, 44 insertions, 25 deletions
diff --git a/04_playobjects/src/testApp.cpp b/04_playobjects/src/testApp.cpp
index 5683e1f..dac7306 100644
--- a/04_playobjects/src/testApp.cpp
+++ b/04_playobjects/src/testApp.cpp
@@ -8,9 +8,9 @@ void testApp::setup() {
verdana.loadFont(ofToDataPath("verdana.ttf"), 10);
playing=0;
- numDevices=2;
+ numDevices=1;
- string filename="test.xml"; //"TRSS_nesbitt_recordings.xml";
+ string filename="TRSS_nesbitt_recordings.xml";
if( !XML.loadFile(filename) ){
printf("unable to load recordings, check data/ folder\n");
@@ -28,7 +28,7 @@ void testApp::setup() {
*/
players.push_back(syncOniPlayer());
players[i].addPlayer(XML.getAttribute("rec","left","",i));
- players[i].addPlayer(XML.getAttribute("rec","right","",i));
+ if (numDevices>1) players[i].addPlayer(XML.getAttribute("rec","right","",i));
players[i].audio=XML.getAttribute("rec","audio","",i);
}
}
@@ -52,7 +52,7 @@ void testApp::setup() {
}
void testApp::startPlayers(int newplayer){
- players[playing].pause();
+ players[playing].stop();
playing=newplayer;
players[playing].play();
//for (int deviceID = 0; deviceID < numDevices; deviceID++){
@@ -104,6 +104,7 @@ void testApp::draw(){
ofSetColor(255, 255, 255);
string msg = "MILLIS: " + ofToString(ofGetElapsedTimeMillis());
msg += "\nFPS: " + ofToString(ofGetFrameRate());
+ msg += "\nclip: "+ofToString(playing);
msg += "\noffset: "+ofToString(offset);
verdana.drawString(msg, 10, 10);
}
@@ -115,14 +116,15 @@ void testApp::exit(){
//--------------------------------------------------------------
void testApp::keyPressed(int key){
+ cerr<<"key: "<<key<<endl;
int newplaying=playing;
switch (key) {
case ',':
newplaying=playing-1;
- if (newplaying<0) newplaying=numDevices-1;
+ if (newplaying<0) newplaying=players.size()-1;
break;
case '.':
- newplaying=(playing+1)%numDevices;
+ newplaying=(playing+1)%players.size();
break;
case 'z':
offset-=1;
diff --git a/04_playobjects/src/testApp.h b/04_playobjects/src/testApp.h
index b541207..a89c2f1 100644
--- a/04_playobjects/src/testApp.h
+++ b/04_playobjects/src/testApp.h
@@ -16,19 +16,15 @@ struct record{
class syncOniPlayer{
public:
~syncOniPlayer(){
- for (int i=0;i<players.size();i++) {
- players[i]->stop();
- delete players[i];
- }
+ stop();
}
void addPlayer(string name){
//ofxOpenNI *o=new ofxOpenNI;
//o->setupFromONI(name,true);
//o->setPaused(true);
//players.push_back(o);
- players.push_back(new ofxOpenNI);
- players[players.size()-1]->setupFromONI(name,true);
- players[players.size()-1]->setPaused(true);
+ players.push_back(NULL);
+ filenames.push_back(name);
//players[players.size()-1]->setSpeed(0.0f);
//players[players.size()-1]->setup(true);
//players[players.size()-1]->start();
@@ -36,7 +32,10 @@ class syncOniPlayer{
}
void play(){
for (int i=0;i<players.size();i++) {
- players[i]->setPaused(false);
+ players[i]=new ofxOpenNI();
+ players[i]->setSafeThreading(true);
+ players[i]->setupFromONI(filenames[i],true);
+ players[i]->start();
//players[players.size()-1]->setSpeed(1.0f);
}
}
@@ -58,9 +57,20 @@ class syncOniPlayer{
players[i]->drawImage(600, 0,520,390);
}
}
+ void stop(){
+ for (int i=0;i<players.size();i++) {
+ if (players[i]!=NULL) {
+ players[i]->stop();
+ delete players[i];
+ players[i]=NULL;
+ }
+ }
+ }
string audio;
+
private:
vector<ofxOpenNI*> players;
+ vector<string> filenames;
};
diff --git a/05_pointcloud/src/testApp.cpp b/05_pointcloud/src/testApp.cpp
index 6532b57..7e3d507 100644
--- a/05_pointcloud/src/testApp.cpp
+++ b/05_pointcloud/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";
@@ -29,7 +29,7 @@ void testApp::setup() {
else printf("no recordings!\n");
}
}
- ofxOpenNIUser user;
+
user.setUseMaskTexture(true);
user.setUsePointCloud(true);
user.setPointCloudDrawSize(2); // this is the size of the glPoint that will be drawn for the point cloud
@@ -38,11 +38,11 @@ void testApp::setup() {
for (int deviceID = 0; deviceID < numDevices; deviceID++){
//openNIPlayers[deviceID].stop();
- openNIPlayers[deviceID].setup(true);
- openNIPlayers[deviceID].addUserGenerator();
- openNIPlayers[deviceID].setRegister(true);
- openNIPlayers[deviceID].start();
- openNIPlayers[deviceID].setBaseUserClass(user);
+ //openNIPlayers[deviceID].setup(true);
+ //openNIPlayers[deviceID].addUserGenerator();
+ //openNIPlayers[deviceID].setRegister(true);
+ //openNIPlayers[deviceID].start();
+ //openNIPlayers[deviceID].setBaseUserClass(user);
//openNIPlayers[deviceID].startPlayer(ofToDataPath(recs[playing][deviceID]));
}
soundplayer.setLoop(false);
@@ -56,11 +56,17 @@ void testApp::setup() {
void testApp::startPlayers(){
for (int deviceID = 0; deviceID < numDevices; deviceID++){
+ //if (openNIPlayers[deviceID].isContextReady()) openNIPlayers[deviceID].stop();
+
+
//openNIPlayers[deviceID].stop();
- //openNIPlayers[deviceID].setup(false);
- //openNIPlayers[deviceID].start();
+ openNIPlayers[deviceID].setup(true);
+ openNIPlayers[deviceID].addUserGenerator();
+ openNIPlayers[deviceID].setRegister(true);
+ openNIPlayers[deviceID].start();
+ openNIPlayers[deviceID].setBaseUserClass(user);
openNIPlayers[deviceID].startPlayer(ofToDataPath(recs[playing].data[deviceID]));
- openNIPlayers[deviceID].setSpeed(0.01f);
+ //openNIPlayers[deviceID].setSpeed(0.01f);
//openNIPlayers[deviceID].setPaused(true);
@@ -77,7 +83,7 @@ void testApp::startPlayers(){
//--------------------------------------------------------------
void testApp::update(){
for (int deviceID = 0; deviceID < numDevices; deviceID++){
- openNIPlayers[deviceID].setFrame(frame);
+ //openNIPlayers[deviceID].setFrame(frame);
openNIPlayers[deviceID].update();
}
}
diff --git a/05_pointcloud/src/testApp.h b/05_pointcloud/src/testApp.h
index 67cd4dc..e850f01 100644
--- a/05_pointcloud/src/testApp.h
+++ b/05_pointcloud/src/testApp.h
@@ -33,6 +33,7 @@ public:
int numDevices;
ofxOpenNI openNIPlayers[MAX_DEVICES];
+ ofxOpenNIUser user;
int playing;