summaryrefslogtreecommitdiff
path: root/06_performance
diff options
context:
space:
mode:
authorTim <tim@Admins-Mac-Pro-2.local>2013-06-20 13:40:43 +0100
committerTim <tim@Admins-Mac-Pro-2.local>2013-06-20 13:40:43 +0100
commit138e1b84ee55246bd70e1ca21155de16690ea86d (patch)
tree36e02333d75e12105b4c9779fd307ed740254a0d /06_performance
parentd836325685bfcb269a46881fc0cb67628f15bc11 (diff)
looking good
Diffstat (limited to '06_performance')
-rwxr-xr-x06_performance/addons.make3
-rwxr-xr-x06_performance/config.mak4
-rw-r--r--06_performance/src/main.cpp4
-rw-r--r--06_performance/src/oni.cpp2
-rw-r--r--06_performance/src/testApp.cpp71
-rw-r--r--06_performance/src/testApp.h9
6 files changed, 82 insertions, 11 deletions
diff --git a/06_performance/addons.make b/06_performance/addons.make
index b301b3a..40e65eb 100755
--- a/06_performance/addons.make
+++ b/06_performance/addons.make
@@ -1,4 +1,5 @@
+ofxOpenNI
ofxXmlSettings
ofxMidi
-ofxOpenNI
+ofxOsc
diff --git a/06_performance/config.mak b/06_performance/config.mak
index caf7203..cb19ecf 100755
--- a/06_performance/config.mak
+++ b/06_performance/config.mak
@@ -10,7 +10,7 @@ OF_ROOT = ../../../../../
# for example search paths like:
# USER_CFLAGS = -I src/objects
-#USER_CFLAGS = -I $(OF_ROOT)/addons/ofxOpenNI/include/openni -I $(OF_ROOT)/addons/ofxOpenNI/include/nite -I $(OF_ROOT)/addons/ofxOpenNI/src
+USER_CFLAGS = -I $(OF_ROOT)/addons/ofxOpenNI/include/openni -I $(OF_ROOT)/addons/ofxOpenNI/include/nite -I $(OF_ROOT)/addons/ofxOpenNI/src
# USER_LDFLAGS allows to pass custom flags to the linker
@@ -18,7 +18,7 @@ OF_ROOT = ../../../../../
# USER_LDFLAGS = libs/libawesomelib.a
#USER_LDFLAGS = -lOpenNI
-#USER_LDFLAGS = -L bin/data/openni/lib -L ../../../data/openni/lib/libusb-1.0.0.dylib -lOpenNI
+USER_LDFLAGS = -L bin/data/openni/lib -L ../../../data/openni/lib/libusb-1.0.0.dylib -lOpenNI
EXCLUDE_FROM_SOURCE="bin,.xcodeproj,obj"
diff --git a/06_performance/src/main.cpp b/06_performance/src/main.cpp
index 20767a2..d85180c 100644
--- a/06_performance/src/main.cpp
+++ b/06_performance/src/main.cpp
@@ -4,8 +4,8 @@
//========================================================================
int main( ){
- //ofSetupOpenGL(4080,768, OF_WINDOW); // <-------- setup the GL context
- ofSetupOpenGL(1224,232, OF_WINDOW); // <-------- setup the GL context
+ ofSetupOpenGL(4080,768, OF_WINDOW); // <-------- setup the GL context
+ //ofSetupOpenGL(1224,232, OF_WINDOW); // <-------- setup the GL context
diff --git a/06_performance/src/oni.cpp b/06_performance/src/oni.cpp
index 550d56e..0cd5efc 100644
--- a/06_performance/src/oni.cpp
+++ b/06_performance/src/oni.cpp
@@ -134,7 +134,7 @@ void oniManager::init(const char* filename){
void oniManager::startPlayer(int newplayer){
if (players.size()>newplayer){
if (playing>-1) players[playing].stop();
- usleep(100000);
+ usleep(500000);
playing=newplayer;
players[playing].play();
}
diff --git a/06_performance/src/testApp.cpp b/06_performance/src/testApp.cpp
index ac1391b..6bc31a7 100644
--- a/06_performance/src/testApp.cpp
+++ b/06_performance/src/testApp.cpp
@@ -17,11 +17,11 @@ void testApp::setup(){
midiIn.listPorts();
- midiIn.openPort(1); //this was 1 on linux
+ midiIn.openPort(0); //this was 1 on linux, 0 on OSX
midiIn.addListener(this);
midiOut.listPorts();
- midiOut.openPort(1); //this was 1 on linux
+ midiOut.openPort(0); //this was 1 on linux, 0 on OSX
// 0 output channeLs,
// 2 input channels
@@ -34,7 +34,7 @@ void testApp::setup(){
left = new float[BUFFER_SIZE];
right = new float[BUFFER_SIZE];
- soundStream.setDeviceID(0);
+ //soundStream.setDeviceID(0);
soundStream.setup(this, 0, 2, 44100, BUFFER_SIZE, 4);
ofSetHexColor(0x666666);
@@ -68,7 +68,8 @@ void testApp::setup(){
I_movieSource=0;
I_moviePlaying=0;
- renderImage.allocate(ofGetWidth(),ofGetHeight(),GL_RGB);
+ //renderImage.allocate(ofGetWidth(),ofGetHeight(),GL_RGB);
+ renderImage.allocate(4080,768,GL_RGB);
maskShader.load("composite");
//testImage.loadImage("mask.png");
@@ -142,10 +143,30 @@ void testApp::setup(){
setMidiState();
+ receiver.setup(OSCPORT);
+
target.setPosition(0,0,0);
camera.setPosition(0,0,-700);
camera.lookAt(target,ofVec3f(0,1,0));
narrator.init("TRSS_nesbitt_recordings.xml");
+
+ if( !XML.loadFile("videos.xml") ){
+ printf("unable to load videos, check data/ folder\n");
+ }else{
+ if(XML.pushTag("TRSS")) {
+ int num=XML.getNumTags("video");
+ if(num) {
+ int i;
+ for (i=0;i<num;i++) {
+ videoclips.push_back(ofVideoPlayer());
+ videoclips[i].loadMovie(XML.getAttribute("video","file","",i));
+ videoclips.setLoopState(OF_LOOP_NONE);
+ }
+ cerr<<"loaded "<<i<<" video clips"<<endl;
+ }
+ else printf("no video clips found!\n");
+ }
+ }
}
@@ -153,6 +174,21 @@ void testApp::setup(){
//--------------------------------------------------------------
void testApp::update(){
+ // check for waiting messages
+ while(receiver.hasWaitingMessages()){
+ // get the next message
+ ofxOscMessage m;
+ receiver.getNextMessage(&m);
+
+ cerr<<m.getAddress()<<" "<<m.getArgAsInt32(0)<<endl;
+
+ if(m.getAddress() == "/video/"){
+ // the arguments is int32
+ int clipToPlay = m.getArgAsInt32(0);
+
+ }
+ }
+
if (I_movieSource!=I_moviePlaying) {
blendImage.stop();
@@ -178,6 +214,8 @@ void testApp::update(){
blendImage.setSpeed(F_movieSpeed);
//blendImage.idleMovie();
+ for (int i=0;i<videoclips.size();i++) videoclips[i].update();
+
narrator.update();
}
@@ -185,6 +223,9 @@ void testApp::update(){
void testApp::draw(){
ofSetVerticalSync(B_vSync);
+
+
+
static int index=0;
float lavg_power = 0.0f;
float ravg_power = 0.0f;
@@ -248,6 +289,11 @@ void testApp::draw(){
}
+ ofSetColor(255,255,255);
+ for (int i=0;i<videoclips.size();i++) {
+ if (videoclips[i].isPlaying()) videoclips[i].draw(ofGetWidth()/3,0,ofGetWidth()/3,ofGetHeight());
+ }
+
F_xRotation+=(F_xRotate*interval);
F_yRotation+=(F_yRotate*interval);
F_zRotation+=(F_zRotate*interval);
@@ -419,6 +465,8 @@ void testApp::draw(){
*/
+
+
ofEnableAlphaBlending();
maskShader.begin();
@@ -463,7 +511,7 @@ void testApp::draw(){
glPopMatrix();
*/
-
+
if (showFPS) {
ofDrawBitmapString(ofToString(ofGetFrameRate(), 2),20,20);
@@ -488,6 +536,19 @@ void testApp::keyPressed (int key){
if(key == '.'){
narrator.next();
}
+ if(key>='1'&key<='9'){
+ int clip=key-'1';
+ cerr<<"playing video clip "<<clip<<endl;
+ if (videoclips.size()>clip) videoclips[clip].play();
+ }
+ if(key == 't'){
+ for (int i=0;i<videoclips.size();i++) {
+ if (videoclips[i].isPlaying()) {
+ cerr<<"videoclip "<<i<<" is playing"<<endl;
+ }
+ }
+ }
+
}
//--------------------------------------------------------------
diff --git a/06_performance/src/testApp.h b/06_performance/src/testApp.h
index b1c086c..02ab1ec 100644
--- a/06_performance/src/testApp.h
+++ b/06_performance/src/testApp.h
@@ -4,6 +4,9 @@
#include "ofMain.h"
#include "fft.h"
#include "FFTOctaveAnalyzer.h"
+#include "ofxOsc.h"
+
+#define OSCPORT 12345
#include "oni.h"
@@ -163,7 +166,13 @@ class testApp : public ofBaseApp, public ofxMidiListener{
ofCamera camera;
ofNode target;
oniManager narrator;
+
+ ofxXmlSettings XML;
+ vector<ofVideoPlayer> videoclips;
+
+ ofxOscReceiver receiver;
};
#endif
+