summaryrefslogtreecommitdiff
path: root/gui/src/AudioPlotter.h
blob: d001d2262bc77b3b3fd2274c2273698a085a02c1 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#include "ofMain.h"
#include "ofxAChaoslib.h"

#include "lineTransformer.h"

#include "chaoslib.h"



/*
    vector <string> names = { 
        "Baker",
        "Clifford",
        "Collatz",
        "Duffing",
        "Ginger",
        "Henon",
        "HenonF",
        "HenonHeilles",
        "HenonPhase",
        "Ikeda",
        "Jong",
        "Logistic",
        "Logistic1",
        "Lorenz",
        "LorenzEuler",
        "Lyapunov",
        "NavierStokes",
        "NavierStokesEuler",
        "Rossler",
        "Stein",
        "Stein1",
        "Torus",
        "Verhulst" 
    };
}
*/

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);
    void blankframe();
    int numpoints();

    ofParameter<bool> random;
    ofParameter<bool> joined;
    ofParameter<bool> bars;
    ofParameter<bool> mirror;
    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> chaosscale;
    ofParameter<float> chaos_a;
    ofParameter<float> chaos_b;
    ofParameter<float> chaos_k;
    ofParameter<float> chaos_p;

    Chaoslib chaosloader;

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

};