diff options
| author | Tim <tim@Admins-Mac-Pro-2.local> | 2013-06-20 13:40:43 +0100 |
|---|---|---|
| committer | Tim <tim@Admins-Mac-Pro-2.local> | 2013-06-20 13:40:43 +0100 |
| commit | 138e1b84ee55246bd70e1ca21155de16690ea86d (patch) | |
| tree | 36e02333d75e12105b4c9779fd307ed740254a0d /06_performance/src/testApp.cpp | |
| parent | d836325685bfcb269a46881fc0cb67628f15bc11 (diff) | |
looking good
Diffstat (limited to '06_performance/src/testApp.cpp')
| -rw-r--r-- | 06_performance/src/testApp.cpp | 71 |
1 files changed, 66 insertions, 5 deletions
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; + } + } + } + } //-------------------------------------------------------------- |
