From b2f2fd990f9059db784a7849726c6fc5006c70f9 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Mon, 27 Dec 2004 14:44:11 +0000 Subject: a lot of new objects ... svn path=/trunk/externals/tb/; revision=2431 --- chaos/src/Makefile.am | 14 +++- chaos/src/bernoulli_dsp.cpp | 34 ++++++++++ chaos/src/bernoulli_map.hpp | 11 +-- chaos/src/bernoulli_msg.cpp | 34 ++++++++++ chaos/src/bungalow_tent_dsp.cpp | 34 ++++++++++ chaos/src/bungalow_tent_map.hpp | 6 +- chaos/src/bungalow_tent_msg.cpp | 34 ++++++++++ chaos/src/chaos_defs.hpp | 137 ++++++++++++++++++++++++++++++++++++++ chaos/src/chaos_dsp.hpp | 21 ++++-- chaos/src/chaos_msg.hpp | 68 +++++++++++++++++++ chaos/src/circle_map.hpp | 12 ++-- chaos/src/circle_map_dsp.cpp | 34 ++++++++++ chaos/src/circle_map_msg.cpp | 34 ++++++++++ chaos/src/gauss_map.hpp | 20 +++--- chaos/src/gauss_map_dsp.cpp | 34 ++++++++++ chaos/src/gauss_map_msg.cpp | 34 ++++++++++ chaos/src/henon_map.hpp | 2 +- chaos/src/henon_map_dsp.cpp | 34 ++++++++++ chaos/src/henon_map_msg.cpp | 34 ++++++++++ chaos/src/ikeda_laser_map.hpp | 20 +++--- chaos/src/ikeda_laser_map_dsp.cpp | 34 ++++++++++ chaos/src/ikeda_laser_map_msg.cpp | 34 ++++++++++ chaos/src/logistic_dsp.cpp | 34 ++++++++++ chaos/src/logistic_msg.cpp | 34 ++++++++++ chaos/src/lorenz_dsp.cpp | 34 ++++++++++ chaos/src/lorenz_msg.cpp | 34 ++++++++++ chaos/src/lozi_map.hpp | 12 ++-- chaos/src/lozi_map_dsp.cpp | 34 ++++++++++ chaos/src/lozi_map_msg.cpp | 34 ++++++++++ chaos/src/main.cpp | 34 +++++++++- chaos/src/sine_map.hpp | 14 ++-- chaos/src/sine_map_dsp.cpp | 34 ++++++++++ chaos/src/sine_map_msg.cpp | 34 ++++++++++ chaos/src/standard_map.hpp | 26 ++++---- chaos/src/standard_map_dsp.cpp | 34 ++++++++++ chaos/src/standard_map_msg.cpp | 34 ++++++++++ chaos/src/tent_map.hpp | 14 ++-- chaos/src/tent_map_dsp.cpp | 34 ++++++++++ chaos/src/tent_map_msg.cpp | 34 ++++++++++ 39 files changed, 1152 insertions(+), 75 deletions(-) create mode 100644 chaos/src/bernoulli_dsp.cpp create mode 100644 chaos/src/bernoulli_msg.cpp create mode 100644 chaos/src/bungalow_tent_dsp.cpp create mode 100644 chaos/src/bungalow_tent_msg.cpp create mode 100644 chaos/src/chaos_defs.hpp create mode 100644 chaos/src/chaos_msg.hpp create mode 100644 chaos/src/circle_map_dsp.cpp create mode 100644 chaos/src/circle_map_msg.cpp create mode 100644 chaos/src/gauss_map_dsp.cpp create mode 100644 chaos/src/gauss_map_msg.cpp create mode 100644 chaos/src/henon_map_dsp.cpp create mode 100644 chaos/src/henon_map_msg.cpp create mode 100644 chaos/src/ikeda_laser_map_dsp.cpp create mode 100644 chaos/src/ikeda_laser_map_msg.cpp create mode 100644 chaos/src/logistic_dsp.cpp create mode 100644 chaos/src/logistic_msg.cpp create mode 100644 chaos/src/lorenz_dsp.cpp create mode 100644 chaos/src/lorenz_msg.cpp create mode 100644 chaos/src/lozi_map_dsp.cpp create mode 100644 chaos/src/lozi_map_msg.cpp create mode 100644 chaos/src/sine_map_dsp.cpp create mode 100644 chaos/src/sine_map_msg.cpp create mode 100644 chaos/src/standard_map_dsp.cpp create mode 100644 chaos/src/standard_map_msg.cpp create mode 100644 chaos/src/tent_map_dsp.cpp create mode 100644 chaos/src/tent_map_msg.cpp diff --git a/chaos/src/Makefile.am b/chaos/src/Makefile.am index e1018bd..a524de5 100644 --- a/chaos/src/Makefile.am +++ b/chaos/src/Makefile.am @@ -1,9 +1,18 @@ NAME = chaos BUILT_SOURCES = main.cpp ode_base.cpp chaos_base.cpp chaos_dsp.cpp \ + bernoulli_dsp.cpp bernoulli_msg.cpp \ + bungalow_tent_dsp.cpp bungalow_tent_msg.cpp \ + circle_map_dsp.cpp circle_map_msg.cpp \ + gauss_map_dsp.cpp gauss_map_msg.cpp \ + henon_map_dsp.cpp henon_map_msg.cpp \ + ikeda_laser_map_dsp.cpp ikeda_laser_map_msg.cpp \ + logistic_dsp.cpp logistic_msg.cpp \ lorenz_dsp.cpp lorenz_msg.cpp \ - logistic_dsp.cpp logistic_msg.cpp - + lozi_map_dsp.cpp lozi_map_msg.cpp \ + sine_map_dsp.cpp sine_map_msg.cpp \ + standard_map_dsp.cpp standard_map_msg.cpp \ + tent_map_dsp.cpp tent_map_msg.cpp CXXFLAGS = @CXXFLAGS@ \ @OPT_FLAGS@ \ @@ -37,6 +46,7 @@ all-local: $(OBJECTS) dist-hook: rm -f ./*~ rm -f ./*.@OBJEXT@ + rm ./Makefile clean-local: rm -f ../$(TARGET) diff --git a/chaos/src/bernoulli_dsp.cpp b/chaos/src/bernoulli_dsp.cpp new file mode 100644 index 0000000..8e8d0da --- /dev/null +++ b/chaos/src/bernoulli_dsp.cpp @@ -0,0 +1,34 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "bernoulli_map.hpp" +#include "chaos_dsp.hpp" + +class bernoulli_dsp: + public chaos_dsp +{ + CHAOS_DSP_INIT(bernoulli, BERNOULLI_ATTRIBUTES); + + BERNOULLI_CALLBACKS; +}; + + + +FLEXT_LIB_DSP_V("bernoulli~", bernoulli_dsp); diff --git a/chaos/src/bernoulli_map.hpp b/chaos/src/bernoulli_map.hpp index 50bca13..25d19f8 100644 --- a/chaos/src/bernoulli_map.hpp +++ b/chaos/src/bernoulli_map.hpp @@ -25,17 +25,17 @@ // taken from Willi-Hans Steeb: Chaos and Fractals class bernoulli: - protected map_base + public map_base { public: bernoulli() { - m_num_eq = 1: + m_num_eq = 1; m_data = new data_t[1]; - CHAOS_SYS_INIT(x,0.5) + CHAOS_SYS_INIT(x,0.5); } - ~Bernoulli() + ~bernoulli() { delete m_data; } @@ -43,6 +43,9 @@ public: virtual void m_step() { data_t x = m_data[0]; + + if (x <= 0) + x = 0.00001; //stability if (x < 0.5f) m_data[0] = 2.f * x; diff --git a/chaos/src/bernoulli_msg.cpp b/chaos/src/bernoulli_msg.cpp new file mode 100644 index 0000000..8e07ed5 --- /dev/null +++ b/chaos/src/bernoulli_msg.cpp @@ -0,0 +1,34 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "bernoulli_map.hpp" +#include "chaos_msg.hpp" + +class bernoulli_msg: + public chaos_msg +{ + CHAOS_MSG_INIT(bernoulli, BERNOULLI_ATTRIBUTES); + + BERNOULLI_CALLBACKS; +}; + + + +FLEXT_LIB_V("bernoulli", bernoulli_msg); diff --git a/chaos/src/bungalow_tent_dsp.cpp b/chaos/src/bungalow_tent_dsp.cpp new file mode 100644 index 0000000..33bef1c --- /dev/null +++ b/chaos/src/bungalow_tent_dsp.cpp @@ -0,0 +1,34 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "bungalow_tent_map.hpp" +#include "chaos_dsp.hpp" + +class bungalow_tent_dsp: + public chaos_dsp +{ + CHAOS_DSP_INIT(bungalow_tent, BUNGALOW_TENT_ATTRIBUTES); + + BUNGALOW_TENT_CALLBACKS; +}; + + + +FLEXT_LIB_DSP_V("bungalow_tent~", bungalow_tent_dsp); diff --git a/chaos/src/bungalow_tent_map.hpp b/chaos/src/bungalow_tent_map.hpp index dfb6e25..185753a 100644 --- a/chaos/src/bungalow_tent_map.hpp +++ b/chaos/src/bungalow_tent_map.hpp @@ -33,14 +33,14 @@ // taken from Willi-Hans Steeb: Chaos and Fractals class bungalow_tent: - protected map_base + public map_base { public: bungalow_tent() { m_num_eq = 1; m_data = new data_t[1]; - CHAOS_SYS_INIT(x, 0.5); + CHAOS_SYS_INIT(x, 0.6); CHAOS_SYS_INIT(r, 0.5); } @@ -83,7 +83,7 @@ public: return (f >= -1) && (f < 1); } - CHAOS_SYSVAR_FUNCS_PRED(r, 0, m_pred_r); + CHAOS_SYSPAR_FUNCS_PRED(r, m_pred_r); bool m_pred_r(t_float f) { return (f >= -0.5) && (f < 1); diff --git a/chaos/src/bungalow_tent_msg.cpp b/chaos/src/bungalow_tent_msg.cpp new file mode 100644 index 0000000..8c6b1be --- /dev/null +++ b/chaos/src/bungalow_tent_msg.cpp @@ -0,0 +1,34 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "bungalow_tent_map.hpp" +#include "chaos_msg.hpp" + +class bungalow_tent_msg: + public chaos_msg +{ + CHAOS_MSG_INIT(bungalow_tent, BUNGALOW_TENT_ATTRIBUTES); + + BUNGALOW_TENT_CALLBACKS; +}; + + + +FLEXT_LIB_V("bungalow_tent", bungalow_tent_msg); diff --git a/chaos/src/chaos_defs.hpp b/chaos/src/chaos_defs.hpp new file mode 100644 index 0000000..ae86223 --- /dev/null +++ b/chaos/src/chaos_defs.hpp @@ -0,0 +1,137 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#ifndef __chaos_defs_hpp + + +// macros for simplified system state functions +#define CHAOS_SYS_SETFUNC(NAME, NR) \ + void set_##NAME(t_float f) \ + { \ + m_data[NR] = (data_t) f; \ + } + +#define CHAOS_SYS_SETFUNC_PRED(NAME, NR, PRED) \ + void set_##NAME(t_float f) \ + { \ + if ( PRED(f) ) \ + m_data[NR] = (data_t) f; \ + else \ + post("value for dimension " #NAME " %f out of range", f); \ + } + +#define CHAOS_SYS_GETFUNC(NAME, NR) \ + t_float get_##NAME() \ + { \ + return (t_float)m_data[NR]; \ + } + +/* to be called in the public part */ +#define CHAOS_SYSVAR_FUNCS_PRED(NAME, NR, PRED) \ +CHAOS_SYS_SETFUNC_PRED(NAME, NR, PRED) \ +CHAOS_SYS_GETFUNC(NAME, NR) + +#define CHAOS_SYSVAR_FUNCS(NAME, NR) \ +CHAOS_SYS_SETFUNC(NAME, NR) \ +CHAOS_SYS_GETFUNC(NAME, NR) + + + +// macros for simplified system parameter functions +#define CHAOS_PAR_SETFUNC(NAME) \ + void set_##NAME(t_float f) \ + { \ + m_##NAME = (data_t) f; \ + } + +#define CHAOS_PAR_SETFUNC_PRED(NAME, PRED) \ + void set_##NAME(t_float f) \ + { \ + if ( PRED(f) ) \ + m_##NAME = (data_t) f; \ + else \ + post("value for parameter " #NAME " %f out of range", f); \ + } + +#define CHAOS_PAR_GETFUNC(NAME) \ + t_float get_##NAME() \ + { \ + return (t_float)m_##NAME; \ + } + + +#define CHAOS_SYSPAR_FUNCS_PRED(NAME, PRED) \ +CHAOS_PAR_SETFUNC_PRED(NAME, PRED) \ +CHAOS_PAR_GETFUNC(NAME) \ +data_t m_##NAME; + + +#define CHAOS_SYSPAR_FUNCS(NAME) \ +public: \ +CHAOS_PAR_SETFUNC(NAME) \ +CHAOS_PAR_GETFUNC(NAME) \ +data_t m_##NAME; + + +#define CHAOS_SYSPAR_FUNCS_I(NAME) \ +CHAOS_PAR_SETFUNC(NAME) \ +CHAOS_PAR_GETFUNC(NAME) \ +data_t m_##NAME; + + +#define CHAOS_SYS_CALLBACKS(NAME) \ +public:void get_##NAME(t_float &f) \ +{ \ + f = m_system->get_##NAME(); \ +} \ +void set_##NAME(t_float &f) \ +{ \ + m_system->set_##NAME(f); \ +} \ +FLEXT_CALLVAR_F(get_##NAME, set_##NAME); + +#define CHAOS_SYS_CALLBACKS_I(NAME) \ +public: \ +void get_##NAME(int &i) \ +{ \ + i = m_system->get_##NAME(); \ +} \ +void set_##NAME(int &i) \ +{ \ + m_system->set_##NAME(i); \ +} \ +FLEXT_CALLVAR_I(get_##NAME, set_##NAME); + + +#define CHAOS_SYS_ATTRIBUTE(NAME) \ +FLEXT_ADDATTR_VAR(#NAME,get_##NAME, set_##NAME); + +#define CHAOS_SYS_INIT(NAME, VALUE) \ +set_##NAME(VALUE); + +#define CHAOS_PARAMETER(NAME) m_##NAME + + + + + + +#define __chaos_defs_hpp +#endif /* __chaos_defs_hpp */ diff --git a/chaos/src/chaos_dsp.hpp b/chaos/src/chaos_dsp.hpp index f03f7c9..1eff6fc 100644 --- a/chaos/src/chaos_dsp.hpp +++ b/chaos/src/chaos_dsp.hpp @@ -75,15 +75,25 @@ SYSTEM##_dsp(int argc, t_atom* argv ) \ \ int size = m_system->get_num_eq(); \ \ - for (int i = 0; i != size; ++i) \ - AddOutSignal(); \ - \ m_values = new t_float[size]; \ m_slopes = new t_float[size]; \ m_nextvalues = new t_float[size]; \ m_nextmidpts = new t_float[size]; \ m_curves = new t_float[size]; \ \ + /* create inlets and zero arrays*/ \ + for (int i = 0; i != size; ++i) \ + { \ + AddOutSignal(); \ + m_values[i] = 0; \ + m_slopes[i] = 0; \ + m_nextvalues[i] = 0; \ + m_nextmidpts[i] = 0; \ + m_curves[i] = 0; \ + } \ + \ + \ + \ m_freq = GetAFloat(argv[0]); \ m_method = (char)GetAFloat(argv[1]); \ m_phase = 0; \ @@ -185,7 +195,7 @@ void chaos_dsp::m_signal_n(int n, t_sample *const *insigs, } -/* linear interpolation adapted from supercollider by James McCartney */ +/* linear and cubic interpolation adapted from supercollider by James McCartney */ template void chaos_dsp::m_signal_l(int n, t_sample *const *insigs, t_sample *const *outsigs) @@ -225,7 +235,6 @@ void chaos_dsp::m_signal_l(int n, t_sample *const *insigs, } -/* linear interpolation adapted from Numerical Recipes In C */ template void chaos_dsp::m_signal_c(int n, t_sample *const *insigs, t_sample *const *outsigs) @@ -250,7 +259,7 @@ void chaos_dsp::m_signal_c(int n, t_sample *const *insigs, m_nextvalues[j]= m_system->get_data(j); m_values[j] = m_nextmidpts[j]; - m_nextmidpts[j] = (m_values[j] + value) * 0.5f; + m_nextmidpts[j] = (m_nextvalues[j] + value) * 0.5f; float fseglen = (float)phase; m_curves[j] = 2.f * (m_nextmidpts[j] - m_values[j] - diff --git a/chaos/src/chaos_msg.hpp b/chaos/src/chaos_msg.hpp new file mode 100644 index 0000000..78bca06 --- /dev/null +++ b/chaos/src/chaos_msg.hpp @@ -0,0 +1,68 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "chaos_base.hpp" + +template class chaos_msg + : public flext_base +{ + FLEXT_HEADER(chaos_msg, flext_base); + +public: + + /* local data for system, output and interpolation */ + system * m_system; /* the system */ + + void m_bang() + { + m_system->m_step(); + int outlets = m_system->get_num_eq(); + + while (outlets--) + { + ToOutFloat(outlets, m_system->get_data(outlets)); + } + } + + FLEXT_CALLBACK(m_bang); +}; + + +/* create constructor / destructor */ +#define CHAOS_MSG_INIT(SYSTEM, ATTRIBUTES) \ +FLEXT_HEADER(SYSTEM##_msg, chaos_msg) \ + \ +SYSTEM##_msg(int argc, t_atom* argv ) \ +{ \ + m_system = new SYSTEM; \ + \ + int size = m_system->get_num_eq(); \ + \ + for (int i = 0; i != size; ++i) \ + AddOutFloat(); \ + \ + ATTRIBUTES; \ + FLEXT_ADDBANG(0, m_bang); \ +} \ + \ +~SYSTEM##_msg() \ +{ \ + delete m_system; \ +} diff --git a/chaos/src/circle_map.hpp b/chaos/src/circle_map.hpp index 02817de..0e12ad0 100644 --- a/chaos/src/circle_map.hpp +++ b/chaos/src/circle_map.hpp @@ -20,21 +20,23 @@ #include "map_base.hpp" -// circle_map map: x[n+1] = x[n] * omega - r / (2*pi) * sin (2 * pi * x [n]) +#include + +// circle_map map: x[n+1] = x[n] + omega - r / (2*pi) * sin (2 * pi * x [n]) // // taken from Willi-Hans Steeb: Chaos and Fractals class circle_map: - protected map_base + public map_base { public: circle_map() { m_num_eq = 1; m_data = new data_t[1]; - CHAOS_SYS_INIT(omega, 0.4); - CHAOS_SYS_INIT(r, 1); - CHAOS_SYS_INIT(x, 0.5); + CHAOS_SYS_INIT(omega, 0.1); + CHAOS_SYS_INIT(r, 3); + CHAOS_SYS_INIT(x, 0.4); } ~circle_map() diff --git a/chaos/src/circle_map_dsp.cpp b/chaos/src/circle_map_dsp.cpp new file mode 100644 index 0000000..fbd7c9d --- /dev/null +++ b/chaos/src/circle_map_dsp.cpp @@ -0,0 +1,34 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "circle_map.hpp" +#include "chaos_dsp.hpp" + +class circle_map_dsp: + public chaos_dsp +{ + CHAOS_DSP_INIT(circle_map, CIRCLE_MAP_ATTRIBUTES); + + CIRCLE_MAP_CALLBACKS; +}; + + + +FLEXT_LIB_DSP_V("circle_map~", circle_map_dsp); diff --git a/chaos/src/circle_map_msg.cpp b/chaos/src/circle_map_msg.cpp new file mode 100644 index 0000000..3e771b3 --- /dev/null +++ b/chaos/src/circle_map_msg.cpp @@ -0,0 +1,34 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "circle_map.hpp" +#include "chaos_msg.hpp" + +class circle_map_msg: + public chaos_msg +{ + CHAOS_MSG_INIT(circle_map, CIRCLE_MAP_ATTRIBUTES); + + CIRCLE_MAP_CALLBACKS; +}; + + + +FLEXT_LIB_V("circle_map", circle_map_msg); diff --git a/chaos/src/gauss_map.hpp b/chaos/src/gauss_map.hpp index 537dcfb..523b1ca 100644 --- a/chaos/src/gauss_map.hpp +++ b/chaos/src/gauss_map.hpp @@ -20,23 +20,25 @@ #include "map_base.hpp" +#include + // gauss map: x[n+1] = 0 (for x[n] = 0) -// fmod(1 / x[n]) (else) +// fmod(1 / x[n], 1) (else) // 0 <= x[n] < 1 // taken from Willi-Hans Steeb: Chaos and Fractals -class gauss: - protected map_base +class gauss_map: + public map_base { public: - gauss() + gauss_map() { m_num_eq = 1; m_data = new data_t[1]; CHAOS_SYS_INIT(x,0.5); } - ~gauss() + ~gauss_map() { delete m_data; } @@ -46,9 +48,9 @@ public: data_t data = m_data[0]; if (data == 0) - m_data[0] = 0; + m_data[0] = 0.001; else - m_data[0] = fmod(1.f / data); + m_data[0] = fmod(1.f / data, 1); } CHAOS_SYSVAR_FUNCS_PRED(x, 0, m_pred_x); @@ -58,11 +60,11 @@ public: } }; -#define GAUSS_CALLBACKS \ +#define GAUSS_MAP_CALLBACKS \ MAP_CALLBACKS; \ CHAOS_SYS_CALLBACKS(x); -#define GAUSS_ATTRIBUTES \ +#define GAUSS_MAP_ATTRIBUTES \ MAP_ATTRIBUTES; \ CHAOS_SYS_ATTRIBUTE(x); diff --git a/chaos/src/gauss_map_dsp.cpp b/chaos/src/gauss_map_dsp.cpp new file mode 100644 index 0000000..70e659d --- /dev/null +++ b/chaos/src/gauss_map_dsp.cpp @@ -0,0 +1,34 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "gauss_map.hpp" +#include "chaos_dsp.hpp" + +class gauss_map_dsp: + public chaos_dsp +{ + CHAOS_DSP_INIT(gauss_map, GAUSS_MAP_ATTRIBUTES); + + GAUSS_MAP_CALLBACKS; +}; + + + +FLEXT_LIB_DSP_V("gauss_map~", gauss_map_dsp); diff --git a/chaos/src/gauss_map_msg.cpp b/chaos/src/gauss_map_msg.cpp new file mode 100644 index 0000000..61e0379 --- /dev/null +++ b/chaos/src/gauss_map_msg.cpp @@ -0,0 +1,34 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "gauss_map.hpp" +#include "chaos_msg.hpp" + +class gauss_map_msg: + public chaos_msg +{ + CHAOS_MSG_INIT(gauss_map, GAUSS_MAP_ATTRIBUTES); + + GAUSS_MAP_CALLBACKS; +}; + + + +FLEXT_LIB_V("gauss_map", gauss_map_msg); diff --git a/chaos/src/henon_map.hpp b/chaos/src/henon_map.hpp index 0aecbee..9e379ae 100644 --- a/chaos/src/henon_map.hpp +++ b/chaos/src/henon_map.hpp @@ -26,7 +26,7 @@ // taken from Willi-Hans Steeb: Chaos and Fractals class henon: - protected map_base + public map_base { public: henon() diff --git a/chaos/src/henon_map_dsp.cpp b/chaos/src/henon_map_dsp.cpp new file mode 100644 index 0000000..f28e83f --- /dev/null +++ b/chaos/src/henon_map_dsp.cpp @@ -0,0 +1,34 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "henon_map.hpp" +#include "chaos_dsp.hpp" + +class henon_dsp: + public chaos_dsp +{ + CHAOS_DSP_INIT(henon, HENON_ATTRIBUTES); + + HENON_CALLBACKS; +}; + + + +FLEXT_LIB_DSP_V("henon~", henon_dsp); diff --git a/chaos/src/henon_map_msg.cpp b/chaos/src/henon_map_msg.cpp new file mode 100644 index 0000000..10849fd --- /dev/null +++ b/chaos/src/henon_map_msg.cpp @@ -0,0 +1,34 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "henon_map.hpp" +#include "chaos_msg.hpp" + +class henon_msg: + public chaos_msg +{ + CHAOS_MSG_INIT(henon, HENON_ATTRIBUTES); + + HENON_CALLBACKS; +}; + + + +FLEXT_LIB_V("henon", henon_msg); diff --git a/chaos/src/ikeda_laser_map.hpp b/chaos/src/ikeda_laser_map.hpp index ccc14cc..e267204 100644 --- a/chaos/src/ikeda_laser_map.hpp +++ b/chaos/src/ikeda_laser_map.hpp @@ -31,11 +31,11 @@ // // taken from Willi-Hans Steeb: Chaos and Fractals -class ikeda: - protected map_base +class ikeda_laser_map: + public map_base { public: - ikeda() + ikeda_laser_map() { m_num_eq = 2; m_data = new data_t[2]; @@ -47,7 +47,7 @@ public: CHAOS_SYS_INIT(y,0.5); } - ~ikeda() + ~ikeda_laser_map() { delete m_data; } @@ -70,15 +70,15 @@ public: CHAOS_SYSVAR_FUNCS(x, 0); CHAOS_SYSVAR_FUNCS(y, 1); - CHAOS_PAR_FUNCS(c1); - CHAOS_PAR_FUNCS(c2); - CHAOS_PAR_FUNCS(c3); - CHAOS_PAR_FUNCS(roh); + CHAOS_SYSPAR_FUNCS(c1); + CHAOS_SYSPAR_FUNCS(c2); + CHAOS_SYSPAR_FUNCS(c3); + CHAOS_SYSPAR_FUNCS(roh); }; -#define IKEDA_CALLBACKS \ +#define IKEDA_LASER_MAP_CALLBACKS \ MAP_CALLBACKS; \ CHAOS_SYS_CALLBACKS(c1); \ CHAOS_SYS_CALLBACKS(c2); \ @@ -87,7 +87,7 @@ CHAOS_SYS_CALLBACKS(roh); \ CHAOS_SYS_CALLBACKS(x); \ CHAOS_SYS_CALLBACKS(y); -#define IKEDA_ATTRIBUTES \ +#define IKEDA_LASER_MAP_ATTRIBUTES \ MAP_ATTRIBUTES; \ CHAOS_SYS_ATTRIBUTE(c1); \ CHAOS_SYS_ATTRIBUTE(c2); \ diff --git a/chaos/src/ikeda_laser_map_dsp.cpp b/chaos/src/ikeda_laser_map_dsp.cpp new file mode 100644 index 0000000..cf7c9cf --- /dev/null +++ b/chaos/src/ikeda_laser_map_dsp.cpp @@ -0,0 +1,34 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "ikeda_laser_map.hpp" +#include "chaos_dsp.hpp" + +class ikeda_laser_map_dsp: + public chaos_dsp +{ + CHAOS_DSP_INIT(ikeda_laser_map, IKEDA_LASER_MAP_ATTRIBUTES); + + IKEDA_LASER_MAP_CALLBACKS; +}; + + + +FLEXT_LIB_DSP_V("ikeda~", ikeda_laser_map_dsp); diff --git a/chaos/src/ikeda_laser_map_msg.cpp b/chaos/src/ikeda_laser_map_msg.cpp new file mode 100644 index 0000000..d5f775a --- /dev/null +++ b/chaos/src/ikeda_laser_map_msg.cpp @@ -0,0 +1,34 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "ikeda_laser_map.hpp" +#include "chaos_msg.hpp" + +class ikeda_laser_map_msg: + public chaos_msg +{ + CHAOS_MSG_INIT(ikeda_laser_map, IKEDA_LASER_MAP_ATTRIBUTES); + + IKEDA_LASER_MAP_CALLBACKS; +}; + + + +FLEXT_LIB_V("ikeda_laser_map", ikeda_laser_map_msg); diff --git a/chaos/src/logistic_dsp.cpp b/chaos/src/logistic_dsp.cpp new file mode 100644 index 0000000..1c20a05 --- /dev/null +++ b/chaos/src/logistic_dsp.cpp @@ -0,0 +1,34 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "logistic_map.hpp" +#include "chaos_dsp.hpp" + +class logistic_dsp: + public chaos_dsp +{ + CHAOS_DSP_INIT(logistic, LOGISTIC_ATTRIBUTES); + + LOGISTIC_CALLBACKS; +}; + + + +FLEXT_LIB_DSP_V("logistic~", logistic_dsp); diff --git a/chaos/src/logistic_msg.cpp b/chaos/src/logistic_msg.cpp new file mode 100644 index 0000000..db7bcbf --- /dev/null +++ b/chaos/src/logistic_msg.cpp @@ -0,0 +1,34 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "logistic_map.hpp" +#include "chaos_msg.hpp" + +class logistic_msg: + public chaos_msg +{ + CHAOS_MSG_INIT(logistic, LOGISTIC_ATTRIBUTES); + + LOGISTIC_CALLBACKS; +}; + + + +FLEXT_LIB_V("logistic", logistic_msg); diff --git a/chaos/src/lorenz_dsp.cpp b/chaos/src/lorenz_dsp.cpp new file mode 100644 index 0000000..8dc3763 --- /dev/null +++ b/chaos/src/lorenz_dsp.cpp @@ -0,0 +1,34 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "lorenz.hpp" +#include "chaos_dsp.hpp" + +class lorenz_dsp: + public chaos_dsp +{ + CHAOS_DSP_INIT(lorenz, LORENZ_ATTRIBUTES); + + LORENZ_CALLBACKS; +}; + + + +FLEXT_LIB_DSP_V("lorenz~", lorenz_dsp); diff --git a/chaos/src/lorenz_msg.cpp b/chaos/src/lorenz_msg.cpp new file mode 100644 index 0000000..6ad3ed9 --- /dev/null +++ b/chaos/src/lorenz_msg.cpp @@ -0,0 +1,34 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "lorenz.hpp" +#include "chaos_msg.hpp" + +class lorenz_msg: + public chaos_msg +{ + CHAOS_MSG_INIT(lorenz, LORENZ_ATTRIBUTES); + + LORENZ_CALLBACKS; +}; + + + +FLEXT_LIB_V("lorenz", lorenz_msg); diff --git a/chaos/src/lozi_map.hpp b/chaos/src/lozi_map.hpp index 8bee655..37cab54 100644 --- a/chaos/src/lozi_map.hpp +++ b/chaos/src/lozi_map.hpp @@ -25,11 +25,11 @@ // b != 0 // taken from Willi-Hans Steeb: Chaos and Fractals -class lozi: - protected map_base +class lozi_map: + public map_base { public: - lozi() + lozi_map() { m_num_eq = 2; m_data = new data_t[1]; @@ -39,7 +39,7 @@ public: CHAOS_SYS_INIT(b,0.3); } - ~lozi() + ~lozi_map() { delete m_data; } @@ -71,14 +71,14 @@ public: }; -#define LOZI_CALLBACKS \ +#define LOZI_MAP_CALLBACKS \ MAP_CALLBACKS; \ CHAOS_SYS_CALLBACKS(a); \ CHAOS_SYS_CALLBACKS(b); \ CHAOS_SYS_CALLBACKS(x); \ CHAOS_SYS_CALLBACKS(y); -#define LOZI_ATTRIBUTES \ +#define LOZI_MAP_ATTRIBUTES \ MAP_ATTRIBUTES; \ CHAOS_SYS_ATTRIBUTE(a); \ CHAOS_SYS_ATTRIBUTE(b); \ diff --git a/chaos/src/lozi_map_dsp.cpp b/chaos/src/lozi_map_dsp.cpp new file mode 100644 index 0000000..f8c4695 --- /dev/null +++ b/chaos/src/lozi_map_dsp.cpp @@ -0,0 +1,34 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "lozi_map.hpp" +#include "chaos_dsp.hpp" + +class lozi_map_dsp: + public chaos_dsp +{ + CHAOS_DSP_INIT(lozi_map, LOZI_MAP_ATTRIBUTES); + + LOZI_MAP_CALLBACKS; +}; + + + +FLEXT_LIB_DSP_V("lozi~", lozi_map_dsp); diff --git a/chaos/src/lozi_map_msg.cpp b/chaos/src/lozi_map_msg.cpp new file mode 100644 index 0000000..947e772 --- /dev/null +++ b/chaos/src/lozi_map_msg.cpp @@ -0,0 +1,34 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "lozi_map.hpp" +#include "chaos_msg.hpp" + +class lozi_map_msg: + public chaos_msg +{ + CHAOS_MSG_INIT(lozi_map, LOZI_MAP_ATTRIBUTES); + + LOZI_MAP_CALLBACKS; +}; + + + +FLEXT_LIB_V("lozi", lozi_map_msg); diff --git a/chaos/src/main.cpp b/chaos/src/main.cpp index 42dc16d..16f2908 100644 --- a/chaos/src/main.cpp +++ b/chaos/src/main.cpp @@ -23,12 +23,42 @@ void chaos_library_setup() { post("chaos~ version "PACKAGE_VERSION"\n"); + + FLEXT_DSP_SETUP(bernoulli_dsp); + FLEXT_SETUP(bernoulli_msg); + + FLEXT_DSP_SETUP(bungalow_tent_dsp); + FLEXT_SETUP(bungalow_tent_msg); + + FLEXT_DSP_SETUP(circle_map_dsp); + FLEXT_SETUP(circle_map_msg); + + FLEXT_DSP_SETUP(gauss_map_dsp); + FLEXT_SETUP(gauss_map_msg); + + FLEXT_DSP_SETUP(henon_dsp); + FLEXT_SETUP(henon_msg); + + FLEXT_DSP_SETUP(ikeda_laser_map_dsp); + FLEXT_SETUP(ikeda_laser_map_msg); + FLEXT_DSP_SETUP(logistic_dsp); + FLEXT_SETUP(logistic_msg); + FLEXT_DSP_SETUP(lorenz_dsp); FLEXT_SETUP(lorenz_msg); - FLEXT_DSP_SETUP(logistic_dsp); - FLEXT_SETUP(logistic_msg); + FLEXT_DSP_SETUP(lozi_map_dsp); + FLEXT_SETUP(lozi_map_msg); + + FLEXT_DSP_SETUP(sine_map_dsp); + FLEXT_SETUP(sine_map_msg); + + FLEXT_DSP_SETUP(standard_map_dsp); + FLEXT_SETUP(standard_map_msg); + + FLEXT_DSP_SETUP(tent_map_dsp); + FLEXT_SETUP(tent_map_msg); } FLEXT_LIB_SETUP(chaos, chaos_library_setup); diff --git a/chaos/src/sine_map.hpp b/chaos/src/sine_map.hpp index d083270..376a245 100644 --- a/chaos/src/sine_map.hpp +++ b/chaos/src/sine_map.hpp @@ -25,19 +25,19 @@ // 0 <= x[n] <= 1 // taken from Willi-Hans Steeb: Chaos and Fractals -class sine: - protected map_base +class sine_map: + public map_base { public: - sine() + sine_map() { m_num_eq = 1; m_data = new data_t[1]; CHAOS_SYS_INIT(x,0); } - ~sine() + ~sine_map() { delete m_data; } @@ -47,7 +47,7 @@ public: m_data[0] = sin (M_PI * m_data[0]); } - CHAOS_SYSVAR_FUNCS_PRED(x, m_pred); + CHAOS_SYSVAR_FUNCS_PRED(x, 0, m_pred); bool m_pred(t_float f) { @@ -55,11 +55,11 @@ public: } }; -#define SINE_CALLBACKS \ +#define SINE_MAP_CALLBACKS \ MAP_CALLBACKS \ CHAOS_SYS_CALLBACKS(x); -#define SINE_ATTRIBUTES \ +#define SINE_MAP_ATTRIBUTES \ MAP_ATTRIBUTES \ CHAOS_SYS_ATTRIBUTE(x); diff --git a/chaos/src/sine_map_dsp.cpp b/chaos/src/sine_map_dsp.cpp new file mode 100644 index 0000000..a2d2929 --- /dev/null +++ b/chaos/src/sine_map_dsp.cpp @@ -0,0 +1,34 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "sine_map.hpp" +#include "chaos_dsp.hpp" + +class sine_map_dsp: + public chaos_dsp +{ + CHAOS_DSP_INIT(sine_map, SINE_MAP_ATTRIBUTES); + + SINE_MAP_CALLBACKS; +}; + + + +FLEXT_LIB_DSP_V("sine_map~", sine_map_dsp); diff --git a/chaos/src/sine_map_msg.cpp b/chaos/src/sine_map_msg.cpp new file mode 100644 index 0000000..1d9a90e --- /dev/null +++ b/chaos/src/sine_map_msg.cpp @@ -0,0 +1,34 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "sine_map.hpp" +#include "chaos_msg.hpp" + +class sine_map_msg: + public chaos_msg +{ + CHAOS_MSG_INIT(sine_map, SINE_MAP_ATTRIBUTES); + + SINE_MAP_CALLBACKS; +}; + + + +FLEXT_LIB_V("sine_map", sine_map_msg); diff --git a/chaos/src/standard_map.hpp b/chaos/src/standard_map.hpp index 9515efe..c0f0b8d 100644 --- a/chaos/src/standard_map.hpp +++ b/chaos/src/standard_map.hpp @@ -26,11 +26,11 @@ // 0 <= theta <= 2*pi // taken from Willi-Hans Steeb: Chaos and Fractals -class standard: - protected map_base +class standard_map: + public map_base { public: - standard() + standard_map() { m_num_eq = 2; m_data = new data_t[2]; @@ -40,7 +40,7 @@ public: CHAOS_SYS_INIT(k, 0.8); } - ~standard() + ~standard_map() { delete m_data; } @@ -54,23 +54,23 @@ public: m_data[0] = I + k * sin(theta); theta = theta + I + k * sin(theta); - if (y > 2 * M_PI) + if (theta > 2 * M_PI) { do { - y -= 2*M_PI; + theta -= 2*M_PI; } - while (y > 2 * M_PI); + while (theta > 2 * M_PI); goto put_data; } - if (y < 0) + if (theta < 0) { do { - y += 2*M_PI; + theta += 2*M_PI; } - while (y < 0); + while (theta < 0); } put_data: @@ -86,18 +86,18 @@ public: return (f >= 0) && (f < 2*M_PI); } - CHAOS_SYSPAR_FUNCS(I, 1); + CHAOS_SYSPAR_FUNCS(k); }; -#define STANDARD_CALLBACKS \ +#define STANDARD_MAP_CALLBACKS \ MAP_CALLBACKS; \ CHAOS_SYS_CALLBACKS(I); \ CHAOS_SYS_CALLBACKS(theta); \ CHAOS_SYS_CALLBACKS(k); -#define STANDARD_ATTRIBUTES \ +#define STANDARD_MAP_ATTRIBUTES \ MAP_ATTRIBUTES; \ CHAOS_SYS_ATTRIBUTE(I); \ CHAOS_SYS_ATTRIBUTE(theta); \ diff --git a/chaos/src/standard_map_dsp.cpp b/chaos/src/standard_map_dsp.cpp new file mode 100644 index 0000000..fa7d3be --- /dev/null +++ b/chaos/src/standard_map_dsp.cpp @@ -0,0 +1,34 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "standard_map.hpp" +#include "chaos_dsp.hpp" + +class standard_map_dsp: + public chaos_dsp +{ + CHAOS_DSP_INIT(standard_map, STANDARD_MAP_ATTRIBUTES); + + STANDARD_MAP_CALLBACKS; +}; + + + +FLEXT_LIB_DSP_V("standard_map~", standard_map_dsp); diff --git a/chaos/src/standard_map_msg.cpp b/chaos/src/standard_map_msg.cpp new file mode 100644 index 0000000..fdd3bda --- /dev/null +++ b/chaos/src/standard_map_msg.cpp @@ -0,0 +1,34 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "standard_map.hpp" +#include "chaos_msg.hpp" + +class standard_map_msg: + public chaos_msg +{ + CHAOS_MSG_INIT(standard_map, STANDARD_MAP_ATTRIBUTES); + + STANDARD_MAP_CALLBACKS; +}; + + + +FLEXT_LIB_V("standard_map", standard_map_msg); diff --git a/chaos/src/tent_map.hpp b/chaos/src/tent_map.hpp index 137599a..9ab59ec 100644 --- a/chaos/src/tent_map.hpp +++ b/chaos/src/tent_map.hpp @@ -25,18 +25,18 @@ // 0 <= x[n] < 1 // taken from Willi-Hans Steeb: Chaos and Fractals -class tent: - protected map_base +class tent_map: + public map_base { public: - tent() + tent_map() { m_num_eq = 1; m_data = new data_t[1]; CHAOS_SYS_INIT(x, 0.5); } - ~tent() + ~tent_map() { delete m_data; } @@ -59,12 +59,12 @@ public: }; -#define LOGISTIC_CALLBACKS \ +#define TENT_MAP_CALLBACKS \ MAP_CALLBACKS \ CHAOS_SYS_CALLBACKS(x); -#define LOGISTIC_ATTRIBUTES \ +#define TENT_MAP_ATTRIBUTES \ MAP_ATTRIBUTES \ CHAOS_SYS_ATTRIBUTE(x); - + diff --git a/chaos/src/tent_map_dsp.cpp b/chaos/src/tent_map_dsp.cpp new file mode 100644 index 0000000..10fe609 --- /dev/null +++ b/chaos/src/tent_map_dsp.cpp @@ -0,0 +1,34 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "tent_map.hpp" +#include "chaos_dsp.hpp" + +class tent_map_dsp: + public chaos_dsp +{ + CHAOS_DSP_INIT(tent_map, TENT_MAP_ATTRIBUTES); + + TENT_MAP_CALLBACKS; +}; + + + +FLEXT_LIB_DSP_V("tent~", tent_map_dsp); diff --git a/chaos/src/tent_map_msg.cpp b/chaos/src/tent_map_msg.cpp new file mode 100644 index 0000000..60c3c63 --- /dev/null +++ b/chaos/src/tent_map_msg.cpp @@ -0,0 +1,34 @@ +// +// +// chaos~ +// Copyright (C) 2004 Tim Blechmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include "tent_map.hpp" +#include "chaos_msg.hpp" + +class tent_map_msg: + public chaos_msg +{ + CHAOS_MSG_INIT(tent_map, TENT_MAP_ATTRIBUTES); + + TENT_MAP_CALLBACKS; +}; + + + +FLEXT_LIB_V("tent", tent_map_msg); -- cgit v1.2.1