#include "ofMain.h" #include "ofxAChaoslib.h" #include "lineTransformer.h" class AChaosplugin{ public: AChaosBase* plugin; vector > params; string name; AChaosplugin(AChaosBase* _plugin,string _name,vector _params={0,0,0,0,0,0}){ plugin=_plugin; name=_name; plugin->setup(); load_defaults(); ofLog()<<"constructor "<iv){ ofLog()<<"iv: "<().set(ofToString(i),i,0,i*5)); } } }; class Chaos{ public: vector plugins; vector > params; int whichplugin; ofParameter name; Chaos(){ //can only use those that have 2 output params? //or just make it 1 dimensional? only affect the x axis? plugins.push_back(new AChaosplugin(new AChaosBaker(),"Baker")); plugins.push_back(new AChaosplugin(new AChaosClifford(),"Clifford")); plugins.push_back(new AChaosplugin(new AChaosCollatz(),"Collatz")); plugins.push_back(new AChaosplugin(new AChaosDuffing(),"Duffing")); plugins.push_back(new AChaosplugin(new AChaosGinger(),"Ginger")); plugins.push_back(new AChaosplugin(new AChaosHenon(),"Henon")); whichplugin=0; update_name(); } AChaosplugin &get(){ return *plugins[whichplugin]; } void next(){ whichplugin=(whichplugin+1)%plugins.size(); update_name(); } void previous(){ whichplugin=whichplugin-1; if (whichplugin<0){ whichplugin=plugins.size()-1; } update_name(); } void update_name(){ name=plugins[whichplugin]->name; //save old params & load new } std::string &get_name(){ return plugins[whichplugin]->name; } }; /* vector 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 output(float scale=1.0f,float decay=-1.0f); void addpoints(vector &audio); void blankframe(); int numpoints(); ofParameter random; ofParameter joined; ofParameter bars; ofParameter mirror; ofParameter width; ofParameter history_size; ofParameter num_points; //feedback transformation ofParameter translate; ofParameter rotate; ofParameter scale; ofParameter startColour; ofParameter endColour; ofParameter usechaos; ofParameter chaosamount; ofParameter chaosscale; ofParameter chaos_a; ofParameter chaos_b; ofParameter chaos_k; ofParameter chaos_p; Chaos chaosloader; private: vector < vector> data; AChaosIkeda attractor; };