From cd298b5bf00661ce31ae1d4498de58d5291477f2 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Tue, 22 May 2018 22:21:52 +0100 Subject: &%0%& content? --- gistanalysis/src/ofApp.h | 47 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 7 deletions(-) (limited to 'gistanalysis/src/ofApp.h') diff --git a/gistanalysis/src/ofApp.h b/gistanalysis/src/ofApp.h index e3ad339..44c4aa6 100644 --- a/gistanalysis/src/ofApp.h +++ b/gistanalysis/src/ofApp.h @@ -9,7 +9,8 @@ //This player includes a version of kissFFT. You can remove the one included in Gist. //https://github.com/borg/ofxOpenALSoundPlayer #include "ofxOpenALSoundPlayer.h" - +#include "ofxMidi.h" +#include "ofxGui.h" //Slightly modified to add a dynamic getVariable method to be able to plot based on //gist feature list @@ -26,6 +27,7 @@ public: Audioplotter(int _size=1,bool _joined=true){ set_size(_size); set_joined(_joined); + colour=ofColor(255,255,255); } void set_size(int _size){ history_size=_size; @@ -36,9 +38,11 @@ public: const vector &output(const ofMatrix4x4 xform=ofMatrix4x4(1.0f,0.0f,0.0f,0.0f, 0.0f,1.0f,0.0f,0.0f, 0.0f,0.0f,1.0f,0.0f, - 0.0f,0.0f,0.0f,1.0f)){ + 0.0f,0.0f,0.0f,1.0f), + float scale=1.0f, + float decay=-1.0f){ //destructive or non? - float fadefactor=1.0f-(1.0f/history_size); + float fadefactor=decay<0.0f?1.0f-(1.0f/history_size):decay; for (int i=0;i &audio,int number){ colourPolyline newdata; int num=min(number,(int)audio.size()); - int step=audio.size()/num; - int start=audio.size()/(num+1); + int step=audio.size()/(num+1); for (int i=0;ihistory_size) { @@ -60,19 +66,28 @@ public: } } + int numpoints(){ + int num=0; + for (auto d=data.begin();d!=data.end();d++){ + num+=d->size(); + } + return num; + } private: vector data; bool joined; int history_size; + ofColor colour; }; -class ofApp : public ofBaseApp{ +class ofApp : public ofBaseApp, public ofxMidiListener{ public: void setup(); void update(); void draw(); + void exit(); void keyPressed(int key); void keyReleased(int key); @@ -83,6 +98,17 @@ class ofApp : public ofBaseApp{ void windowResized(int w, int h); void dragEvent(ofDragInfo dragInfo); void gotMessage(ofMessage msg); + + void newMidiMessage(ofxMidiMessage& eventArgs); + + void updateOutput(ofEventArgs & args); + void drawOutput(ofEventArgs & args); + void outputKeyPressed(ofKeyEventArgs & args); + void outputKeyReleased(ofKeyEventArgs & args); + void outputMouseDragged(ofMouseEventArgs & args); + void outputMousePressed(ofMouseEventArgs & args); + void outputMouseReleased(ofMouseEventArgs & args); + void outputWindowResized(ofResizeEventArgs &resizeargs); ofSoundStream soundStream; ofxOpenALSoundPlayer player; @@ -128,5 +154,12 @@ class ofApp : public ofBaseApp{ ofxHelios laser; Audioplotter plotter; + + + ofxPanel gui; + ofParameter numPlots; + ofParameter scalePlot; + ofParameter decayPlot; + ofParameter xform; }; -- cgit v1.2.3