summaryrefslogtreecommitdiff
path: root/03_play/src/testApp.cpp
diff options
context:
space:
mode:
authorComment <tim@gray.(none)>2013-06-13 00:10:35 +0100
committerComment <tim@gray.(none)>2013-06-13 00:10:35 +0100
commit71582d96b78a52747c65c1aaf89d00e0a7d408a0 (patch)
treea48713749cf26f476f343b69641d187aebd3ad67 /03_play/src/testApp.cpp
parent08bd1788cc640f4f6595152cd27f1922bea7d76c (diff)
investigating sound sync
Diffstat (limited to '03_play/src/testApp.cpp')
-rw-r--r--03_play/src/testApp.cpp55
1 files changed, 39 insertions, 16 deletions
diff --git a/03_play/src/testApp.cpp b/03_play/src/testApp.cpp
index 74f0799..3670a8b 100644
--- a/03_play/src/testApp.cpp
+++ b/03_play/src/testApp.cpp
@@ -10,7 +10,9 @@ void testApp::setup() {
playing=0;
numDevices=2;
- if( !XML.loadFile("TRSS_nesbitt_recordings.xml") ){
+ string filename="TRSS_nesbitt_recordings.xml";
+
+ if( !XML.loadFile(filename) ){
printf("unable to load recordings, check data/ folder\n");
}else{
if(XML.pushTag("TRSS")) {
@@ -26,12 +28,28 @@ void testApp::setup() {
else printf("no recordings!\n");
}
}
+ for (int deviceID = 0; deviceID < numDevices; deviceID++){
+ //openNIPlayers[deviceID].stop();
+ openNIPlayers[deviceID].setup(true);
+ openNIPlayers[deviceID].start();
+ //openNIPlayers[deviceID].startPlayer(ofToDataPath(recs[playing][deviceID]));
+ }
+ soundplayer.loadSound("02.wav");
+ startPlayers();
+ ofSetFrameRate(25.0f);
+}
+
+void testApp::startPlayers(){
for (int deviceID = 0; deviceID < numDevices; deviceID++){
- openNIPlayers[deviceID].setup(false);
- openNIPlayers[deviceID].start();
+ //openNIPlayers[deviceID].stop();
+ //openNIPlayers[deviceID].setup(false);
+ //openNIPlayers[deviceID].start();
openNIPlayers[deviceID].startPlayer(ofToDataPath(recs[playing][deviceID]));
+
+ soundplayer.setPosition(0.0f);
+ soundplayer.play();
}
}
@@ -50,17 +68,18 @@ void testApp::draw(){
ofPushMatrix();
for (int deviceID = 0; deviceID < numDevices; deviceID++){
- ofTranslate(0, deviceID * 450);
+ ofTranslate(0, deviceID * 400);
//openNIPlayers[deviceID].drawDebug();
- openNIPlayers[deviceID].drawDepth(200, 0,600,450);
- openNIPlayers[deviceID].drawImage(800, 0,600,450);
+ openNIPlayers[deviceID].drawDepth(50, 0,520,390);
+ openNIPlayers[deviceID].drawImage(600, 0,520,390);
}
ofPopMatrix();
ofSetColor(255, 255, 255);
- string msg = "MILLIS: " + ofToString(ofGetElapsedTimeMillis()) + "\nFPS: " + ofToString(ofGetFrameRate());
-
+ string msg = "MILLIS: " + ofToString(ofGetElapsedTimeMillis());
+ msg += "\nFPS: " + ofToString(ofGetFrameRate());
+ msg += "\nset: "+ofToString(playing);
verdana.drawString(msg, 10, 10);
}
@@ -73,21 +92,25 @@ void testApp::exit(){
//--------------------------------------------------------------
void testApp::keyPressed(int key){
+ bool changed=false;
switch (key) {
- case '.':
+ case ',':
if (playing==0) playing=recs.size();
playing--;
- for (int deviceID = 0; deviceID < numDevices; deviceID++){
- openNIPlayers[deviceID].startPlayer(ofToDataPath(recs[playing][deviceID]));
- }
+ changed=true;
break;
- case ',':
+ case '.':
playing=(playing+1)%recs.size();
- for (int deviceID = 0; deviceID < numDevices; deviceID++){
- openNIPlayers[deviceID].startPlayer(ofToDataPath(recs[playing][deviceID]));
- }
+ changed=true;
+ break;
+ case 'z':
+ soundplayer.setPosition(soundplayer.getPosition()-.04f);
+ break;
+ case 'x':
+ soundplayer.setPosition(soundplayer.getPosition()+.04f);
break;
}
+ if (changed) startPlayers();
/* why do this?
switch (key) {