summaryrefslogtreecommitdiff
path: root/06_performance/src/testApp.cpp
diff options
context:
space:
mode:
authorTim <tim@lan184-102.dhcp.ulster.ac.uk>2013-06-20 18:25:10 +0100
committerTim <tim@lan184-102.dhcp.ulster.ac.uk>2013-06-20 18:25:10 +0100
commit1ffdeed6aedb75809255050261af16849cad2258 (patch)
tree191eece9b5994902598f0415ceb2ffb0715c84e9 /06_performance/src/testApp.cpp
parent138e1b84ee55246bd70e1ca21155de16690ea86d (diff)
very nearly good
Diffstat (limited to '06_performance/src/testApp.cpp')
-rw-r--r--06_performance/src/testApp.cpp73
1 files changed, 51 insertions, 22 deletions
diff --git a/06_performance/src/testApp.cpp b/06_performance/src/testApp.cpp
index 6bc31a7..9bba414 100644
--- a/06_performance/src/testApp.cpp
+++ b/06_performance/src/testApp.cpp
@@ -160,7 +160,7 @@ void testApp::setup(){
for (i=0;i<num;i++) {
videoclips.push_back(ofVideoPlayer());
videoclips[i].loadMovie(XML.getAttribute("video","file","",i));
- videoclips.setLoopState(OF_LOOP_NONE);
+ videoclips[i].setLoopState(OF_LOOP_NONE);
}
cerr<<"loaded "<<i<<" video clips"<<endl;
}
@@ -180,13 +180,37 @@ void testApp::update(){
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);
-
- }
+
+
+ vector<string> path;
+ explode(m.getAddress(),'/', back_inserter(path));
+
+
+
+ if (path.size()>1) {
+ string type=path[1];
+ int channel=ofToInt(path[2])-1;
+ int data=m.getArgAsInt32(0);
+
+ cerr<<"type: "<<type<<" channel: "<<channel<<" data: "<<m.getArgAsInt32(0)<<endl;
+
+ if (type=="video"){
+ if ((channel > -1)&&videoclips.size()>channel) {
+ if (data>0) {
+ cerr<<"playing video "<<channel<<endl;
+ videoclips[channel].play();
+ }
+ }
+ }
+ if (type=="narrator"){
+ if ((channel > -1)&&narrator.getNumClips()>channel) {
+ if (data>0) {
+ cerr<<"playing narrator "<<channel<<endl;
+ narrator.startPlayer(channel);
+ }
+ }
+ }
+ }
}
@@ -225,7 +249,6 @@ void testApp::draw(){
-
static int index=0;
float lavg_power = 0.0f;
float ravg_power = 0.0f;
@@ -383,10 +406,14 @@ void testApp::draw(){
}
ofPushMatrix();
- ofTranslate(0,150,-1050);
- narrator.drawCloud(2);
+ ofTranslate(0,-100,-1050);
+ //narrator.drawCloud(2);
+ narrator.drawPoints(F_lineWidth,F_particleAmount,F_particleLife,F_particleX,F_particleY,F_particleZ);
ofPopMatrix();
+ ofSetColor(255,255,255);
+
+
camera.end();
ofPopMatrix();
@@ -514,9 +541,11 @@ void testApp::draw(){
if (showFPS) {
- ofDrawBitmapString(ofToString(ofGetFrameRate(), 2),20,20);
- ofDrawBitmapString(ofToString(F_xRotation, 4)+" "+ofToString(F_yRotation, 4)+" "+ofToString(F_zRotation, 4),20,30);
- ofDrawBitmapString(ofToString(F_yseg, 4),20,40);
+ string msg=ofToString(ofGetFrameRate(), 2);
+ msg+="\n"+ofToString(F_xRotation, 4)+" "+ofToString(F_yRotation, 4)+" "+ofToString(F_zRotation, 4);
+ msg+="\n"+ofToString(F_yseg, 4);
+ msg+="\n"+ofToString(narrator.getNumParticles());
+ ofDrawBitmapString(msg,20,20);
}
}
@@ -624,19 +653,19 @@ void testApp::newMidiMessage(ofxMidiEventArgs& eventArgs){
F_drawAxis=((float) eventArgs.byteTwo-64)*(360.0/127);
break;
case 4:
- F_particleAmount=((float) eventArgs.byteTwo)*(2000.0f/127.0f);
+ F_particleAmount=((float) eventArgs.byteTwo)*(10000.0f/127.0f);
break;
case 5:
F_particleLife=((float) eventArgs.byteTwo)*(3.0f/127.0f);
break;
case 6:
- F_particleX=(((float) eventArgs.byteTwo)-64)*.1f;
+ F_particleX=(((float) eventArgs.byteTwo)-64)*10.0f;
break;
case 7:
- F_particleY=(((float) eventArgs.byteTwo)-64)*.1f;
+ F_particleY=(((float) eventArgs.byteTwo)-64)*10.0f;
break;
case 8:
- F_particleZ=(((float) eventArgs.byteTwo)-64)*.1f;
+ F_particleZ=(((float) eventArgs.byteTwo)-64)*10.0f;
break;
//65-80 buttons
@@ -812,11 +841,11 @@ void testApp::setMidiState(){
knobs[1]=(F_lineWidth*10);
knobs[2]=(F_drawAxis/(360.0/127))+64;
- knobs[3]=F_particleAmount/(2000.0f/127);
+ knobs[3]=F_particleAmount/(10000.0f/127);
knobs[4]=F_particleLife/(3.0f/127);
- knobs[5]=(F_particleX*10)+64;
- knobs[6]=(F_particleY*10)+64;
- knobs[7]=(F_particleZ*10)+64;
+ knobs[5]=(F_particleX*.1)+64;
+ knobs[6]=(F_particleY*.1)+64;
+ knobs[7]=(F_particleZ*.1)+64;
//radio button set