From 577e61af4e08eb4b9f68f27343802f65a8fcddb0 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 14 Jun 2013 18:19:11 +0100 Subject: making audio sync --- 03_play/Makfile | 4 +++ 03_play/bin/data/TRSS_nesbitt_recordings.xml | 46 +++++++++++++-------------- 03_play/bin/data/tone0.wav | Bin 03_play/bin/data/tone1.wav | Bin 03_play/src/testApp.cpp | 19 +++++++---- 03_play/src/testApp.h | 11 +++++-- 6 files changed, 47 insertions(+), 33 deletions(-) mode change 100644 => 100755 03_play/bin/data/tone0.wav mode change 100644 => 100755 03_play/bin/data/tone1.wav diff --git a/03_play/Makfile b/03_play/Makfile index 10b7e43..0d8b4a1 100644 --- a/03_play/Makfile +++ b/03_play/Makfile @@ -92,6 +92,10 @@ ifeq ($(findstring Release,$(MAKECMDGOALS)),Release) TARGET = bin/$(BIN_NAME) endif +ifeq ($(findstring Release,$(MAKECMDGOALS)),clang) + CXX = clang +endif + ifeq ($(MAKECMDGOALS),) TARGET_NAME = Release BIN_NAME = $(APPNAME) diff --git a/03_play/bin/data/TRSS_nesbitt_recordings.xml b/03_play/bin/data/TRSS_nesbitt_recordings.xml index 251824c..ed139e7 100644 --- a/03_play/bin/data/TRSS_nesbitt_recordings.xml +++ b/03_play/bin/data/TRSS_nesbitt_recordings.xml @@ -1,29 +1,29 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/03_play/bin/data/tone0.wav b/03_play/bin/data/tone0.wav old mode 100644 new mode 100755 diff --git a/03_play/bin/data/tone1.wav b/03_play/bin/data/tone1.wav old mode 100644 new mode 100755 diff --git a/03_play/src/testApp.cpp b/03_play/src/testApp.cpp index 3670a8b..e990ea8 100644 --- a/03_play/src/testApp.cpp +++ b/03_play/src/testApp.cpp @@ -19,9 +19,10 @@ void testApp::setup() { int num=XML.getNumTags("rec"); if(num) { for (int i=0;i rec; - rec.push_back(XML.getAttribute("rec","left","",i)); - rec.push_back(XML.getAttribute("rec","right","",i)); + record rec; + rec.data.push_back(XML.getAttribute("rec","left","",i)); + rec.data.push_back(XML.getAttribute("rec","right","",i)); + rec.audio=XML.getAttribute("rec","audio","",i); recs.push_back(rec); } } @@ -35,10 +36,10 @@ void testApp::setup() { openNIPlayers[deviceID].start(); //openNIPlayers[deviceID].startPlayer(ofToDataPath(recs[playing][deviceID])); } - soundplayer.loadSound("02.wav"); + soundplayer.setLoop(false); startPlayers(); - ofSetFrameRate(25.0f); + //ofSetFrameRate(25.0f); } void testApp::startPlayers(){ @@ -46,10 +47,14 @@ void testApp::startPlayers(){ //openNIPlayers[deviceID].stop(); //openNIPlayers[deviceID].setup(false); //openNIPlayers[deviceID].start(); - openNIPlayers[deviceID].startPlayer(ofToDataPath(recs[playing][deviceID])); + openNIPlayers[deviceID].startPlayer(ofToDataPath(recs[playing].data[deviceID])); + soundplayer.stop(); soundplayer.setPosition(0.0f); - soundplayer.play(); + if (recs[playing].audio!=""){ + soundplayer.loadSound(recs[playing].audio); + soundplayer.play(); + } } } diff --git a/03_play/src/testApp.h b/03_play/src/testApp.h index a276a59..c162d2b 100644 --- a/03_play/src/testApp.h +++ b/03_play/src/testApp.h @@ -7,6 +7,11 @@ #define MAX_DEVICES 2 +struct record{ + vector data; + string audio; +}; + class testApp : public ofBaseApp{ public: @@ -32,13 +37,13 @@ public: ofTrueTypeFont verdana; - vector > recs; - ofxXmlSettings XML; - vector > filenames; + vector recs; ofSoundPlayer soundplayer; + + float offset; }; -- cgit v1.2.3