summaryrefslogtreecommitdiff
path: root/04_playobjects
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 /04_playobjects
parent2395f29308fb424eaf9b9ebb08022568a117b0f0 (diff)
OSX problems
Diffstat (limited to '04_playobjects')
-rw-r--r--04_playobjects/src/testApp.cpp14
-rw-r--r--04_playobjects/src/testApp.h26
2 files changed, 26 insertions, 14 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;
};