summaryrefslogtreecommitdiff
path: root/06_performance/src/testApp.cpp
diff options
context:
space:
mode:
authorComment <tim@gray.(none)>2013-06-29 12:34:21 +0100
committerComment <tim@gray.(none)>2013-06-29 12:34:21 +0100
commitb0464b8b1f4496a35a6ad3a6bfac5cc9e02101ea (patch)
treef8b6e9c30530b7fabdf7496afb40edc4fe04c195 /06_performance/src/testApp.cpp
parent1a7e15a63d78a6351028d977b90052f6b0d6bf7d (diff)
fixed after performance version, baffling
Diffstat (limited to '06_performance/src/testApp.cpp')
-rw-r--r--06_performance/src/testApp.cpp132
1 files changed, 51 insertions, 81 deletions
diff --git a/06_performance/src/testApp.cpp b/06_performance/src/testApp.cpp
index 0c1f4bb..ffdc895 100644
--- a/06_performance/src/testApp.cpp
+++ b/06_performance/src/testApp.cpp
@@ -54,10 +54,9 @@ 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);
@@ -76,8 +75,7 @@ void testApp::setup(){
}
<<<<<<< HEAD
*/
-=======
->>>>>>> fd8dc2aa23c4bbc297e835e4f920aaf5342aba5e
+
ofSetFrameRate(60);
@@ -114,11 +112,9 @@ 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
@@ -132,10 +128,8 @@ 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;
@@ -195,12 +189,8 @@ 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
+ //videoclips[i].play();
+ //videoclips[i].setSpeed(0.0f);
}
cerr<<"loaded "<<i<<" video clips"<<endl;
}
@@ -208,17 +198,14 @@ void testApp::setup(){
}
}
+ int videoplaying=-1;
+
xOffs=startX=yOffs=startY=0;
xModel=0;
-<<<<<<< HEAD
yModel=-25;
zModel=-1050;
sModel=3.5f;
-=======
- yModel=0;
- zModel=-550;
- sModel=4.0f;
->>>>>>> fd8dc2aa23c4bbc297e835e4f920aaf5342aba5e
+
};
@@ -235,7 +222,7 @@ void testApp::update(){
///mrmr/pushbutton/6/Pauls-iPad 1000
-
+
vector<string> path;
explode(m.getAddress(),'/', back_inserter(path));
@@ -249,12 +236,14 @@ void testApp::update(){
int channel=ofToInt(path[3]);
if (channel>12) channel--; //12 is missing
if (m.getArgAsInt32(0)==1000) {
- //for (int i=0;i<videoclips.size();i++) {
- // videoclips[i].stop();
- // videoclips[i].setPosition(0.01f);
- //}
- videoclips[channel].setPosition(0.0f);
- videoclips[channel].setSpeed(1.0f);
+ if (videoplaying>-1&&videoclips.size()>channel) {
+ videoclips[videoplaying].stop();
+ videoclips[videoplaying].setPosition(0.0f);
+ }
+ //videoclips[channel].setPosition(0.0f);
+ //videoclips[channel].setSpeed(1.0f);
+ videoplaying=channel;
+ videoclips[channel].play();
}
}
}
@@ -271,8 +260,14 @@ void testApp::update(){
if ((channel > -1)&&videoclips.size()>channel) {
if (data>0) {
cerr<<"playing video "<<channel<<endl;
- videoclips[channel].setPosition(0.0f);
- videoclips[channel].setSpeed(1.0f);
+ if (videoplaying>-1&&videoclips.size()>channel) {
+ videoclips[videoplaying].stop();
+ videoclips[videoplaying].setPosition(0.0f);
+ }
+ //videoclips[channel].setPosition(0.0f);
+ //videoclips[channel].setSpeed(1.0f);
+ videoplaying=channel;
+ videoclips[channel].play();
}
}
}
@@ -314,15 +309,11 @@ void testApp::update(){
blendImage.setSpeed(F_movieSpeed);
//blendImage.idleMovie();
- for (int i=0;i<videoclips.size();i++) {
-<<<<<<< HEAD
- if (videoclips[i].getSpeed()>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
- }
+ if (videoplaying>-1&&videoclips.size()>videoplaying) videoclips[videoplaying].update();
+ //if (videoclips[i].getSpeed()>0.01f) videoclips[i].update();
+ //if (videoclips[i].getPosition()>0.99f) videoclips[i].setSpeed(0.0f);
+ //if (videoclips[i].isPlaying()) videoclips[i].stop();
+ //}
narrator.update();
@@ -336,7 +327,7 @@ void testApp::draw(){
ofSetVerticalSync(B_vSync);
-
+
static int index=0;
float lavg_power = 0.0f;
float ravg_power = 0.0f;
@@ -403,7 +394,7 @@ void testApp::draw(){
}
-
+
F_xRotation+=(F_xRotate*interval);
F_yRotation+=((F_yRotate+xOffs)*interval);
@@ -496,40 +487,22 @@ void testApp::draw(){
ofPopMatrix();
- for (int i=0;i<videoclips.size();i++) {
-<<<<<<< HEAD
- if (videoclips[i].getSpeed()>0.0f) {
-=======
- if (videoclips[i].isPlaying()) {
->>>>>>> fd8dc2aa23c4bbc297e835e4f920aaf5342aba5e
- if (videoclips[i].getPosition()<0.1f) {
+ if (videoplaying>-1&&videoclips.size()>videoplaying) {
+ if (videoclips[videoplaying].getPosition()<0.1f) {
glEnable(GL_BLEND);
- uint8_t b=uint8_t((videoclips[i].getPosition()/0.1f)*255);
+ uint8_t b=uint8_t((videoclips[videoplaying].getPosition()/0.1f)*255);
ofSetColor(255,255,255,b);
}
- else if (videoclips[i].getPosition()>0.8f) {
+ else if (videoclips[videoplaying].getPosition()>0.8f) {
glEnable(GL_BLEND);
- uint8_t b=uint8_t((1.0f-((videoclips[i].getPosition()-0.8f)/0.2f))*255);
+ uint8_t b=uint8_t((1.0f-((videoclips[videoplaying].getPosition()-0.8f)/0.2f))*255);
ofSetColor(255,255,255,b);
}
else ofSetColor(255,255,255);
- videoclips[i].draw(0,0,renderImage.getWidth()/3,renderImage.getHeight());
- videoclips[i].draw(renderImage.getWidth()*0.666666667,0,renderImage.getWidth()/3,renderImage.getHeight());
+ videoclips[videoplaying].draw(0,0,renderImage.getWidth()/3,renderImage.getHeight());
+ videoclips[videoplaying].draw(renderImage.getWidth()*0.666666667,0,renderImage.getWidth()/3,renderImage.getHeight());
glDisable(GL_BLEND);
- }
}
-<<<<<<< HEAD
-
- ofPushMatrix();
- //ofTranslate(hw,hh);
- camera.begin();
- ofRotateX(F_xRotation);
- ofRotateY(F_yRotation);
- ofRotateZ(F_zRotation);
-
- ofPushMatrix();
-=======
-
ofPushMatrix();
//ofTranslate(hw,hh);
camera.begin();
@@ -538,12 +511,11 @@ 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_particleSize,F_particleAmount,F_particleLife,F_particleX,F_particleY,F_particleZ);
ofPopMatrix();
@@ -684,14 +656,10 @@ 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();
+ msg+="\n"+player->getCurrentFile();
}
-=======
- if (player) msg+="\n"+ofToString(player->getCurrentFrame())+","+ofToString(player->getPosition(),2);
->>>>>>> fd8dc2aa23c4bbc297e835e4f920aaf5342aba5e
ofDrawBitmapString(msg,20,20);
}
}
@@ -719,13 +687,15 @@ void testApp::keyPressed (int key){
int clip=key-'1';
cerr<<"playing video clip "<<clip<<endl;
if (videoclips.size()>clip) {
- videoclips[clip].setPosition(0.0f);
- videoclips[clip].setSpeed(1.0f);
+ videoclips[videoplaying].stop();
+ videoclips[videoplaying].setPosition(0.0f);
+ videoclips[clip].play();
+ videoplaying=clip;
}
}
if(key == 't'){
for (int i=0;i<videoclips.size();i++) {
- if (videoclips[i].getSpeed()>0.0f) {
+ if (videoclips[i].isPlaying()) {
cerr<<"videoclip "<<i<<" is playing"<<endl;
}
}
@@ -764,21 +734,21 @@ void testApp::keyPressed (int key){
F_particleX-=1;
}
if(key == 'k'){
-
+
F_particleX+=1;
}
if(key == 'm'){
F_particleY-=1;
}
if(key == 'u'){
-
+
F_particleY+=1;
}
if(key == 'i'){
F_particleZ+=1;
}
if(key == 'n'){
-
+
F_particleZ-=1;
}