blob: 2a8b1d054dbfefb854e4651609edb7af3799d963 (
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
|
/*
32/64 bits A-Chaos Lib in openFrameworks
(c) s373.net/x 2004, 2012, 2015
http://s373.net/code/A-Chaos-Lib/A-Chaos.html
programmed by Andre Sier, revised 2015
License: MIT
*/
#pragma once
// comment for 64bits version (not all objects support)
#define ACHAOS32
#ifdef ACHAOS32
// 32bit
typedef float REAL;
#define SIN sinf
#define COS cosf
#else
// 64bit
typedef double REAL;
#define SIN sin
#define COS cos
#endif
class AChaosBase {
public:
AChaosBase(){};
~AChaosBase(){}
vector<REAL> iv;
vector<REAL> ov;
virtual void setup(REAL * params = NULL)=0;
vector<string> param_labels;
void init(REAL * params = NULL, int numiv=1, int numov=1){
iv.clear();
ov.clear();
for(int i=0; i<numiv; i++){
iv.push_back(0.0f);
}
for(int i=0; i<numov; i++){
ov.push_back(0.0f);
}
cout << "A-Chaos Lib (c) Richard Dudas 1996, (c) Andre Sier 2004, 2012, 2015 " << __DATE__ << " " __TIME__ << endl;
}
virtual void reset(){cout << "reset base" << endl;}
void set(vector<REAL> ¶ms){
iv.clear();
for(int i=0; i<params.size();i++){
iv.push_back( params[i] );
}
reset();
}
void set(REAL * params){
for(int i=0; i<iv.size();i++){
iv[i] = params[i] ;
}
reset();
}
REAL * update(){ calc(); return get(); }
virtual void calc(){cout << "calc base" << endl;}
REAL * get(){ return &ov[0];}
vector<REAL> & getVec(){return ov;}
};
|