#ifndef _TEST_APP #define _TEST_APP #include "ofMain.h" #include "fft.h" #include "FFTOctaveAnalyzer.h" #include "ofxOsc.h" #define OSCPORT 12345 #include "oni.h" #define BUFFER_SIZE 1024 //was 1024 #define BUFFER_FRAMES 512 /* alter particle object memory scheme, preallocate higher res FFT drawing videos. 1- alter playback speed 2- draw with particles 3- draw seperately in between 4- strategy for drawing split screen - 3 copies videos at side of screen covering audio but not narrator envelope for particle generation paticles change size etc during lifetime 1- sound multi landscape mode 2- more midi controls on 2nd bank 3- try higher res FFT */ #define OF_ADDON_USING_OFXMIDIIN #include "ofxMidi.h" #include "ofxFensterManager.h" #define FFT_AVG 1 #define FFT_RAW 2 #define WAVEFORM 3 #define PICTURE 1 #define GRABBER 2 template int explode(const string &s, const char c, OutputIterator output) { stringstream data(s); string line; int i=0; while(std::getline(data,line,c)) { *output++ = line; i++; } return i; } class testApp : public ofxFensterListener, public ofxMidiListener{ public: void setup(); void update(); void draw(); void keyPressed (int key); void mouseMoved(int x, int y ); void mouseDragged(int x, int y, int button); void mousePressed(int x, int y, int button); void mouseReleased(); void audioIn(float * input, int bufferSize, int nChannels); FFTOctaveAnalyzer lFFTanalyzer; FFTOctaveAnalyzer rFFTanalyzer; ofxMidiIn midiIn; ofxMidiOut midiOut; void newMidiMessage(ofxMidiEventArgs& eventArgs); void setMidiState(); private: float * left; float * right; int bufferCounter; fft myfft; float FFTbuffer[2][BUFFER_SIZE][BUFFER_FRAMES]; int thisFFTbuffer; float lmagnitude[BUFFER_SIZE]; float lphase[BUFFER_SIZE]; float lpower[BUFFER_SIZE]; float lfreq[BUFFER_SIZE/2]; float rmagnitude[BUFFER_SIZE]; float rphase[BUFFER_SIZE]; float rpower[BUFFER_SIZE]; float rfreq[BUFFER_SIZE/2]; ofSoundStream soundStream; ofImage fbImage; //ofImage blendImage; ofVideoPlayer blendImage; ofFbo renderImage; ofShader maskShader; bool showFPS; bool fullScreen; ofImage testImage; //controllable variables float F_scale; float F_drawFrames; float F_drawStep; float F_drawDecay; float F_lineWidth; float F_drawAxis; float F_xRotation; float F_yRotation; float F_zRotation; float F_xRotate; float F_yRotate; float F_zRotate; float lastFrameTime; bool draworder; bool B_vSync; bool B_fill; int visMode; int inputMode; int I_fade1; int I_fade2; int I_movieSource; int I_moviePlaying; bool B_glitch; unsigned char *gammamap; unsigned char *line1; unsigned char *line2; unsigned char *outBuffer; float F_particleAmount; float F_particleLife; float F_particleSize; float F_particleX; float F_particleY; float F_particleZ; float whitePt; float blackPt; float gamma; bool field2; //flag that there is a 2nd field waiting to be processed bool use2fields; int frameTime,grabTime; //keep track of field timing bool deInterlace; ofTexture outTexture; float F_movieSpeed; ofImage blanker; ofCamera camera; ofNode target; oniManager narrator; ofxXmlSettings XML; vector videoclips; ofxOscReceiver receiver; float xOffs,startX,yOffs,startY; float xModel,yModel,zModel,sModel; }; #endif