#ifndef _TEST_APP #define _TEST_APP #include "ofxOpenNI.h" #include "ofMain.h" #include "ofxXmlSettings.h" #define MAX_DEVICES 2 struct record{ vector data; string audio; }; //in order to play diffferent clips it seems necessary to have a player per clip class syncOniPlayer{ public: ~syncOniPlayer(){ stop(); } void addPlayer(string name){ //ofxOpenNI *o=new ofxOpenNI; //o->setupFromONI(name,true); //o->setPaused(true); //players.push_back(o); 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(); //players[players.size()-1]->startPlayer(name); } void play(){ for (int i=0;isetSafeThreading(true); players[i]->setupFromONI(filenames[i],true); players[i]->start(); //players[players.size()-1]->setSpeed(1.0f); } } void update(){ for (int i=0;iupdate(); } } void pause(){ for (int i=0;isetSpeed(0.0f); players[i]->setPaused(true); } } void draw(){ for (int i=0;idrawDepth(50, 0,520,390); players[i]->drawImage(600, 0,520,390); } } void stop(){ for (int i=0;istop(); delete players[i]; players[i]=NULL; } } } string audio; private: vector players; vector filenames; }; //however creating losts of ofxOpenNI doesn't seem viable //we know we want to play seperate clips //however we know that when we stop and start a player it comes back single threaded class testApp : public ofBaseApp{ public: void setup(); void update(); void draw(); void exit(); void keyPressed (int key); void keyReleased(int key); void mouseMoved(int x, int y ); void mouseDragged(int x, int y, int button); void mousePressed(int x, int y, int button); void mouseReleased(int x, int y, int button); void windowResized(int w, int h); void startPlayers(int which); int numDevices; ofxOpenNI openNIPlayers[MAX_DEVICES]; int playing; ofTrueTypeFont verdana; ofxXmlSettings XML; vector players; ofSoundPlayer soundplayer; int offset; }; #endif