LMMS
Loading...
Searching...
No Matches
Roessler.h
Go to the documentation of this file.
1/*
2 dsp/Roessler.h
3
4 Copyright 2003-4 Tim Goetze <tim@quitte.de>
5
6 http://quitte.de/dsp/
7
8 Roessler fractal.
9
10*/
11/*
12 This program is free software; you can redistribute it and/or
13 modify it under the terms of the GNU General Public License
14 as published by the Free Software Foundation; either version 2
15 of the License, or (at your option) any later version.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25 02111-1307, USA or point your web browser to http://www.gnu.org.
26*/
27
28#ifndef _DSP_ROESSLER_H_
29#define _DSP_ROESSLER_H_
30
31namespace DSP {
32
34{
35 public:
36 double x[2], y[2], z[2];
37 double h, a, b, c;
38 int I;
39
40 public:
42 {
43 h = 0.001;
44 a = .2;
45 b = .2;
46 c = 5.7;
47 }
48
49 /* rate is normalized (0 .. 1) */
50 void set_rate (double r)
51 {
52 h = max (.000001, r * .096);
53 }
54
55 void init (double _h = .001, double seed = .0)
56 {
57 h = _h;
58
59 I = 0;
60
61 x[0] = .0001 + .0001 * seed;
62 y[0] = .0001;
63 z[0] = .0001;
64
65 for (int i = 0; i < 5000; ++i)
66 get();
67 }
68
70 {
71 int J = I ^ 1;
72
73 x[J] = x[I] + h * (- y[I] - z[I]);
74 y[J] = y[I] + h * (x[I] + a * y[I]);
75 z[J] = z[I] + h * (b + z[I] * (x[I] - c));
76
77 I = J;
78
79 return x[I] * .01725 + z[I] * .015;
80 }
81
82 double get_x()
83 {
84 return x[I];
85 }
86
87 double get_y()
88 {
89 return y[I];
90 }
91
92 double get_z()
93 {
94 return z[I];
95 }
96};
97
98} /* namespace DSP */
99
100#endif /* _DSP_ROESSLER_H_ */
LADSPA_Data sample_t
Definition basics.h:100
void init(double _h=.001, double seed=.0)
Definition Roessler.h:55
double x[2]
Definition Roessler.h:36
double y[2]
Definition Roessler.h:36
double b
Definition Roessler.h:37
sample_t get()
Definition Roessler.h:69
double get_x()
Definition Roessler.h:82
double z[2]
Definition Roessler.h:36
void set_rate(double r)
Definition Roessler.h:50
int I
Definition Roessler.h:38
Roessler()
Definition Roessler.h:41
double get_y()
Definition Roessler.h:87
double a
Definition Roessler.h:37
double get_z()
Definition Roessler.h:92
double h
Definition Roessler.h:37
double c
Definition Roessler.h:37
register unsigned i
Definition inflate.c:1575
Definition BiQuad.h:31
#define max(x, y)
Definition os.h:78
int r
Definition crypt.c:458