#pragma once #include "ofMain.h" #include "ofxGui.h" #include "ofxHelios.h" //#include #define SAMPLERATE 48000 #define min(a,b) (ab?a:b) /* TEXT+SOUND oscilloscopes on letters what is the message text from twitter/ SMS transformation of text/ oscilloscopes with animation/ audio animation/ gamepad colours (audio?) can we get a sillouette from kinect to laser kinect normal stuff The biggest thing missing: A framework to combine these things */ class Buffer{ public: Buffer(size_t sz=0){ if (sz){ data =new float[sz]; memset(data,0,sz*sizeof(float)); size=sz; } else data=NULL; } ~Buffer(){ if (data){ delete[] data; //why is this throwing an error } } void add(float * input, int num){ //this assumes that num < size memcpy(&data[writePoint],input,min(num,size-writePoint)*sizeof(float)); if (size-writePointi?writePoint-i:size-(i-writePoint))-1]; } float& operator [] (int i) { return data[(writePoint>i?writePoint-i:size-(i-writePoint))-1]; } private: size_t size; float *data; int writePoint; }; class ofApp : public ofBaseApp{ public: void setup(); void update(); void draw(); void keyPressed(int key); void keyReleased(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(int x, int y, int button); void windowResized(int w, int h); void dragEvent(ofDragInfo dragInfo); void gotMessage(ofMessage msg); void audioIn(float * input, int bufferSize, int nChannels); void printOscParams(); ofSoundStream soundStream; int blockSize; int sampleRate; int frameHead; //last sample drawn //baudvine::RingBuf buffer; Buffer buffer; float hScale; float vScale; float lineWidth; ofxHelios laser; //======= laser gui ofxPanel lasergui; ofParameter laser_power; ofParameter laser_intensity; ofParameter laser_points; ofParameter laser_subdivide; ofParameter laser_blank_num; ofParameter laser_max_angle; };