diff options
| author | Comment <tim@gray.(none)> | 2013-06-16 15:17:38 +0100 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2013-06-16 15:17:38 +0100 |
| commit | f714b852416caeaa20c91c9b0336a7d067e28ddb (patch) | |
| tree | ab6f3ac12c5413b762899b797aff784d1a1c5b15 /04_playobjects/src/testApp.h | |
| parent | 10cda57dfc85867fcce98c83eb057d7ae4cfb381 (diff) | |
unsuccessful attempt to wrap oni player
Diffstat (limited to '04_playobjects/src/testApp.h')
| -rw-r--r-- | 04_playobjects/src/testApp.h | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/04_playobjects/src/testApp.h b/04_playobjects/src/testApp.h new file mode 100644 index 0000000..b541207 --- /dev/null +++ b/04_playobjects/src/testApp.h @@ -0,0 +1,106 @@ +#ifndef _TEST_APP +#define _TEST_APP + +#include "ofxOpenNI.h" +#include "ofMain.h" +#include "ofxXmlSettings.h" + +#define MAX_DEVICES 2 + +struct record{ + vector<string> data; + string audio; +}; + +//in order to play diffferent clips it seems necessary to have a player per clip +class syncOniPlayer{ + public: + ~syncOniPlayer(){ + for (int i=0;i<players.size();i++) { + players[i]->stop(); + delete players[i]; + } + } + 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[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;i<players.size();i++) { + players[i]->setPaused(false); + //players[players.size()-1]->setSpeed(1.0f); + } + } + void update(){ + for (int i=0;i<players.size();i++) { + players[i]->update(); + } + } + void pause(){ + for (int i=0;i<players.size();i++) { + //players[players.size()-1]->setSpeed(0.0f); + players[i]->setPaused(true); + } + } + void draw(){ + 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); + } + } + string audio; + private: + vector<ofxOpenNI*> players; + +}; + +//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<syncOniPlayer> players; + + ofSoundPlayer soundplayer; + + int offset; + +}; + +#endif |
