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/chaos_msg.hpp | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 chaos/src/chaos_msg.hpp (limited to 'chaos/src/chaos_msg.hpp') 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; \ +} -- cgit v1.2.1 From 2a0d532e5965402f19f74f70dfdcc7efd1055b15 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sat, 1 Jan 2005 11:06:58 +0000 Subject: speedup using function pointers svn path=/trunk/externals/tb/; revision=2439 --- chaos/src/chaos_msg.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'chaos/src/chaos_msg.hpp') diff --git a/chaos/src/chaos_msg.hpp b/chaos/src/chaos_msg.hpp index 78bca06..3f80101 100644 --- a/chaos/src/chaos_msg.hpp +++ b/chaos/src/chaos_msg.hpp @@ -32,7 +32,7 @@ public: void m_bang() { - m_system->m_step(); + m_system->m_perform(); int outlets = m_system->get_num_eq(); while (outlets--) -- cgit v1.2.1 From f29a18911ce09a638646d90d1f72838313419380 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Tue, 1 Nov 2005 21:28:21 +0000 Subject: added new system svn path=/trunk/externals/tb/; revision=3811 --- chaos/src/chaos_msg.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'chaos/src/chaos_msg.hpp') diff --git a/chaos/src/chaos_msg.hpp b/chaos/src/chaos_msg.hpp index 3f80101..357ff6a 100644 --- a/chaos/src/chaos_msg.hpp +++ b/chaos/src/chaos_msg.hpp @@ -25,6 +25,11 @@ template class chaos_msg { FLEXT_HEADER(chaos_msg, flext_base); + ~chaos_msg() + { + delete m_system; + } + public: /* local data for system, output and interpolation */ @@ -59,10 +64,5 @@ SYSTEM##_msg(int argc, t_atom* argv ) \ AddOutFloat(); \ \ ATTRIBUTES; \ - FLEXT_ADDBANG(0, m_bang); \ -} \ - \ -~SYSTEM##_msg() \ -{ \ - delete m_system; \ + FLEXT_ADDBANG(0, m_bang); \ } -- cgit v1.2.1 From 13cba7a7997e318fbba01a36912219355e387d52 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sun, 21 May 2006 18:34:34 +0000 Subject: rewrote most stuff using templates svn path=/trunk/externals/tb/; revision=5105 --- chaos/src/chaos_msg.hpp | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) (limited to 'chaos/src/chaos_msg.hpp') diff --git a/chaos/src/chaos_msg.hpp b/chaos/src/chaos_msg.hpp index 357ff6a..9025273 100644 --- a/chaos/src/chaos_msg.hpp +++ b/chaos/src/chaos_msg.hpp @@ -20,29 +20,34 @@ #include "chaos_base.hpp" -template class chaos_msg - : public flext_base +template +class chaos_msg: + public flext_base { FLEXT_HEADER(chaos_msg, flext_base); - ~chaos_msg() - { - delete m_system; - } +protected: + chaos_msg(int argc, t_atom* argv) + { + int size = m_system.get_num_eq(); + + for (int i = 0; i != size; ++i) + AddOutFloat(); + FLEXT_ADDBANG(0, m_bang); + } public: - /* local data for system, output and interpolation */ - system * m_system; /* the system */ + system m_system; /* the system */ void m_bang() { - m_system->m_perform(); - int outlets = m_system->get_num_eq(); + m_system.m_perform(); + int outlets = m_system.get_num_eq(); while (outlets--) { - ToOutFloat(outlets, m_system->get_data(outlets)); + ToOutFloat(outlets, m_system.get_data(outlets)); } } @@ -54,15 +59,8 @@ public: #define CHAOS_MSG_INIT(SYSTEM, ATTRIBUTES) \ FLEXT_HEADER(SYSTEM##_msg, chaos_msg) \ \ -SYSTEM##_msg(int argc, t_atom* argv ) \ +SYSTEM##_msg(int argc, t_atom* argv ): \ +chaos_msg(argc, 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); \ } -- cgit v1.2.1 From 2c157bd8aa1f5387169cc0c0910d36c8068c4068 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sun, 21 May 2006 19:17:04 +0000 Subject: improved inlining for maps svn path=/trunk/externals/tb/; revision=5106 --- chaos/src/chaos_msg.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'chaos/src/chaos_msg.hpp') diff --git a/chaos/src/chaos_msg.hpp b/chaos/src/chaos_msg.hpp index 9025273..915d6a1 100644 --- a/chaos/src/chaos_msg.hpp +++ b/chaos/src/chaos_msg.hpp @@ -42,7 +42,11 @@ public: void m_bang() { - m_system.m_perform(); + m_system.m_step(); + m_system.m_bash_denormals(); + m_system.m_verify(); + + int outlets = m_system.get_num_eq(); while (outlets--) -- cgit v1.2.1