diff options
| author | Comment <tim@gray.(none)> | 2013-06-20 09:06:40 +0100 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2013-06-20 09:06:40 +0100 |
| commit | 39bcb5346b1f746399192391b6699e81d0d8ad3a (patch) | |
| tree | 36445cbd0d270f5181fb04eaf875a7b6f3422ff2 /06_performance | |
| parent | cdd0e0b630bd3a5a8ba15dbce7f5e03221b72f92 (diff) | |
spooky bug fixed, integration nearly right
Diffstat (limited to '06_performance')
| -rwxr-xr-x | 06_performance/addons.make | 3 | ||||
| -rw-r--r-- | 06_performance/bin/data/TRSS_nesbitt_recordings.xml | 91 | ||||
| -rw-r--r-- | 06_performance/bin/data/black.mp4 | bin | 0 -> 1531 bytes | |||
| -rw-r--r-- | 06_performance/bin/data/black.png | bin | 0 -> 347 bytes | |||
| -rwxr-xr-x | 06_performance/bin/data/verdana.ttf | bin | 0 -> 171792 bytes | |||
| -rw-r--r-- | 06_performance/config.make | 6 | ||||
| -rw-r--r-- | 06_performance/src/main.cpp | 3 | ||||
| -rw-r--r-- | 06_performance/src/oni.cpp | 159 | ||||
| -rw-r--r-- | 06_performance/src/oni.h | 47 | ||||
| -rw-r--r-- | 06_performance/src/testApp.cpp | 184 | ||||
| -rw-r--r-- | 06_performance/src/testApp.h | 6 |
11 files changed, 412 insertions, 87 deletions
diff --git a/06_performance/addons.make b/06_performance/addons.make index cd4c2cc..b301b3a 100755 --- a/06_performance/addons.make +++ b/06_performance/addons.make @@ -1,3 +1,4 @@ ofxXmlSettings
ofxMidi
- +ofxOpenNI
+
diff --git a/06_performance/bin/data/TRSS_nesbitt_recordings.xml b/06_performance/bin/data/TRSS_nesbitt_recordings.xml new file mode 100644 index 0000000..550aae0 --- /dev/null +++ b/06_performance/bin/data/TRSS_nesbitt_recordings.xml @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<TRSS description="James Nesbitt"> + + <rec audio="audio/00.wav" left="recs/kinectRecord_0_15201313204.oni" right="recs/kinectRecord_1_15201313204.oni" description="2040 or 2004 BIG"/> + <rec audio="audio/01.wav" left="recs/kinectRecord_0_152013132358.oni" right="recs/kinectRecord_1_152013132358.oni"/> + <rec audio="audio/02.wav" left="recs/kinectRecord_0_15201313246.oni" right="recs/kinectRecord_1_15201313246.oni" description="2406"/> + <rec audio="audio/03.wav" left="recs/kinectRecord_0_152013132416.oni" right="recs/kinectRecord_1_152013132416.oni"/> + + + <rec audio="audio/04.wav" left="recs/kinectRecord_0_152013132447.oni" right="recs/kinectRecord_1_152013132447.oni"/> + <rec audio="audio/05.wav" left="recs/kinectRecord_0_15201313252.oni" right="recs/kinectRecord_1_15201313252.oni" description="2502 or 2052"/> + <rec audio="audio/06.wav" left="recs/kinectRecord_0_152013132455.oni" right="recs/kinectRecord_1_152013132455.oni"/> + <rec audio="audio/07.wav" left="recs/kinectRecord_0_15201313259.oni" right="recs/kinectRecord_1_15201313259.oni" description="2509 or 2059"/> + + <rec audio="audio/08.wav" left="recs/kinectRecord_0_152013132524.oni" right="recs/kinectRecord_1_152013132524.oni"/> + <rec audio="audio/09.wav" left="recs/kinectRecord_0_152013132532.oni" right="recs/kinectRecord_1_152013132532.oni"/> + <rec audio="audio/10.wav" left="recs/kinectRecord_0_152013132542.oni" right="recs/kinectRecord_1_152013132542.oni"/> + <rec audio="audio/11.wav" left="recs/kinectRecord_0_152013132550.oni" right="recs/kinectRecord_1_152013132550.oni"/> + + <rec audio="audio/101.wav" left="recs/kinectRecord_0_152013132915.oni" right="recs/kinectRecord_1_152013132915.oni"/> + <rec audio="audio/102.wav" left="recs/kinectRecord_0_152013132923.oni" right="recs/kinectRecord_1_152013132923.oni"/> + <rec audio="audio/103.wav" left="recs/kinectRecord_0_152013132931.oni" right="recs/kinectRecord_1_152013132931.oni"/> + <rec audio="audio/104.wav" left="recs/kinectRecord_0_152013132940.oni" right="recs/kinectRecord_1_152013132940.oni"/> + <rec audio="audio/105.wav" left="recs/kinectRecord_0_152013132947.oni" right="recs/kinectRecord_1_152013132947.oni"/> + <rec audio="audio/106.wav" left="recs/kinectRecord_0_152013132954.oni" right="recs/kinectRecord_1_152013132954.oni"/> + + <rec audio="audio/107.wav" left="recs/kinectRecord_0_15201313304.oni" right="recs/kinectRecord_1_15201313304.oni" description="3004"/> + <rec audio="audio/108.wav" left="recs/kinectRecord_0_152013133011.oni" right="recs/kinectRecord_1_152013133011.oni"/> + <rec audio="audio/109.wav" left="recs/kinectRecord_0_152013133020.oni" right="recs/kinectRecord_1_152013133020.oni"/> + <rec audio="audio/110.wav" left="recs/kinectRecord_0_152013133029.oni" right="recs/kinectRecord_1_152013133029.oni"/> + <rec audio="audio/111.wav" left="recs/kinectRecord_0_152013133037.oni" right="recs/kinectRecord_1_152013133037.oni" description="BIG"/> + + <rec audio="audio/201.wav" left="recs/kinectRecord_0_152013133137.oni" right="recs/kinectRecord_1_152013133137.oni" description="BIG"/> + <rec audio="audio/301.wav" left="recs/kinectRecord_0_152013133530.oni" right="recs/kinectRecord_1_152013133530.oni"/> + <rec audio="audio/302.wav" left="recs/kinectRecord_0_152013133539.oni" right="recs/kinectRecord_1_152013133539.oni"/> + <rec audio="audio/303.wav" left="recs/kinectRecord_0_152013133548.oni" right="recs/kinectRecord_1_152013133548.oni"/> + + <rec audio="audio/304.wav" left="recs/kinectRecord_0_152013133618.oni" right="recs/kinectRecord_1_152013133618.oni"/> + <rec audio="audio/305.wav" left="recs/kinectRecord_0_152013133627.oni" right="recs/kinectRecord_1_152013133627.oni"/> + <rec audio="audio/306.wav" left="recs/kinectRecord_0_152013133634.oni" right="recs/kinectRecord_1_152013133634.oni"/> + <rec left="recs/kinectRecord_0_152013133641.oni" right="recs/kinectRecord_1_152013133641.oni"/> + <rec left="recs/kinectRecord_0_152013133648.oni" right="recs/kinectRecord_1_152013133648.oni"/> + <rec left="recs/kinectRecord_0_152013133656.oni" right="recs/kinectRecord_1_152013133656.oni"/> + <rec left="recs/kinectRecord_0_15201313377.oni" right="recs/kinectRecord_1_15201313377.oni" description="3707"/> + <rec left="recs/kinectRecord_0_152013133714.oni" right="recs/kinectRecord_1_152013133714.oni"/> + <rec left="recs/kinectRecord_0_152013133744.oni" right="recs/kinectRecord_1_152013133744.oni" description="BIG"/> + <rec left="recs/kinectRecord_0_152013133848.oni" right="recs/kinectRecord_1_152013133848.oni" description="BIG"/> + <rec left="recs/kinectRecord_0_152013134138.oni" right="recs/kinectRecord_1_152013134138.oni" description="BIG"/> +</TRSS> +<TRSS> + <rec left="recs/kinectRecord_0_15201313189.oni" right="recs/kinectRecord_1_15201313189.oni" description="1809 box shot 1"/> + + <rec left="recs/kinectRecord_0_15201313326.oni" right="recs/kinectRecord_1_15201313326.oni" description="3206"/> + + <rec audio="audio/04.wav" left="recs/kinectRecord_0_152013132426.oni" right="recs/kinectRecord_1_152013132426.oni"/> + <rec audio="audio/04.wav" left="recs/kinectRecord_0_152013132439.oni" right="recs/kinectRecord_1_152013132439.oni"/> + + <rec audio="audio/08.wav" left="recs/kinectRecord_0_152013132517.oni" right="recs/kinectRecord_1_152013132517.oni"/> + + <rec audio="audio/101.wav" left="recs/kinectRecord_0_15201313295.oni" right="recs/kinectRecord_1_15201313295.oni" description="2905"/> + + <rec audio="audio/107.wav" left="recs/kinectRecord_0_15201313300.oni" right="recs/kinectRecord_1_15201313300.oni" description="3000"/> + + <rec audio="audio/201.wav" left="recs/kinectRecord_0_152013133128.oni" right="recs/kinectRecord_1_152013133128.oni" /> + + <rec audio="audio/304.wav" left="recs/kinectRecord_0_152013133557.oni" right="recs/kinectRecord_1_152013133557.oni"/> + <rec audio="audio/304.wav" left="recs/kinectRecord_0_15201313364.oni" right="recs/kinectRecord_1_15201313364.oni" description="3604"/> + + <rec left="recs/kinectRecord_0_152013105138.oni" right="recs/kinectRecord_1_152013105138.oni"/> + <rec left="recs/kinectRecord_0_152013105352.oni" right="recs/kinectRecord_1_152013105352.oni"/> + <rec left="recs/kinectRecord_0_15201312253.oni" right="recs/kinectRecord_1_15201312253.oni"/> + <rec left="recs/kinectRecord_0_152013131850.oni" right="recs/kinectRecord_1_152013131850.oni"/> + + <rec left="recs/kinectRecord_0_3042013212620.oni" right="recs/kinectRecord_1_3042013212620.oni"/> + <rec left="recs/kinectRecord_0_3042013213029.oni" right="recs/kinectRecord_1_3042013213029.oni"/> + <rec left="recs/kinectRecord_0_304201321304.oni" right="recs/kinectRecord_1_304201321304.oni"/> + <rec left="recs/kinectRecord_0_3042013213141.oni" right="recs/kinectRecord_1_3042013213141.oni"/> + <rec left="recs/kinectRecord_0_304201321326.oni" right="recs/kinectRecord_1_304201321326.oni"/> + <rec left="recs/kinectRecord_0_3042013213625.oni" right="recs/kinectRecord_1_3042013213625.oni"/> + <rec left="recs/kinectRecord_0_3042013214949.oni" right="recs/kinectRecord_1_3042013214949.oni"/> + <rec left="recs/kinectRecord_0_3042013215132.oni" right="recs/kinectRecord_1_3042013215132.oni"/> + <rec left="recs/kinectRecord_0_3042013215311.oni" right="recs/kinectRecord_1_3042013215311.oni"/> + <rec left="recs/kinectRecord_0_304201322041.oni" right="recs/kinectRecord_1_304201322041.oni"/> + <rec left="recs/kinectRecord_0_3042013221151.oni" right="recs/kinectRecord_1_3042013221151.oni"/> +</TRSS> + +#48 tracks +#36 audio, long ones 1,24,36 +#11 segments in poem +# long + take + take + long + take + long seems correct! +# how wrong we can be
\ No newline at end of file diff --git a/06_performance/bin/data/black.mp4 b/06_performance/bin/data/black.mp4 Binary files differnew file mode 100644 index 0000000..0da6796 --- /dev/null +++ b/06_performance/bin/data/black.mp4 diff --git a/06_performance/bin/data/black.png b/06_performance/bin/data/black.png Binary files differnew file mode 100644 index 0000000..3437bb5 --- /dev/null +++ b/06_performance/bin/data/black.png diff --git a/06_performance/bin/data/verdana.ttf b/06_performance/bin/data/verdana.ttf Binary files differnew file mode 100755 index 0000000..8f25a64 --- /dev/null +++ b/06_performance/bin/data/verdana.ttf diff --git a/06_performance/config.make b/06_performance/config.make index 261aa2e..e8ff248 100644 --- a/06_performance/config.make +++ b/06_performance/config.make @@ -3,7 +3,7 @@ # OF_ROOT allows to move projects outside apps/* just set this variable to the # absoulte path to the OF root folder -OF_ROOT = ../openFrameworks +OF_ROOT = ../../openFrameworks # USER_CFLAGS allows to pass custom flags to the compiler @@ -17,7 +17,7 @@ USER_CFLAGS = -I $(OF_ROOT)/addons/ofxOpenNI/include/openni -I $(OF_ROOT)/addons # for example libraries like: # USER_LDFLAGS = libs/libawesomelib.a -USER_LDFLAGS = -lusb-1.0 +USER_LDFLAGS = -lusb-1.0 -lOpenNI EXCLUDE_FROM_SOURCE="bin,.xcodeproj,obj" @@ -53,4 +53,4 @@ NDK_PLATFORM = android-8 LINUX_ARM7_COMPILER_OPTIMIZATIONS = -march=armv7-a -mtune=cortex-a8 -finline-functions -funroll-all-loops -O3 -funsafe-math-optimizations -mfpu=neon -ftree-vectorize -mfloat-abi=hard -mfpu=vfp - +CXX=colorgcc diff --git a/06_performance/src/main.cpp b/06_performance/src/main.cpp index 58263a2..20767a2 100644 --- a/06_performance/src/main.cpp +++ b/06_performance/src/main.cpp @@ -4,7 +4,8 @@ //======================================================================== int main( ){ - ofSetupOpenGL(4080,768, 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 a202f41..550d56e 100644 --- a/06_performance/src/oni.cpp +++ b/06_performance/src/oni.cpp @@ -1 +1,158 @@ -#include "oni.h"
\ No newline at end of file +#include "oni.h" + +void syncOniPlayer::addPlayer(string name){ + //ofxOpenNI *o=new ofxOpenNI; + //o->setupFromONI(name,true); + //o->setPaused(true); + //players.push_back(o); + players.push_back(NULL); + filenames.push_back(name); + soundplayer.setLoop(false); + //players[players.size()-1]->setSpeed(0.0f); + //players[players.size()-1]->setup(true); + //players[players.size()-1]->start(); + //players[players.size()-1]->startPlayer(name); +} +void syncOniPlayer::play(){ + for (int i=0;i<players.size();i++) { + players[i]=new ofxOpenNI(); + //players[i]->setSafeThreading(true); + players[i]->setupFromONI(filenames[i],true); + //players[i]->addDepthGenerator(); + //players[i]->addImageGenerator(); + //players[i]->setRegister(true); + players[i]->setLooped(false); + //players[i]->setBaseUserClass(user); + players[i]->start(); + //players[players.size()-1]->setSpeed(1.0f); + if (audio!="") { + soundplayer.loadSound(audio); + soundplayer.play(); + }; + //sleep(2); + drawable=true; + } +} +void syncOniPlayer::update(){ + for (int i=0;i<players.size();i++) { + players[i]->update(); + } +} +void syncOniPlayer::pause(){ + for (int i=0;i<players.size();i++) { + //players[players.size()-1]->setSpeed(0.0f); + players[i]->setPaused(true); + } +} +int syncOniPlayer::getCurrentFrame(){ + if (players.size()) return players[0]->getCurrentFrame(); + else return -1; +} +void syncOniPlayer::drawWindows(){ + if (!drawable) return; + for (int i=0;i<players.size();i++) { + if (players[i]==NULL) break; + ofTranslate(0, i * 400); + players[i]->drawDepth(50, 0,520,390); + players[i]->drawImage(600, 0,520,390); + + + } +} +void syncOniPlayer::drawCloud(int step){ + int count; + for (int n=0;n<players.size();n++) { + + + const XnDepthPixel* depthmap=players[n]->getDepthGenerator().GetDepthMap(); + //uint16_t* depthpixels=depthmap.getPixels(); + int range=1700; + + int depthW=players[n]->getWidth(); + int depthH=players[n]->getHeight(); + + for (int i=0;i<depthW;i+=step) { + + glBegin(GL_LINES); + + for (int j=0;j<depthH;j+=step) { + + + ofPoint p= players[n]->projectiveToWorld(ofPoint(i,j,(float)(depthmap[j*depthW+i]))); + //ofPoint p= projectiveToWorld(ofPoint(i,j,(float)depthmap[j*dmw+i])); + + if (p.z == 0 || p.z>range) continue; // gets rid of background + + + glColor4ub((unsigned char)255, (unsigned char)255, (unsigned char)255, (unsigned char)255); + glVertex3f(p.x, p.y, p.z); + //if (i==320&&j==160) cerr<<"world point: "<<p.x<<","<<p.y<<","<<p.z<<endl; + } + + glEnd(); + } + + } + + return; +} +void syncOniPlayer::stop(){ + soundplayer.stop(); + for (int i=0;i<players.size();i++) { + if (players[i]!=NULL) { + players[i]->stop(); + delete players[i]; + players[i]=NULL; + } + } + drawable=false; +} +//================= +void oniManager::init(const char* filename){ + playing=-1; + int numDevices=1; + string f=string(filename); + if( !XML.loadFile(f) ){ + printf("unable to load recordings, check data/ folder\n"); + }else{ + if(XML.pushTag("TRSS")) { + int num=XML.getNumTags("rec"); + if(num) { + for (int i=0;i<num;i++) { + players.push_back(syncOniPlayer()); + players[i].addPlayer(XML.getAttribute("rec","left","",i)); + if (numDevices==2) { + players[i].addPlayer(XML.getAttribute("rec","right","",i)); + } + players[i].audio=XML.getAttribute("rec","audio","",i); + } + } + else printf("no recordings found!\n"); + } + } +} +void oniManager::startPlayer(int newplayer){ + if (players.size()>newplayer){ + if (playing>-1) players[playing].stop(); + usleep(100000); + playing=newplayer; + players[playing].play(); + } +} +void oniManager::update(){ + if (players.size()>playing&&playing>-1) players[playing].update(); +} +void oniManager::drawWindows(){ + if (players.size()>playing&&playing>-1) players[playing].drawWindows(); +} +void oniManager::drawCloud(int step){ + if (players.size()>playing&&playing>-1) players[playing].drawCloud(step); +} +void oniManager::previous(){ + int newp=(playing+1)%players.size(); + startPlayer(newp); +} +void oniManager::next(){ + int newp=playing-1<0?players.size()-1:playing-1; + startPlayer(newp); +}
\ No newline at end of file diff --git a/06_performance/src/oni.h b/06_performance/src/oni.h index ccb1417..158d513 100644 --- a/06_performance/src/oni.h +++ b/06_performance/src/oni.h @@ -1 +1,46 @@ -#include "ofxOpenNI.h"
\ No newline at end of file +#include "ofMain.h" +#include "ofxXmlSettings.h" +#include "ofxOpenNI.h" + + + +//in order to play different clips it seems necessary to have a player per clip +class syncOniPlayer{ + public: + syncOniPlayer() { + drawable=false; + } + ~syncOniPlayer(){ + stop(); + } + void addPlayer(string name); + void play(); + void update(); + void pause(); + int getCurrentFrame(); + void drawWindows(); + void drawCloud(int step); + void stop(); + string audio; + + private: + vector<ofxOpenNI*> players; + vector<string> filenames; + ofSoundPlayer soundplayer; + bool drawable; + +}; +//======================================== +class oniManager{ + public: + void init(const char* filename); + void startPlayer(int num); + void update(); + void drawWindows(); + void drawCloud(int step); + void previous(); + void next(); + int playing; + ofxXmlSettings XML; + vector<syncOniPlayer> players; +};
\ No newline at end of file diff --git a/06_performance/src/testApp.cpp b/06_performance/src/testApp.cpp index d41071a..ac1391b 100644 --- a/06_performance/src/testApp.cpp +++ b/06_performance/src/testApp.cpp @@ -17,11 +17,11 @@ void testApp::setup(){ midiIn.listPorts(); - midiIn.openPort(0); //this was 1 on linux + midiIn.openPort(1); //this was 1 on linux midiIn.addListener(this); midiOut.listPorts(); - midiOut.openPort(0); //this was 1 on linux + midiOut.openPort(1); //this was 1 on linux // 0 output channeLs, // 2 input channels @@ -60,7 +60,7 @@ void testApp::setup(){ F_movieSpeed=0.0; //blendImage.loadImage("blend01.png"); - blendImage.loadMovie("blend01.mov"); + blendImage.loadMovie("blend.mp4"); blendImage.play(); blendImage.setLoopState(OF_LOOP_NORMAL); blendImage.setSpeed(F_movieSpeed); @@ -95,8 +95,8 @@ void testApp::setup(){ F_yRotate=0; F_zRotate=0; - F_xRotation=0; - F_yRotation=180; + F_xRotation=180; + F_yRotation=180; //was 180 F_zRotation=0; F_particleAmount=100; @@ -141,6 +141,11 @@ void testApp::setup(){ fullScreen=false; setMidiState(); + + target.setPosition(0,0,0); + camera.setPosition(0,0,-700); + camera.lookAt(target,ofVec3f(0,1,0)); + narrator.init("TRSS_nesbitt_recordings.xml"); } @@ -171,7 +176,9 @@ void testApp::update(){ I_moviePlaying=I_movieSource; } blendImage.setSpeed(F_movieSpeed); - blendImage.idleMovie(); + //blendImage.idleMovie(); + + narrator.update(); } //-------------------------------------------------------------- @@ -247,86 +254,95 @@ void testApp::draw(){ F_drawFrames=max(1.99f,min(F_drawFrames+(F_drawStep*interval),(float)BUFFER_FRAMES)); ofPushMatrix(); - ofTranslate(hw,hh); - ofRotateX(F_xRotation); - ofRotateY(F_yRotation); - ofRotateZ(F_zRotation); - - - if (inputMode==GRABBER) { - ofSetColor(I_fade2,I_fade2,I_fade2); - ofPushMatrix(); - ofRotateX(90); - ofRotateZ(-90); - outTexture.draw(hw,-hh,-ofGetWidth(),ofGetHeight()); - ofPopMatrix(); - } + //ofTranslate(hw,hh); + camera.begin(); + ofRotateX(F_xRotation); + ofRotateY(F_yRotation); + ofRotateZ(F_zRotation); - GLfloat fogColor[4] = {0,0,0, 1.0}; - glFogi(GL_FOG_MODE, GL_LINEAR); - 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)); - glEnable(GL_FOG); - - //reverse draw order when looking from back - int jStart=0; - int jEnd=F_drawFrames-1; - int jStep=1; - float F_yseg=F_yRotation; - while (F_yseg<-90) F_yseg+=360; - while (F_yseg>270) F_yseg-=360; - if (F_yseg>90) { - jStart=jEnd; - jEnd=0; - jStep=-1; - if (draworder) { - draworder=false; - //printf("switched to reverse order\n"); + /* + if (inputMode==GRABBER) { + ofSetColor(I_fade2,I_fade2,I_fade2); + ofPushMatrix(); + ofRotateX(90); + ofRotateZ(-90); + outTexture.draw(hw,-hh,-ofGetWidth(),ofGetHeight()); + ofPopMatrix(); + } + */ + GLfloat fogColor[4] = {0,0,0, 1.0}; + glFogi(GL_FOG_MODE, GL_LINEAR); + 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)); + glEnable(GL_FOG); + + //reverse draw order when looking from back + int jStart=0; + int jEnd=F_drawFrames-1; + int jStep=1; + float F_yseg=F_yRotation; + while (F_yseg<-90) F_yseg+=360; + while (F_yseg>270) F_yseg-=360; + if (F_yseg>90) { + jStart=jEnd; + jEnd=0; + jStep=-1; + if (draworder) { + draworder=false; + //printf("switched to reverse order\n"); + } + } + else if (!draworder) { + draworder=true; + //printf("switched to normal order\n"); } - } - else if (!draworder) { - draworder=true; - //printf("switched to normal order\n"); - } - for (int j=jStart;j!=jEnd;j+=jStep) { - int fB=(thisFFTbuffer+j)%BUFFER_FRAMES; + for (int j=jStart;j!=jEnd;j+=jStep) { + int fB=(thisFFTbuffer+j)%BUFFER_FRAMES; + + ofPushMatrix(); //coordinate transform for FFT draw direction + ofTranslate(0,0,(j*zStep)-hw); + ofRotateX(F_drawAxis); + + ofFill(); + ofSetColor(0,0,0); + 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,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,0,0); + } + glEnd(); + } + + ofNoFill(); + ofSetLineWidth(F_lineWidth); + 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); + } + 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); + } + glEnd(); + ofPopMatrix(); + } - ofPushMatrix(); //coordinate transform for FFT draw direction - ofTranslate(0,0,(j*zStep)-hw); - ofRotateX(F_drawAxis); + ofPushMatrix(); + ofTranslate(0,150,-1050); + narrator.drawCloud(2); + ofPopMatrix(); - ofFill(); - ofSetColor(0,0,0); - 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,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,0,0); - } - glEnd(); - } + camera.end(); - ofNoFill(); - ofSetLineWidth(F_lineWidth); - 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); - } - 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); - } - glEnd(); - ofPopMatrix(); - } ofPopMatrix(); renderImage.end(); @@ -447,6 +463,8 @@ void testApp::draw(){ glPopMatrix(); */ + + if (showFPS) { ofDrawBitmapString(ofToString(ofGetFrameRate(), 2),20,20); ofDrawBitmapString(ofToString(F_xRotation, 4)+" "+ofToString(F_yRotation, 4)+" "+ofToString(F_zRotation, 4),20,30); @@ -464,6 +482,12 @@ void testApp::keyPressed (int key){ fullScreen=!fullScreen; ofSetFullscreen(fullScreen); } + if(key == ','){ + narrator.previous(); + } + if(key == '.'){ + narrator.next(); + } } //-------------------------------------------------------------- diff --git a/06_performance/src/testApp.h b/06_performance/src/testApp.h index cca9e20..b1c086c 100644 --- a/06_performance/src/testApp.h +++ b/06_performance/src/testApp.h @@ -5,6 +5,8 @@ #include "fft.h" #include "FFTOctaveAnalyzer.h" +#include "oni.h" + #define BUFFER_SIZE 1024 #define BUFFER_FRAMES 512 @@ -157,6 +159,10 @@ class testApp : public ofBaseApp, public ofxMidiListener{ ofImage blanker; + + ofCamera camera; + ofNode target; + oniManager narrator; }; #endif |
