diff options
Diffstat (limited to '06_performance/src')
| -rw-r--r-- | 06_performance/src/main.cpp | 4 | ||||
| -rw-r--r-- | 06_performance/src/oni.cpp | 2 | ||||
| -rw-r--r-- | 06_performance/src/testApp.cpp | 71 | ||||
| -rw-r--r-- | 06_performance/src/testApp.h | 9 |
4 files changed, 78 insertions, 8 deletions
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 + |
