summaryrefslogtreecommitdiff
path: root/gui/src/AudioPlotter.h
blob: a1495c33ba25eb0c9460c05cf6db1e6ad8d63ca7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "ofMain.h"
#include "ofxAChaoslib.h"

#include "lineTransformer.h"

class Audioplotter{
    //store and draw a numbr of audio samples
    //how best to handle transforms - maybe pass in a transform to be added to 2nd and subsequent
    //how best to handle length of history data - fixed number that can be set, or line budget?
public:
    Audioplotter(int _size=1,bool _joined=true,bool _bars=false,int _width=2){
        setup(_size,_joined,_bars,_width);
    }
    void setup(int _size=1,bool _joined=true,bool _bars=false,int _width=2){
        history_size=_size;
        joined=_joined;
        bars=_bars;
        width=_width;
        startColour=ofColor(255,255,255);
        endColour=ofColor(0,0,0);
        attractor.setup();
    }
    colourPolyline compute_chaos(colourPolyline& poly,float colourFade=1.0f);
    vector <colourPolyline> output(float scale=1.0f,float decay=-1.0f);
    void addpoints(vector <float> &audio);
    int numpoints();

    ofParameter<bool> joined;
    ofParameter<bool> bars;
    ofParameter<int> width;
    ofParameter<int> history_size;
    ofParameter<int> num_points;

//feedback transformation
    ofParameter<ofVec2f> translate;
    ofParameter<float> rotate;
    ofParameter<ofVec2f> scale;

    ofParameter<ofColor> startColour;
    ofParameter<ofColor> endColour;

    ofParameter<bool> usechaos;
    ofParameter<float> chaosamount;
    ofParameter<float> chaos_a;
    ofParameter<float> chaos_b;
    ofParameter<float> chaos_k;
    ofParameter<float> chaos_p;

private:
    vector < vector<colourPolyline>> data;
    AChaosIkeda attractor;

};