From 1a7e15a63d78a6351028d977b90052f6b0d6bf7d Mon Sep 17 00:00:00 2001 From: Comment Date: Fri, 28 Jun 2013 23:32:10 +0100 Subject: first performance version --- 06_performance/src/testApp.cpp | 176 ++++++++++++++++++++++++++++++----------- 1 file changed, 132 insertions(+), 44 deletions(-) (limited to '06_performance/src/testApp.cpp') diff --git a/06_performance/src/testApp.cpp b/06_performance/src/testApp.cpp index e1f6d71..0c1f4bb 100644 --- a/06_performance/src/testApp.cpp +++ b/06_performance/src/testApp.cpp @@ -34,7 +34,7 @@ void testApp::setup(){ left = new float[BUFFER_SIZE]; right = new float[BUFFER_SIZE]; - //soundStream.setDeviceID(0); + //soundStream.setDeviceID(7); //ignore to use default? soundStream.setup(this, 0, 2, 44100, BUFFER_SIZE, 4); //soundStream.setup(this, 0, 4, 44100, BUFFER_SIZE, 4); @@ -54,6 +54,10 @@ void testApp::setup(){ rFFTanalyzer.linearEQIntercept = 0.9f; // reduced gain at lowest frequency rFFTanalyzer.linearEQSlope = 0.01f; // increasing gain at higher frequencies +<<<<<<< HEAD +/* +======= +>>>>>>> fd8dc2aa23c4bbc297e835e4f920aaf5342aba5e if (4chan) { lFFTanalyzer2.setup(44100, BUFFER_SIZE/2,32); @@ -70,6 +74,10 @@ void testApp::setup(){ rFFTanalyzer2.linearEQIntercept = 0.9f; // reduced gain at lowest frequency rFFTanalyzer2.linearEQSlope = 0.01f; // increasing gain at higher frequencies } +<<<<<<< HEAD + */ +======= +>>>>>>> fd8dc2aa23c4bbc297e835e4f920aaf5342aba5e ofSetFrameRate(60); @@ -106,7 +114,11 @@ void testApp::setup(){ F_drawFrames=10; F_drawStep=0; F_drawDecay=0.95; +<<<<<<< HEAD + F_lineWidth=1.0; //1.0; +======= F_lineWidth=16.0; //1.0; +>>>>>>> fd8dc2aa23c4bbc297e835e4f920aaf5342aba5e F_drawAxis=90; //Y @@ -120,6 +132,10 @@ void testApp::setup(){ F_particleAmount=2000; //100 F_particleLife=0.75; //0.5 +<<<<<<< HEAD + F_particleSize=16.0; //1.0; +======= +>>>>>>> fd8dc2aa23c4bbc297e835e4f920aaf5342aba5e I_fade1=0; I_fade2=0; @@ -153,8 +169,8 @@ void testApp::setup(){ B_glitch=false; - blanker.allocate(64,64,OF_IMAGE_COLOR); - // blanker.loadImage("black.png"); + //blanker.allocate(64,64,OF_IMAGE_COLOR); + blanker.loadImage("black.png"); fullScreen=false; @@ -179,7 +195,12 @@ void testApp::setup(){ videoclips.push_back(ofVideoPlayer()); videoclips[i].loadMovie(XML.getAttribute("video","file","",i)); videoclips[i].setLoopState(OF_LOOP_NONE); +<<<<<<< HEAD + videoclips[i].play(); + videoclips[i].setSpeed(0.0f); +======= videoclips[i].stop(); +>>>>>>> fd8dc2aa23c4bbc297e835e4f920aaf5342aba5e } cerr<<"loaded "<>>>>>> fd8dc2aa23c4bbc297e835e4f920aaf5342aba5e }; @@ -206,36 +233,59 @@ void testApp::update(){ ofxOscMessage m; receiver.getNextMessage(&m); + + ///mrmr/pushbutton/6/Pauls-iPad 1000 vector path; explode(m.getAddress(),'/', back_inserter(path)); - + cerr<<"OSC: "<1) { - string type=path[1]; - int channel=ofToInt(path[2])-1; - int data=m.getArgAsInt32(0); - - cerr<<"type: "< -1)&&videoclips.size()>channel) { - if (data>0) { - cerr<<"playing video "< -1)&&narrator.getNumClips()>channel) { - if (data>0) { - cerr<<"playing narrator "<3){ + if (path[2]=="pushbutton"){ + int channel=ofToInt(path[3]); + if (channel>12) channel--; //12 is missing + if (m.getArgAsInt32(0)==1000) { + //for (int i=0;i -1)&&videoclips.size()>channel) { + if (data>0) { + cerr<<"playing video "< -1)&&narrator.getNumClips()>channel) { + if (data>0) { //???doesn't seem to work + cerr<<"playing narrator "<0.0f) videoclips[i].update(); + if (videoclips[i].getPosition()>0.99f) videoclips[i].setSpeed(0.0f); +======= videoclips[i].update(); if (videoclips[i].getPosition()>0.99f) videoclips[i].stop(); +>>>>>>> fd8dc2aa23c4bbc297e835e4f920aaf5342aba5e } narrator.update(); @@ -335,10 +390,13 @@ void testApp::draw(){ if (B_glitch) { - //glEnable(GL_BLEND); - //glBlendFunc(GL_CONSTANT_COLOR,GL_ONE); - //glBlendColor(1.0f,1.0f,1.0f,0.9f); - //blanker.draw(0,0,ofGetWidth(),ofGetHeight()); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); + //glBlendColor(1.0f,1.0f,1.0f,((float)I_fade2)/255.0f); + ofSetColor(255,255,255,I_fade2); + blanker.draw(0,0,renderImage.getWidth(),renderImage.getHeight()); + glDisable(GL_BLEND); + } else { glClear(GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT); @@ -374,8 +432,8 @@ void testApp::draw(){ glFogfv(GL_FOG_COLOR, fogColor); glFogf(GL_FOG_DENSITY,1.0 ); glHint(GL_FOG_HINT, GL_DONT_CARE); - glFogf(GL_FOG_START, ofGetWidth()*(0.25+F_drawDecay)); - glFogf(GL_FOG_END, ofGetWidth()*(0.75+F_drawDecay)); + glFogf(GL_FOG_START, ofGetHeight()*(0.1+(F_drawDecay*5))); + glFogf(GL_FOG_END, ofGetHeight()*(0.5+(F_drawDecay*5))); glEnable(GL_FOG); //reverse draw order when looking from back @@ -411,11 +469,11 @@ void testApp::draw(){ if (B_fill) { glBegin(GL_QUAD_STRIP); for (int i = 0; i < lFFTanalyzer.nAverages-1; i++){ - glVertex3f((i*xStep)-hw,-(FFTbuffer[0][i][fB] * F_scale),0); + glVertex3f((i*xStep)-hw,(FFTbuffer[0][i][fB] * F_scale),0); glVertex3f((i*xStep)-hw,0,0); } for (int i =lFFTanalyzer.nAverages, k=lFFTanalyzer.nAverages-1; i < lFFTanalyzer.nAverages+rFFTanalyzer.nAverages; i++, k--){ - glVertex3f((i*xStep)-hw,-(FFTbuffer[1][(lFFTanalyzer.nAverages+rFFTanalyzer.nAverages)-(i+1)][fB] * F_scale),0); + glVertex3f((i*xStep)-hw,(FFTbuffer[1][(lFFTanalyzer.nAverages+rFFTanalyzer.nAverages)-(i+1)][fB] * F_scale),0); glVertex3f((i*xStep)-hw,0,0); } glEnd(); @@ -426,10 +484,10 @@ void testApp::draw(){ ofSetColor(I_fade1,I_fade1,I_fade1); glBegin(GL_LINE_STRIP); for (int i = 0; i < lFFTanalyzer.nAverages; i++){ - glVertex3f((i*xStep)-hw,-(FFTbuffer[0][i][fB] * F_scale),0); + glVertex3f((i*xStep)-hw,(FFTbuffer[0][i][fB] * F_scale),0); } for (int i =lFFTanalyzer.nAverages, k=lFFTanalyzer.nAverages-1; i < lFFTanalyzer.nAverages+rFFTanalyzer.nAverages; i++, k--){ - glVertex3f((i*xStep)-hw,-(FFTbuffer[1][(lFFTanalyzer.nAverages+rFFTanalyzer.nAverages)-(i+1)][fB] * F_scale),0); + glVertex3f((i*xStep)-hw,(FFTbuffer[1][(lFFTanalyzer.nAverages+rFFTanalyzer.nAverages)-(i+1)][fB] * F_scale),0); } glEnd(); ofPopMatrix(); @@ -439,7 +497,11 @@ void testApp::draw(){ ofPopMatrix(); for (int i=0;i0.0f) { +======= if (videoclips[i].isPlaying()) { +>>>>>>> fd8dc2aa23c4bbc297e835e4f920aaf5342aba5e if (videoclips[i].getPosition()<0.1f) { glEnable(GL_BLEND); uint8_t b=uint8_t((videoclips[i].getPosition()/0.1f)*255); @@ -456,6 +518,17 @@ void testApp::draw(){ glDisable(GL_BLEND); } } +<<<<<<< HEAD + + ofPushMatrix(); + //ofTranslate(hw,hh); + camera.begin(); + ofRotateX(F_xRotation); + ofRotateY(F_yRotation); + ofRotateZ(F_zRotation); + + ofPushMatrix(); +======= ofPushMatrix(); //ofTranslate(hw,hh); @@ -465,13 +538,14 @@ void testApp::draw(){ ofRotateZ(F_zRotation); ofPushMatrix(); +>>>>>>> fd8dc2aa23c4bbc297e835e4f920aaf5342aba5e //ofTranslate(0,-100,-1050); ofScale(sModel,sModel,sModel); //ofTranslate(xModel*sModel,yModel*sModel,zModel*sModel); ofTranslate(xModel,yModel,zModel); //narrator.drawCloud(2); - narrator.drawPoints(F_lineWidth,F_particleAmount,F_particleLife,F_particleX,F_particleY,F_particleZ); + narrator.drawPoints(F_particleSize,F_particleAmount,F_particleLife,F_particleX,F_particleY,F_particleZ); ofPopMatrix(); ofSetColor(255,255,255); @@ -610,7 +684,14 @@ void testApp::draw(){ msg+="\n"+ofToString(narrator.getNumParticles())+" size "+ofToString(F_lineWidth); msg+="\n"+ofToString(xModel)+","+ofToString(yModel)+","+ofToString(zModel)+" * "+ofToString(sModel); syncOniPlayer *player=narrator.getCurrentPlayer(); +<<<<<<< HEAD + if (player) { + msg+="\n"+ofToString(player->getCurrentFrame())+","+ofToString(player->getPosition(),2); + msg+=player->getCurrentFile(); + } +======= if (player) msg+="\n"+ofToString(player->getCurrentFrame())+","+ofToString(player->getPosition(),2); +>>>>>>> fd8dc2aa23c4bbc297e835e4f920aaf5342aba5e ofDrawBitmapString(msg,20,20); } } @@ -625,6 +706,9 @@ void testApp::keyPressed (int key){ fullScreen=!fullScreen; ofSetFullscreen(fullScreen); } + if(key == '/'){ + narrator.startPlayer(23); + } if(key == ','){ narrator.previous(); } @@ -634,11 +718,14 @@ void testApp::keyPressed (int key){ if(key>='1'&key<='9'){ int clip=key-'1'; cerr<<"playing video clip "<clip) videoclips[clip].play(); + if (videoclips.size()>clip) { + videoclips[clip].setPosition(0.0f); + videoclips[clip].setSpeed(1.0f); + } } if(key == 't'){ for (int i=0;i0.0f) { cerr<<"videoclip "<