Update of /cvsroot/pure-data/externals/chaos/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10698/src
Modified Files: Makefile.am chaos_dsp.hpp logistic_map.hpp lorenz.hpp main.cpp map_base.hpp ode_base.hpp Log Message: more changes ... getting stable ...
Index: ode_base.hpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/ode_base.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ode_base.hpp 24 Dec 2004 15:31:14 -0000 1.2 --- ode_base.hpp 24 Dec 2004 23:20:22 -0000 1.3 *************** *** 50,53 **** --- 50,75 ---- virtual void m_step(); + void ode_base_alloc() + { + int dimension = get_num_eq(); + + for (int i = 0; i != 3; ++i) + { + m_k[i] = new data_t[dimension]; + } + + m_tmp = new data_t[dimension]; + } + + void ode_base_free() + { + for (int i = 0; i != 3; ++i) + { + delete m_k[i]; + } + + delete m_tmp; + } + protected: unsigned char m_method; /* 0: rk1, 1: rk2, 3: rk4 */
Index: main.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/main.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** main.cpp 24 Dec 2004 15:31:14 -0000 1.2 --- main.cpp 24 Dec 2004 23:20:22 -0000 1.3 *************** *** 20,24 ****
#include "chaos.hpp" - #include "logistic_map.hpp"
void chaos_library_setup() --- 20,23 ---- *************** *** 27,30 **** --- 26,30 ---- FLEXT_DSP_SETUP(lorenz_dsp); + FLEXT_DSP_SETUP(logistic_dsp); }
Index: lorenz.hpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/lorenz.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** lorenz.hpp 24 Dec 2004 15:31:14 -0000 1.3 --- lorenz.hpp 24 Dec 2004 23:20:22 -0000 1.4 *************** *** 33,37 **** { m_num_eq = 3; ! m_data = new data_t[3];
CHAOS_SYS_INIT(method,0); --- 33,37 ---- { m_num_eq = 3; ! m_data = new data_t[m_num_eq];
CHAOS_SYS_INIT(method,0); *************** *** 44,47 **** --- 44,49 ---- CHAOS_SYS_INIT(r,40);
+ ode_base_alloc(); + set_method(0); } *************** *** 49,52 **** --- 51,55 ---- ~lorenz() { + ode_base_free(); delete m_data; }
Index: Makefile.am =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile.am 24 Dec 2004 15:31:14 -0000 1.2 --- Makefile.am 24 Dec 2004 23:20:22 -0000 1.3 *************** *** 2,6 ****
BUILT_SOURCES = main.cpp ode_base.cpp chaos_base.cpp chaos_dsp.cpp \ ! lorenz_dsp.cpp
--- 2,6 ----
BUILT_SOURCES = main.cpp ode_base.cpp chaos_base.cpp chaos_dsp.cpp \ ! lorenz_dsp.cpp logistic_dsp.cpp
Index: logistic_map.hpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/logistic_map.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** logistic_map.hpp 24 Dec 2004 15:31:14 -0000 1.3 --- logistic_map.hpp 24 Dec 2004 23:20:22 -0000 1.4 *************** *** 26,30 ****
class logistic: ! protected map_base { public: --- 26,30 ----
class logistic: ! public map_base { public:
Index: map_base.hpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/map_base.hpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** map_base.hpp 21 Dec 2004 09:22:10 -0000 1.1.1.1 --- map_base.hpp 24 Dec 2004 23:20:22 -0000 1.2 *************** *** 25,29 ****
class map_base ! : protected chaos_base { --- 25,29 ----
class map_base ! : public chaos_base {
Index: chaos_dsp.hpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/chaos_dsp.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** chaos_dsp.hpp 24 Dec 2004 15:31:14 -0000 1.2 --- chaos_dsp.hpp 24 Dec 2004 23:20:22 -0000 1.3 *************** *** 61,70 **** float m_sr; /* sample rate */ ! char m_method; /* interpolation method */ };
! /* create constructor / destructor */ \ #define CHAOS_DSP_INIT(SYSTEM, ATTRIBUTES) \ FLEXT_HEADER(SYSTEM##_dsp, chaos_dsp<SYSTEM>) \ --- 61,70 ---- float m_sr; /* sample rate */ ! int m_method; /* interpolation method */ };
! /* create constructor / destructor */ #define CHAOS_DSP_INIT(SYSTEM, ATTRIBUTES) \ FLEXT_HEADER(SYSTEM##_dsp, chaos_dsp<SYSTEM>) \ *************** *** 88,92 **** m_method = (char)GetAFloat(argv[1]); \ m_phase = 0; \ ! \ ATTRIBUTES; \ } \ --- 88,95 ---- m_method = (char)GetAFloat(argv[1]); \ m_phase = 0; \ ! \ ! FLEXT_ADDATTR_VAR1("frequency",m_freq); \ ! FLEXT_ADDATTR_VAR1("method",m_method); \ ! \ ATTRIBUTES; \ } \ *************** *** 100,105 **** delete m_nextmidpts; \ delete m_curves; \ ! } !
--- 103,110 ---- delete m_nextmidpts; \ delete m_curves; \ ! } \ ! \ ! FLEXT_ATTRVAR_F(m_freq); \ ! FLEXT_ATTRVAR_I(m_method);
*************** *** 107,111 **** template <class system> void chaos_dsp<system>::m_signal(int n, t_sample *const *insigs, ! t_sample *const *outsigs) { if (m_freq >= m_sr * 0.5) --- 112,116 ---- template <class system> void chaos_dsp<system>::m_signal(int n, t_sample *const *insigs, ! t_sample *const *outsigs) { if (m_freq >= m_sr * 0.5) *************** *** 114,118 **** return; } ! switch (m_method) { --- 119,123 ---- return; } ! switch (m_method) { *************** *** 158,162 **** while (n) { ! if (m_phase == 0) { m_system->m_step(); --- 163,167 ---- while (n) { ! if (phase == 0) { m_system->m_step(); *************** *** 195,199 **** while (n) { ! if (m_phase == 0) { m_system->m_step(); --- 200,204 ---- while (n) { ! if (phase == 0) { m_system->m_step(); *************** *** 234,238 **** while (n) { ! if (m_phase == 0) { m_system->m_step(); --- 239,243 ---- while (n) { ! if (phase == 0) { m_system->m_step();