From 432472fe416edfb1f5548e7a4998e62869ff41e5 Mon Sep 17 00:00:00 2001
From: Tim Blechmann <timblech@users.sourceforge.net>
Date: Wed, 21 May 2003 10:50:37 +0000
Subject: This commit was generated by cvs2svn to compensate for changes in
 r641, which included commits to RCS files with non-trunk default branches.

svn path=/trunk/externals/tb/; revision=642
---
 tbext/source/main.cpp      |  64 ++++++++++++++++++++++++++
 tbext/source/tbpow~.cpp    | 100 ++++++++++++++++++++++++++++++++++++++++
 tbext/source/tbroute.cpp   | 112 +++++++++++++++++++++++++++++++++++++++++++++
 tbext/source/tbsig~.cpp    |  85 ++++++++++++++++++++++++++++++++++
 tbext/source/tbsroute~.cpp | 109 +++++++++++++++++++++++++++++++++++++++++++
 tbext/source/tbstrg.cpp    |  95 ++++++++++++++++++++++++++++++++++++++
 6 files changed, 565 insertions(+)
 create mode 100644 tbext/source/main.cpp
 create mode 100644 tbext/source/tbpow~.cpp
 create mode 100644 tbext/source/tbroute.cpp
 create mode 100644 tbext/source/tbsig~.cpp
 create mode 100644 tbext/source/tbsroute~.cpp
 create mode 100644 tbext/source/tbstrg.cpp

(limited to 'tbext/source')

diff --git a/tbext/source/main.cpp b/tbext/source/main.cpp
new file mode 100644
index 0000000..c4317fd
--- /dev/null
+++ b/tbext/source/main.cpp
@@ -0,0 +1,64 @@
+/* Copyright (c) 2003 Tim Blechmann.                                            */
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL     */
+/* WARRANTIES, see the file, "COPYING"  in this distribution.                   */
+/*                                                                              */
+/*                                                                              */
+/* tbext is the collection of some external i wrote.                            */
+/* some are useful, others aren't...                                            */
+/*                                                                              */
+/*                                                                              */
+/* tbext uses the flext C++ layer for Max/MSP and PD externals.                 */
+/* get it at http://www.parasitaere-kapazitaeten.de/PD/ext                      */
+/* thanks to Thomas Grill                                                       */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* 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.                       */
+/*                                                                              */
+/* See file LICENSE for further informations on licensing terms.                */
+/*                                                                              */
+/* 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; if not, write to the Free Software                  */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  */
+/*                                                                              */
+/* Based on PureData by Miller Puckette and others.                             */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* coded while listening to: Hamid Drake & Assif Tsahar: Soul Bodies, Vol. 1    */
+/*                           I.S.O.: I.S.O                                      */
+/*                                                                              */
+
+
+
+#include <flext.h>
+#define TBEXT_VERSION "0.01"
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 400)
+#error upgrade your flext version!!!!!!
+#endif
+
+void ttbext_setup()
+{
+  post("TBEXT: by tim blechmann");
+  post("version "TBEXT_VERSION);
+  post("compiled on "__DATE__);
+  post("");
+
+  FLEXT_SETUP(tbroute);
+  FLEXT_SETUP(tbstrg);
+  FLEXT_DSP_SETUP(tbsroute);
+  FLEXT_DSP_SETUP(tbsig);
+  FLEXT_DSP_SETUP(tbpow);
+
+}
+
+FLEXT_LIB_SETUP(tbext,ttbext_setup)
diff --git a/tbext/source/tbpow~.cpp b/tbext/source/tbpow~.cpp
new file mode 100644
index 0000000..14a383c
--- /dev/null
+++ b/tbext/source/tbpow~.cpp
@@ -0,0 +1,100 @@
+/* Copyright (c) 2003 Tim Blechmann.                                            */
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL     */
+/* WARRANTIES, see the file, "COPYING"  in this distribution.                   */
+/*                                                                              */
+/*                                                                              */
+/* tbpow~ calculates the power of each sample. In fact i expected it to sound   */
+/* better than it does. but maybe someone is interested in using it...          */
+/*                                                                              */
+/*                                                                              */
+/* tbpow~ uses the flext C++ layer for Max/MSP and PD externals.                */
+/* get it at http://www.parasitaere-kapazitaeten.de/PD/ext                      */
+/* thanks to Thomas Grill                                                       */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* 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.                       */
+/*                                                                              */
+/* See file LICENSE for further informations on licensing terms.                */
+/*                                                                              */
+/* 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; if not, write to the Free Software                  */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  */
+/*                                                                              */
+/* Based on PureData by Miller Puckette and others.                             */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* coded while listening to: Assif Tsahar & Susie Ibarra: Home Cookin'          */
+/*                           Painkiller: Talisman                               */
+/*                                                                              */
+
+
+
+#include <flext.h>
+
+#include <cmath>
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401)
+#error upgrade your flext version!!!!!!
+#endif
+
+class tbpow: public flext_dsp
+{
+  FLEXT_HEADER(tbpow,flext_dsp);
+
+public: // constructor
+  tbpow();
+
+protected:
+  virtual void m_signal (int n, float *const *in, float *const *out);
+
+  void set_power(float f);
+  
+private:
+  float power;
+  
+  FLEXT_CALLBACK_1(set_power,float)
+  
+};
+
+
+FLEXT_LIB_DSP("tbpow~",tbpow);
+
+tbpow::tbpow()
+{
+  AddInSignal();
+  AddInFloat();
+  AddOutSignal();
+  
+  FLEXT_ADDMETHOD(1,set_power);
+  power=1;
+} 
+
+
+void tbpow::m_signal(int n, float *const *in, float *const *out)
+{
+  const float *ins=in[0];
+  float *outs = out[0];
+
+  while (n--)
+    {
+      *outs = pow(*ins,power);
+      *outs++;
+      *ins++;
+    }
+ 
+}
+
+void tbpow::set_power(float f)
+{
+  power=f;
+}
diff --git a/tbext/source/tbroute.cpp b/tbext/source/tbroute.cpp
new file mode 100644
index 0000000..83d85a0
--- /dev/null
+++ b/tbext/source/tbroute.cpp
@@ -0,0 +1,112 @@
+/* Copyright (c) 2003 Tim Blechmann.                                            */
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL     */
+/* WARRANTIES, see the file, "COPYING"  in this distribution.                   */
+/*                                                                              */
+/*                                                                              */
+/* tbroute is an advanced router.                                               */
+/* the signal to the first inlet is being routed to the outlet specified        */
+/* by the second inlet.                                                         */
+/* the number of outlets is specified by the creation argument                  */
+/*                                                                              */
+/*                                                                              */
+/* tbroute uses the flext C++ layer for Max/MSP and PD externals.               */
+/* get it at http://www.parasitaere-kapazitaeten.de/PD/ext                      */
+/* thanks to Thomas Grill                                                       */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* 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.                       */
+/*                                                                              */
+/* See file LICENSE for further informations on licensing terms.                */
+/*                                                                              */
+/* 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; if not, write to the Free Software                  */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  */
+/*                                                                              */
+/* Based on PureData by Miller Puckette and others.                             */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* coded while listening to: Hamid Drake & Assif Tsahar: Soul Bodies, Vol. 1    */
+/*                           I.S.O.: I.S.O                                      */
+/*                                                                              */
+/*                                                                              */
+
+
+#include <flext.h>
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 400)
+#error upgrade your flext version!!!!!!
+#endif
+
+class tbroute: public flext_base
+{
+  FLEXT_HEADER(tbroute,flext_base);
+  
+public: // constructor
+  tbroute(t_int chan);
+
+protected:
+  void route(t_float f);
+
+  void routebang();
+  void set_route(t_int i);
+
+private:
+  FLEXT_CALLBACK_1(route,t_float);
+  
+  FLEXT_CALLBACK(routebang);
+  FLEXT_CALLBACK_1(set_route,t_int);
+  t_int dest;
+};
+
+
+FLEXT_LIB_1("tbroute",tbroute,int);
+
+tbroute::tbroute(t_int chan)
+{
+  AddInAnything();
+  AddInInt();
+  
+  for (t_int i=0; i!=chan;++i)
+    {    
+      AddOutAnything();
+    }
+  
+  FLEXT_ADDMETHOD(0,route);
+  FLEXT_ADDBANG(0,routebang);
+  FLEXT_ADDMETHOD(1,set_route);
+  dest=0;
+}
+
+void tbroute::route(t_float f)
+{
+  ToOutFloat(dest,f);
+}
+
+
+void tbroute::routebang()
+{
+  ToOutBang(dest);
+}
+
+void tbroute::set_route(t_int i)
+{
+  --i;
+  if ((i>-1) && (i<CntOut()))
+    {  
+      dest=i;
+    }
+  else
+    {
+      post("no such outlet");
+    }
+}
diff --git a/tbext/source/tbsig~.cpp b/tbext/source/tbsig~.cpp
new file mode 100644
index 0000000..cda79cc
--- /dev/null
+++ b/tbext/source/tbsig~.cpp
@@ -0,0 +1,85 @@
+/* Copyright (c) 2003 Tim Blechmann.                                            */
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL     */
+/* WARRANTIES, see the file, "COPYING"  in this distribution.                   */
+/*                                                                              */
+/*                                                                              */
+/* tbsig~ is gives you the sign of an audio signal. should be useful to create  */
+/* a square oscillator or some noisy sounds                                     */
+/*                                                                              */
+/*                                                                              */
+/* tbsig~ uses the flext C++ layer for Max/MSP and PD externals.                */
+/* get it at http://www.parasitaere-kapazitaeten.de/PD/ext                      */
+/* thanks to Thomas Grill                                                       */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* 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.                       */
+/*                                                                              */
+/* See file LICENSE for further informations on licensing terms.                */
+/*                                                                              */
+/* 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; if not, write to the Free Software                  */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  */
+/*                                                                              */
+/* Based on PureData by Miller Puckette and others.                             */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* coded while listening to: Peter Broetzmann & Hamid Drake: The Dried Rat-Dog  */
+/*                                                                              */
+/*                                                                              */
+
+
+
+#include <flext.h>
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401)
+#error upgrade your flext version!!!!!!
+#endif
+
+class tbsig: public flext_dsp
+{
+  FLEXT_HEADER(tbsig,flext_dsp);
+
+public: // constructor
+  tbsig();
+
+protected:
+  virtual void m_signal (int n, float *const *in, float *const *out);
+
+};
+
+
+FLEXT_LIB_DSP("tbsig~",tbsig);
+
+tbsig::tbsig()
+{
+  AddInSignal();
+  AddOutSignal();
+} 
+
+
+void tbsig::m_signal(int n, float *const *in, float *const *out)
+{
+  const float *ins=in[0];
+  float *outs = out[0];
+
+  while (n--)
+    {
+      if (*ins>0) 
+	*outs = 1;
+      else
+	*outs = -1;
+      *outs++;
+      *ins++;
+    }
+ 
+}
diff --git a/tbext/source/tbsroute~.cpp b/tbext/source/tbsroute~.cpp
new file mode 100644
index 0000000..3d2264d
--- /dev/null
+++ b/tbext/source/tbsroute~.cpp
@@ -0,0 +1,109 @@
+/* Copyright (c) 2003 Tim Blechmann.                                            */
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL     */
+/* WARRANTIES, see the file, "COPYING"  in this distribution.                   */
+/*                                                                              */
+/*                                                                              */
+/* tbsroute~ is an advanced signal router.                                      */
+/* the signal to the first inlet is being routed to the outlet specified        */
+/* by the second inlet.                                                         */
+/* the number of outlets is specified by the creation argument                  */
+/*                                                                              */
+/*                                                                              */
+/* tbsroute~ uses the flext C++ layer for Max/MSP and PD externals.             */
+/* get it at http://www.parasitaere-kapazitaeten.de/PD/ext                      */
+/* thanks to Thomas Grill                                                       */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* 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.                       */
+/*                                                                              */
+/* See file LICENSE for further informations on licensing terms.                */
+/*                                                                              */
+/* 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; if not, write to the Free Software                  */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  */
+/*                                                                              */
+/* Based on PureData by Miller Puckette and others.                             */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* coded while listening to: AMM: AMMMUSIC 1966                                 */
+/*                           Sun Ra: Dancing Shadows                            */
+/*                                                                              */
+
+
+#include <flext.h>
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401)
+#error upgrade your flext version!!!!!!
+#endif
+
+class tbsroute: public flext_dsp
+{
+  FLEXT_HEADER(tbsroute,flext_dsp)
+
+public: // constructor
+  tbsroute(int chan);
+
+protected:
+  virtual void m_signal (int n, float *const *in, float *const *out);
+  void set_route(int i);
+
+private:
+  FLEXT_CALLBACK_1(set_route,t_int)
+  t_int dest;
+};
+
+
+FLEXT_LIB_DSP_1("tbroute~",tbsroute,int)
+
+  tbsroute::tbsroute(t_int chan):dest(0)
+{
+  AddInSignal();
+  AddInInt();
+  
+  for (t_int i=0; i!=chan;++i)
+    {    
+      AddOutSignal();
+    }
+  
+  FLEXT_ADDMETHOD(1,set_route);
+} 
+
+
+void tbsroute::m_signal(int n, float *const *in, float *const *out)
+{
+
+  CopySamples(out[dest],in[0],n);
+
+  for (int i = 0; i != CntOutSig(); i++)
+    if (i!=dest) ZeroSamples(out[i],n);
+  
+  
+
+
+}
+
+
+void tbsroute::set_route(t_int i)
+{
+  --i;
+  if ((i>-1) && (i<CntOutSig()))
+    {  
+      dest=i;
+      post("routing to outlet %i",i+1);
+    }
+  else
+    {
+	post("no such outlet");
+    }
+  
+}
diff --git a/tbext/source/tbstrg.cpp b/tbext/source/tbstrg.cpp
new file mode 100644
index 0000000..c71c7da
--- /dev/null
+++ b/tbext/source/tbstrg.cpp
@@ -0,0 +1,95 @@
+/* Copyright (c) 2003 Tim Blechmann.                                            */
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL     */
+/* WARRANTIES, see the file, "COPYING"  in this distribution.                   */
+/*                                                                              */
+/* tbstrg can be used to switch between several modules. it requires a creation */
+/* argument (number of outlets).                                                */
+/* if you send an integer to the inlet this outlet will get the message 1, the  */
+/* outlet, that was active earlier, will get the message 0.                     */
+/*                                                                              */
+/*                                                                              */
+/* tbstrg uses the flext C++ layer for Max/MSP and PD externals.                */
+/* get it at http://www.parasitaere-kapazitaeten.de/PD/ext                      */
+/* thanks to Thomas Grill                                                       */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* 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.                       */
+/*                                                                              */
+/* See file LICENSE for further informations on licensing terms.                */
+/*                                                                              */
+/* 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; if not, write to the Free Software                  */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  */
+/*                                                                              */
+/* Based on PureData by Miller Puckette and others.                             */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* coded while listening to: Bob Ostertag - DJ Of The Month                     */
+/*                           John Zorn's Cobra: Tokyo Operations '94            */
+/*                                                                              */
+/*                                                                              */
+
+
+
+#include <flext.h>
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 400)
+#error upgrade your flext version!!!!!!
+#endif
+
+class tbstrg: public flext_base
+{
+  FLEXT_HEADER(tbstrg,flext_base);
+
+public: // constructor
+  tbstrg(t_int chan);
+  
+protected:
+  void set_route(t_int i);
+
+private:
+
+  FLEXT_CALLBACK_1(set_route,t_int);
+  t_int dest;
+};
+
+
+FLEXT_LIB_1("tbstrg",tbstrg,int);
+
+tbstrg::tbstrg(t_int chan)
+{
+  AddInInt();
+  
+  for (t_int i=0; i!=chan;++i)
+    {    
+      AddOutAnything();
+    }
+  
+
+  FLEXT_ADDMETHOD(0,set_route);
+  dest=0;
+}
+
+void tbstrg::set_route(t_int i)
+{
+  if (i != dest)
+    {
+      --i;
+      if ((i>-1) && (i<CntOut()))
+	{  
+	  ToOutInt(dest,0);
+	  dest=i;
+	  ToOutInt(dest,1);
+	}
+    }
+}
-- 
cgit v1.2.1


From 6399d444c572093ab8bc356be0cb915b33265415 Mon Sep 17 00:00:00 2001
From: Tim Blechmann <timblech@users.sourceforge.net>
Date: Sun, 7 Sep 2003 00:42:00 +0000
Subject: *** empty log message ***

svn path=/trunk/externals/tb/; revision=934
---
 tbext/source/main.cpp      |  5 ++++-
 tbext/source/tbroute.cpp   | 16 ++++++++--------
 tbext/source/tbsroute~.cpp | 12 ++++++------
 tbext/source/tbstrg.cpp    |  2 +-
 4 files changed, 19 insertions(+), 16 deletions(-)

(limited to 'tbext/source')

diff --git a/tbext/source/main.cpp b/tbext/source/main.cpp
index c4317fd..9cfbd24 100644
--- a/tbext/source/main.cpp
+++ b/tbext/source/main.cpp
@@ -54,10 +54,13 @@ void ttbext_setup()
   post("");
 
   FLEXT_SETUP(tbroute);
-  FLEXT_SETUP(tbstrg);
+  //FLEXT_SETUP(tbstrg);
   FLEXT_DSP_SETUP(tbsroute);
   FLEXT_DSP_SETUP(tbsig);
   FLEXT_DSP_SETUP(tbpow);
+  //  FLEXT_DSP_SETUP(tbg7xx);
+  FLEXT_DSP_SETUP(tbfft1);
+
 
 }
 
diff --git a/tbext/source/tbroute.cpp b/tbext/source/tbroute.cpp
index 83d85a0..3218886 100644
--- a/tbext/source/tbroute.cpp
+++ b/tbext/source/tbroute.cpp
@@ -40,7 +40,6 @@
 /*                                                                              */
 /*                                                                              */
 
-
 #include <flext.h>
 
 #if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 400)
@@ -52,31 +51,32 @@ class tbroute: public flext_base
   FLEXT_HEADER(tbroute,flext_base);
   
 public: // constructor
-  tbroute(t_int chan);
+  tbroute(int chan);
 
 protected:
   void route(t_float f);
 
   void routebang();
-  void set_route(t_int i);
+  void set_route(int i);
 
 private:
   FLEXT_CALLBACK_1(route,t_float);
   
   FLEXT_CALLBACK(routebang);
-  FLEXT_CALLBACK_1(set_route,t_int);
-  t_int dest;
+  FLEXT_CALLBACK_1(set_route,int);
+  
+  int dest;
 };
 
 
 FLEXT_LIB_1("tbroute",tbroute,int);
 
-tbroute::tbroute(t_int chan)
+tbroute::tbroute(int chan)
 {
   AddInAnything();
   AddInInt();
   
-  for (t_int i=0; i!=chan;++i)
+  for (int i=0; i!=chan;++i)
     {    
       AddOutAnything();
     }
@@ -98,7 +98,7 @@ void tbroute::routebang()
   ToOutBang(dest);
 }
 
-void tbroute::set_route(t_int i)
+void tbroute::set_route(int i)
 {
   --i;
   if ((i>-1) && (i<CntOut()))
diff --git a/tbext/source/tbsroute~.cpp b/tbext/source/tbsroute~.cpp
index 3d2264d..d18d264 100644
--- a/tbext/source/tbsroute~.cpp
+++ b/tbext/source/tbsroute~.cpp
@@ -51,21 +51,22 @@ class tbsroute: public flext_dsp
   FLEXT_HEADER(tbsroute,flext_dsp)
 
 public: // constructor
-  tbsroute(int chan);
+  tbsroute(t_int chan);
 
 protected:
   virtual void m_signal (int n, float *const *in, float *const *out);
   void set_route(int i);
 
 private:
-  FLEXT_CALLBACK_1(set_route,t_int)
+  FLEXT_CALLBACK_1(set_route,int)
   t_int dest;
 };
 
 
-FLEXT_LIB_DSP_1("tbroute~",tbsroute,int)
+FLEXT_LIB_DSP_1("tbroute~",tbsroute,int);
 
-  tbsroute::tbsroute(t_int chan):dest(0)
+tbsroute::tbsroute (t_int chan):
+  dest(0)
 {
   AddInSignal();
   AddInInt();
@@ -92,8 +93,7 @@ void tbsroute::m_signal(int n, float *const *in, float *const *out)
 
 }
 
-
-void tbsroute::set_route(t_int i)
+void tbsroute::set_route(int i)
 {
   --i;
   if ((i>-1) && (i<CntOutSig()))
diff --git a/tbext/source/tbstrg.cpp b/tbext/source/tbstrg.cpp
index c71c7da..a999e2f 100644
--- a/tbext/source/tbstrg.cpp
+++ b/tbext/source/tbstrg.cpp
@@ -59,7 +59,7 @@ protected:
 
 private:
 
-  FLEXT_CALLBACK_1(set_route,t_int);
+  FLEXT_CALLBACK(set_route,t_int);
   t_int dest;
 };
 
-- 
cgit v1.2.1


From 20a2e866dcfd5c9911161a9e7a7df135c5c76073 Mon Sep 17 00:00:00 2001
From: Tim Blechmann <timblech@users.sourceforge.net>
Date: Sun, 7 Sep 2003 00:52:31 +0000
Subject: *** empty log message ***

svn path=/trunk/externals/tb/; revision=935
---
 tbext/source/tbfft1.cpp | 134 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 134 insertions(+)
 create mode 100644 tbext/source/tbfft1.cpp

(limited to 'tbext/source')

diff --git a/tbext/source/tbfft1.cpp b/tbext/source/tbfft1.cpp
new file mode 100644
index 0000000..8bff178
--- /dev/null
+++ b/tbext/source/tbfft1.cpp
@@ -0,0 +1,134 @@
+/* Copyright (c) 2003 Tim Blechmann.                                            */
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL     */
+/* WARRANTIES, see the file, "COPYING"  in this distribution.                   */
+/*                                                                              */
+/*                                                                              */
+/* tbfft1~ transforms the fft spectrum                                          */
+/*                                                                              */
+/* tbfft1~ uses the flext C++ layer for Max/MSP and PD externals.               */
+/* get it at http://www.parasitaere-kapazitaeten.de/PD/ext                      */
+/* thanks to Thomas Grill                                                       */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* 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.                       */
+/*                                                                              */
+/* See file LICENSE for further informations on licensing terms.                */
+/*                                                                              */
+/* 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; if not, write to the Free Software                  */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  */
+/*                                                                              */
+/* Based on PureData by Miller Puckette and others.                             */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* coded while listening to: John Zorn / Mike Patton / Ikue Mori: Hemophiliac   */
+/*                           Rashied Ali / Frank Lowe: Duo Exchange             */
+/*                           Keith Rowe / John Tilbury: Duos For Doris          */
+/*                                                                              */
+
+
+
+#include <flext.h>
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401)
+#error upgrade your flext version!!!!!!
+#endif
+
+
+class tbfft1: public flext_dsp
+{
+  FLEXT_HEADER(tbfft1,flext_dsp);
+
+public: // constructor
+  tbfft1();
+
+protected:
+  virtual void m_signal (int n, float *const *in, float *const *out);
+  void set_freq(t_float);
+  void set_fact(t_float);
+
+private:
+  FLEXT_CALLBACK_1(set_freq,t_float)
+  FLEXT_CALLBACK_1(set_fact,t_float)
+  
+  t_int center;
+  t_float factor;
+  
+  t_float pos;
+  t_int posi;
+
+  float *ins;
+  float *outs;
+
+  t_float s;
+  t_float b;
+
+
+};
+
+
+FLEXT_LIB_DSP("tbfft1~",tbfft1)
+
+tbfft1::tbfft1()
+{
+  AddInSignal();
+  AddOutSignal();
+  FLEXT_ADDMETHOD_F(0,"center",set_freq);
+  FLEXT_ADDMETHOD_F(0,"factor",set_fact);
+} 
+
+
+void tbfft1::m_signal(int n, t_float *const *in, t_float *const *out)
+{
+  ins = in[0];
+  outs = out[0];
+
+  n=n/2+1;
+  while(n!=0)
+    {
+      pos= n + factor * (center-n);
+      posi=t_int(pos);
+      
+
+      if (n < t_int(center))
+	{
+	  *(outs+n) = ((pos-t_float(posi)) * (*(ins+posi)))/2 
+	    +((1-pos+t_float(posi)) * (*(ins+posi+1)))/2;
+	}
+      else
+	{
+	  *(outs+n) = ((pos-t_float(posi)) * (*(ins+posi-1)))/2 
+	    +((1-pos+t_float(posi)) * (*(ins+posi)))/2;
+	}
+      
+      --n;
+    }
+  
+  
+}
+
+void tbfft1::set_freq(t_float freq)
+{
+  s=Samplerate(); 
+  
+  b=Blocksize();     
+  
+  center=freq/(s/b);
+  post("%i",int(center));
+}
+
+
+void tbfft1::set_fact(t_float f)
+{
+  factor=f;
+}
-- 
cgit v1.2.1


From 12c9210a8592cf46616d453dda02f5ea56c44cc4 Mon Sep 17 00:00:00 2001
From: Tim Blechmann <timblech@users.sourceforge.net>
Date: Mon, 8 Sep 2003 21:49:34 +0000
Subject: *** empty log message ***

svn path=/trunk/externals/tb/; revision=946
---
 tbext/source/main.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'tbext/source')

diff --git a/tbext/source/main.cpp b/tbext/source/main.cpp
index 9cfbd24..e8bf9e3 100644
--- a/tbext/source/main.cpp
+++ b/tbext/source/main.cpp
@@ -40,7 +40,7 @@
 
 
 #include <flext.h>
-#define TBEXT_VERSION "0.01"
+#define TBEXT_VERSION "0.02"
 
 #if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 400)
 #error upgrade your flext version!!!!!!
-- 
cgit v1.2.1


From 5cc947f46350f347575cc61df0e3c07c6458542b Mon Sep 17 00:00:00 2001
From: Tim Blechmann <timblech@users.sourceforge.net>
Date: Sun, 14 Sep 2003 16:38:25 +0000
Subject: *** empty log message ***

svn path=/trunk/externals/tb/; revision=962
---
 tbext/source/tbfft1.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'tbext/source')

diff --git a/tbext/source/tbfft1.cpp b/tbext/source/tbfft1.cpp
index 8bff178..e941bfd 100644
--- a/tbext/source/tbfft1.cpp
+++ b/tbext/source/tbfft1.cpp
@@ -124,11 +124,11 @@ void tbfft1::set_freq(t_float freq)
   b=Blocksize();     
   
   center=freq/(s/b);
-  post("%i",int(center));
 }
 
 
 void tbfft1::set_fact(t_float f)
 {
-  factor=f;
+  if (f<2)
+    factor=f;
 }
-- 
cgit v1.2.1


From 533c8ad7244dce612aa821e9b18c282c42fa0f37 Mon Sep 17 00:00:00 2001
From: Tim Blechmann <timblech@users.sourceforge.net>
Date: Sun, 14 Sep 2003 16:41:01 +0000
Subject: Added tbfft2

svn path=/trunk/externals/tb/; revision=963
---
 tbext/source/main.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'tbext/source')

diff --git a/tbext/source/main.cpp b/tbext/source/main.cpp
index e8bf9e3..c64c2fc 100644
--- a/tbext/source/main.cpp
+++ b/tbext/source/main.cpp
@@ -56,11 +56,13 @@ void ttbext_setup()
   FLEXT_SETUP(tbroute);
   //FLEXT_SETUP(tbstrg);
   FLEXT_DSP_SETUP(tbsroute);
+  //  FLEXT_SETUP(tblock);
   FLEXT_DSP_SETUP(tbsig);
   FLEXT_DSP_SETUP(tbpow);
   //  FLEXT_DSP_SETUP(tbg7xx);
   FLEXT_DSP_SETUP(tbfft1);
-
+  FLEXT_DSP_SETUP(tbfft2);
+  //  FLEXT_DSP_SETUP(fftbuf);
 
 }
 
-- 
cgit v1.2.1


From e06c0dcda335f4c6009750c9cf9366e7c2e72fe8 Mon Sep 17 00:00:00 2001
From: Tim Blechmann <timblech@users.sourceforge.net>
Date: Mon, 15 Sep 2003 04:49:59 +0000
Subject: *** empty log message ***

svn path=/trunk/externals/tb/; revision=966
---
 tbext/source/main.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

(limited to 'tbext/source')

diff --git a/tbext/source/main.cpp b/tbext/source/main.cpp
index c64c2fc..1cb0992 100644
--- a/tbext/source/main.cpp
+++ b/tbext/source/main.cpp
@@ -56,13 +56,12 @@ void ttbext_setup()
   FLEXT_SETUP(tbroute);
   //FLEXT_SETUP(tbstrg);
   FLEXT_DSP_SETUP(tbsroute);
-  //  FLEXT_SETUP(tblock);
   FLEXT_DSP_SETUP(tbsig);
   FLEXT_DSP_SETUP(tbpow);
   //  FLEXT_DSP_SETUP(tbg7xx);
   FLEXT_DSP_SETUP(tbfft1);
   FLEXT_DSP_SETUP(tbfft2);
-  //  FLEXT_DSP_SETUP(fftbuf);
+  FLEXT_DSP_SETUP(fftbuf);
 
 }
 
-- 
cgit v1.2.1


From f4c793955cb1170ff0fa0a2e30a8b619ee582325 Mon Sep 17 00:00:00 2001
From: Tim Blechmann <timblech@users.sourceforge.net>
Date: Thu, 18 Sep 2003 05:04:12 +0000
Subject: Some spectral processors have been added

svn path=/trunk/externals/tb/; revision=1007
---
 tbext/source/main.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

(limited to 'tbext/source')

diff --git a/tbext/source/main.cpp b/tbext/source/main.cpp
index 1cb0992..bd6d833 100644
--- a/tbext/source/main.cpp
+++ b/tbext/source/main.cpp
@@ -40,7 +40,7 @@
 
 
 #include <flext.h>
-#define TBEXT_VERSION "0.02"
+#define TBEXT_VERSION "0.03"
 
 #if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 400)
 #error upgrade your flext version!!!!!!
@@ -62,7 +62,9 @@ void ttbext_setup()
   FLEXT_DSP_SETUP(tbfft1);
   FLEXT_DSP_SETUP(tbfft2);
   FLEXT_DSP_SETUP(fftbuf);
-
+  FLEXT_DSP_SETUP(fftgrsort);
+  FLEXT_DSP_SETUP(fftgrshuf);
+  FLEXT_DSP_SETUP(fftgrrev);
 }
 
 FLEXT_LIB_SETUP(tbext,ttbext_setup)
-- 
cgit v1.2.1


From 81d751e8824f6a9b3975c1da517d1d163a2eace5 Mon Sep 17 00:00:00 2001
From: Tim Blechmann <timblech@users.sourceforge.net>
Date: Sat, 20 Sep 2003 00:05:08 +0000
Subject: *** empty log message ***

svn path=/trunk/externals/tb/; revision=1012
---
 tbext/source/fftbuf.cpp    | 247 +++++++++++++++++++++++++++++++++++++++++++++
 tbext/source/fftgrrev.cpp  | 165 ++++++++++++++++++++++++++++++
 tbext/source/fftgrshuf.cpp | 161 +++++++++++++++++++++++++++++
 tbext/source/fftgrsort.cpp | 176 ++++++++++++++++++++++++++++++++
 tbext/source/main.cpp      |   1 +
 tbext/source/tbfft2.cpp    | 147 +++++++++++++++++++++++++++
 6 files changed, 897 insertions(+)
 create mode 100644 tbext/source/fftbuf.cpp
 create mode 100644 tbext/source/fftgrrev.cpp
 create mode 100644 tbext/source/fftgrshuf.cpp
 create mode 100644 tbext/source/fftgrsort.cpp
 create mode 100644 tbext/source/tbfft2.cpp

(limited to 'tbext/source')

diff --git a/tbext/source/fftbuf.cpp b/tbext/source/fftbuf.cpp
new file mode 100644
index 0000000..eff81e3
--- /dev/null
+++ b/tbext/source/fftbuf.cpp
@@ -0,0 +1,247 @@
+/* Copyright (c) 2003 Tim Blechmann.                                            */
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL     */
+/* WARRANTIES, see the file, "COPYING"  in this distribution.                   */
+/*                                                                              */
+/*                                                                              */
+/* fftbuf~ fades between two buffers. it is intended to be used as fft          */
+/* synthesis tool...                                                            */
+/*                                                                              */
+/*                                                                              */
+/* fftbuf~ uses the flext C++ layer for Max/MSP and PD externals.               */
+/* get it at http://www.parasitaere-kapazitaeten.de/PD/ext                      */
+/* thanks to Thomas Grill                                                       */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* 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.                       */
+/*                                                                              */
+/* See file LICENSE for further informations on licensing terms.                */
+/*                                                                              */
+/* 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; if not, write to the Free Software                  */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  */
+/*                                                                              */
+/* Based on PureData by Miller Puckette and others.                             */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* coded while listening to: J�r�me Noetinger/ErikM: What a Wonderful World     */
+/*                           Cosmos: Tears                                      */
+/*                           Burkhard Stangl/Dieb13: eh                         */
+/*                                                                              */
+
+
+
+#include <flext.h>
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401)
+#error upgrade your flext version!!!!!!
+#endif
+
+
+class fftbuf: public flext_dsp
+{
+  FLEXT_HEADER(fftbuf,flext_dsp);
+
+public: // constructor
+  
+  fftbuf(int);
+  ~fftbuf();
+
+protected:
+  virtual void m_signal (int n, float *const *in, float *const *out);
+  bool check(buffer *);
+
+  
+  void set_buf(int argc,  t_atom *argv); //selects a new buffer
+  void set_line(int argc,  t_atom *argv); //sets the time for the transformance
+  
+  template<typename T>
+  void clear(T *); //destroys an object
+  
+  void perform(); //starts transformation
+  
+  int blknumber(); //number of blocks that a performance needs
+
+private:
+  FLEXT_CALLBACK_V(set_buf);
+  FLEXT_CALLBACK_V(set_line);
+  FLEXT_CALLBACK(perform);
+
+  float *ins;
+  float *outs;
+
+  t_symbol * bufname; 
+  buffer * buf;
+    
+  int delay; //delay for fading from local buffer to new one
+  t_sample * data; // pointer to array of samples
+  t_sample * offset; // pointer to array of samples
+
+  int bs; //blocksize+1
+  int sr; //samplerate
+  int counter;
+};
+
+
+FLEXT_LIB_DSP_1("bufline~",fftbuf,int);
+
+fftbuf::fftbuf(int arg):
+  buf(NULL),data(NULL),sr(Samplerate()),delay(0),counter(0)
+{
+  bs=arg+1;
+  AddInAnything();
+  AddOutSignal();
+  FLEXT_ADDMETHOD_(0,"set",set_buf);
+  FLEXT_ADDMETHOD_(0,"line",set_line);
+  FLEXT_ADDBANG(0,perform);
+
+  
+  data= new t_sample[bs];
+  offset= new t_sample[bs];
+  ZeroSamples(data,bs);
+  ZeroSamples(offset,bs);
+}
+
+
+fftbuf::~fftbuf()
+{
+  delete data;
+  delete offset;
+}
+
+
+void fftbuf::m_signal(int n, t_float *const *in, t_float *const *out)
+{
+  outs = out[0];
+  
+  if (counter!=0)
+    {
+      n=n/2+1;
+      while (--n)
+	data[n] = data[n] - offset[n];
+      
+      
+      /*      for(int i=0;i!=bs;++i)
+      {
+	data[i] = data[i] - offset[i];
+      }
+      */
+
+      --counter;
+    }
+
+  CopySamples(out[0],data,bs);
+}
+
+void fftbuf::perform()
+{
+  counter=blknumber();
+  if (counter)
+    {
+      for(int i=0;i!=bs;++i)
+	{
+	  offset[i]=(data[i]-*(buf->Data()+i))/counter; 
+	}
+      
+    }
+  else
+    {
+      CopySamples(data,buf->Data(),bs);
+    }
+}
+
+void fftbuf::set_buf(int argc, t_atom *argv)
+{
+  if(argc == 0)
+    {
+      post("No buffer selected!!!");
+      return;
+    }
+  if (argc == 1 && IsSymbol(argv[0]))
+    {
+      clear(buf);
+      bufname=GetSymbol(argv[0]);
+      
+      buf= new buffer(bufname);
+      
+      if(!buf->Ok())
+	{
+	  post("buffer %s is currently not valid",bufname);
+	}
+    }
+  else if ((argc == 2 && IsSymbol(argv[0]) && 
+	    (IsInt(argv[1]) || IsFloat(argv[1]))))
+    {
+      clear(buf);
+      bufname=GetSymbol(argv[0]);
+      
+      buf= new buffer(bufname);
+      
+      if(!buf->Ok())
+	{
+	  post("buffer %s is currently not valid",bufname);
+	  return;
+	}
+      delay=GetInt(argv[1]);
+    }
+}
+
+template<typename T>
+/*inline*/ void fftbuf::clear(T* buf)
+{
+  if (buf)
+    {
+      delete buf;
+      buf=NULL;
+    }
+}
+
+inline bool fftbuf::check(buffer * buf) 
+{
+//code taken from the flext tutorial (buffer 1) by thomas grill
+
+  if(buf->Update()) 
+    {
+      // buffer parameters have been updated
+      if(buf->Valid()) 
+	{
+	  post("%s (%s) - updated buffer reference",
+	       thisName(),GetString(thisTag()));
+	  return true;
+	}
+      else 
+	{
+	  post("%s (%s) - buffer has become invalid",
+	       thisName(),GetString(thisTag()));
+	  return false;
+	}
+      }
+  else
+    return true;		
+}
+
+void fftbuf::set_line(int argc, t_atom *argv)
+{
+  if(argc==1 && (IsInt(argv[0]) || IsFloat(argv[0])))
+    {
+      delay=GetInt(argv[0]);
+    }
+  else
+    post("syntax incorrect");
+}
+
+inline int fftbuf::blknumber()
+{
+  //  post("%i %i %i",delay,bs,sr);
+  //  post("computer counter: %i",delay*bs/sr*1000);
+  return delay*bs/sr*1000; //ms/sample
+}
diff --git a/tbext/source/fftgrrev.cpp b/tbext/source/fftgrrev.cpp
new file mode 100644
index 0000000..e26135c
--- /dev/null
+++ b/tbext/source/fftgrrev.cpp
@@ -0,0 +1,165 @@
+/* Copyright (c) 2003 Tim Blechmann.                                            */
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL     */
+/* WARRANTIES, see the file, "COPYING"  in this distribution.                   */
+/*                                                                              */
+/*                                                                              */
+/* fftgrshuf divides the incoming fft signal into single grains and reverses    */
+/* the samples in every grain                                                   */
+/*                                                                              */
+/* fftgrrev uses the flext C++ layer for Max/MSP and PD externals.              */
+/* get it at http://www.parasitaere-kapazitaeten.de/PD/ext                      */
+/* thanks to Thomas Grill                                                       */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* 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.                       */
+/*                                                                              */
+/* See file LICENSE for further informations on licensing terms.                */
+/*                                                                              */
+/* 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; if not, write to the Free Software                  */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  */
+/*                                                                              */
+/* Based on PureData by Miller Puckette and others.                             */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* coded while listening to: Howard Skempton/John Tilbury: Well, well, Cornelius*/
+/*                                                                              */
+/*                                                                              */
+
+
+
+#include <flext.h>
+#include <algorithm>
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401)
+#error upgrade your flext version!!!!!!
+#endif
+
+class fftgrrev: public flext_dsp
+{
+  FLEXT_HEADER(fftgrrev,flext_dsp);
+
+public: // constructor
+  fftgrrev(int);
+
+protected:
+  virtual void m_signal (int n, float *const *in, float *const *out);
+  void set_grains(t_int);
+  void set_offset(t_int);
+  void set_reverse();
+  
+private:
+  FLEXT_CALLBACK_1(set_grains,t_int)
+  FLEXT_CALLBACK_1(set_offset,t_int)
+    
+  t_int grains;
+  t_int grainsize;
+  t_int offset;
+  
+  t_int bs; //blocksize
+  t_int bs1; //bs+1
+  t_int counter;
+
+  t_sample * data; //array with data
+  t_sample * d1; //1. element in array with data
+  t_sample * dend; //1 element after the last element
+  
+  t_sample * ins;
+  t_sample * outs;
+
+  bool reverse;
+  
+};
+
+
+FLEXT_LIB_DSP_1("fftgrrev~",fftgrrev,int)
+
+fftgrrev::fftgrrev(int arg):
+  grains(1),offset(0),counter(1)
+{
+  bs=arg/2;
+  grainsize=bs;
+  bs1=bs+1;
+  post("blocksize: %i",bs);
+  
+  data = new t_sample[bs+1];
+  
+  data[0]=0;
+  d1=data+1;
+  dend=data+bs+1;
+  
+  AddInSignal();
+  AddOutSignal();
+  FLEXT_ADDMETHOD_I(0,"grains",set_grains);
+  FLEXT_ADDMETHOD_I(0,"offset",set_offset);
+} 
+
+void fftgrrev::m_signal(int n, t_float * const *in, t_float *const *out)
+{
+  ins = in[0];
+  outs = out[0];
+
+
+  if (offset>0)
+    {
+      CopySamples(d1+bs-offset,ins,offset);
+      CopySamples(d1,ins+offset,bs-offset);
+    }
+  else if (offset<0)
+    {
+      CopySamples(d1-offset,ins,bs+offset);
+      CopySamples(d1,ins+bs+offset,-offset);
+    } 
+  else 
+    CopySamples(data,ins,bs1);
+  
+  
+  //grains
+  
+  counter=1;
+  
+  while (counter!=grains)
+    {
+      std::reverse(d1+grainsize*(counter-1),d1+grainsize*counter);
+      ++counter;
+    }
+  
+  std::reverse(d1+grainsize*(counter-1),dend);
+  
+  CopySamples(outs,data,bs1);
+}
+
+void fftgrrev::set_offset(t_int o)
+{
+  if (o-bs<0 && o+bs>0)
+    {
+      offset=-o;
+      post("offset %i",o);
+    }
+  else
+    post("Offset out of range!");
+}
+
+
+void fftgrrev::set_grains(t_int g)
+{
+  if (  (g > 0) )
+    {
+      grains=g;
+      grainsize=(bs)/grains;
+    }
+}
+
+
+
+
diff --git a/tbext/source/fftgrshuf.cpp b/tbext/source/fftgrshuf.cpp
new file mode 100644
index 0000000..b490dcf
--- /dev/null
+++ b/tbext/source/fftgrshuf.cpp
@@ -0,0 +1,161 @@
+/* Copyright (c) 2003 Tim Blechmann.                                            */
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL     */
+/* WARRANTIES, see the file, "COPYING"  in this distribution.                   */
+/*                                                                              */
+/*                                                                              */
+/* fftgrshuf divides the incoming fft signal into single grains and             */
+/* random_shuffles the samples in every grain                                   */
+/*                                                                              */
+/* fftgrshuf uses the flext C++ layer for Max/MSP and PD externals.             */
+/* get it at http://www.parasitaere-kapazitaeten.de/PD/ext                      */
+/* thanks to Thomas Grill                                                       */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* 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.                       */
+/*                                                                              */
+/* See file LICENSE for further informations on licensing terms.                */
+/*                                                                              */
+/* 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; if not, write to the Free Software                  */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  */
+/*                                                                              */
+/* Based on PureData by Miller Puckette and others.                             */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* coded while listening to: New York Underground Orchestra: The Labyrinth      */
+/*                                                                              */
+/*                                                                              */
+
+
+
+#include <flext.h>
+#include <algorithm>
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401)
+#error upgrade your flext version!!!!!!
+#endif
+
+class fftgrshuf: public flext_dsp
+{
+  FLEXT_HEADER(fftgrshuf,flext_dsp);
+
+public: // constructor
+  fftgrshuf(int);
+
+protected:
+  virtual void m_signal (int n, float *const *in, float *const *out);
+  void set_grains(t_int);
+  void set_offset(t_int);
+  
+private:
+  FLEXT_CALLBACK_1(set_grains,t_int)
+  FLEXT_CALLBACK_1(set_offset,t_int)
+    
+  t_int grains;
+  t_int grainsize;
+  t_int offset;
+  
+  t_int bs; //blocksize
+  t_int bs1; //bs+1
+  t_int counter;
+
+  t_sample * data; //array with data
+  t_sample * d1; //1. element in array with data
+  t_sample * dend; //1 element after the last element
+  
+  t_sample * ins;
+  t_sample * outs;
+
+  
+};
+
+
+FLEXT_LIB_DSP_1("fftgrshuf~",fftgrshuf,int)
+
+fftgrshuf::fftgrshuf(int arg):
+  grains(1),offset(0),counter(1)
+{
+  bs=arg/2;
+  grainsize=bs;
+  bs1=bs+1;
+  post("blocksize: %i",bs);
+  
+  data = new t_sample[bs+1];
+  
+  data[0]=0;
+  d1=data+1;
+  dend=data+bs+1;
+  
+  AddInSignal();
+  AddOutSignal();
+  FLEXT_ADDMETHOD_I(0,"grains",set_grains);
+  FLEXT_ADDMETHOD_I(0,"offset",set_offset);
+} 
+
+void fftgrshuf::m_signal(int n, t_float * const *in, t_float *const *out)
+{
+  ins = in[0];
+  outs = out[0];
+
+
+  if (offset>0)
+    {
+      CopySamples(d1+bs-offset,ins,offset);
+      CopySamples(d1,ins+offset,bs-offset);
+    }
+  else if (offset<0)
+    {
+      CopySamples(d1-offset,ins,bs+offset);
+      CopySamples(d1,ins+bs+offset,-offset);
+    } 
+  else 
+    CopySamples(data,ins,bs1);
+  
+  
+  //grains
+  
+  counter=1;
+  
+  while (counter!=grains) 
+    {
+      std::random_shuffle(d1+grainsize*(counter-1),d1+grainsize*counter);
+      ++counter;
+    }
+  
+  std::random_shuffle(d1+grainsize*(counter-1),dend);
+
+  
+  CopySamples(outs,data,bs1);
+}
+
+void fftgrshuf::set_offset(t_int o)
+{
+  if (o-bs<0 && o+bs>0)
+    {
+      offset=o;
+      post("offset %i",-o);
+    }
+  else
+    post("offset out of range!");
+}
+
+
+void fftgrshuf::set_grains(t_int g)
+{
+  if (  (g > 0) )
+    {
+      grains=g;
+      grainsize=(bs)/grains;
+    }
+}
+
diff --git a/tbext/source/fftgrsort.cpp b/tbext/source/fftgrsort.cpp
new file mode 100644
index 0000000..f24ed0f
--- /dev/null
+++ b/tbext/source/fftgrsort.cpp
@@ -0,0 +1,176 @@
+/* Copyright (c) 2003 Tim Blechmann.                                            */
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL     */
+/* WARRANTIES, see the file, "COPYING"  in this distribution.                   */
+/*                                                                              */
+/*                                                                              */
+/* fftgrsort divides the incoming fft signal into single grains and sorts the   */
+/* samples in every grain                                                       */
+/*                                                                              */
+/* fftgrsort uses the flext C++ layer for Max/MSP and PD externals.             */
+/* get it at http://www.parasitaere-kapazitaeten.de/PD/ext                      */
+/* thanks to Thomas Grill                                                       */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* 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.                       */
+/*                                                                              */
+/* See file LICENSE for further informations on licensing terms.                */
+/*                                                                              */
+/* 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; if not, write to the Free Software                  */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  */
+/*                                                                              */
+/* Based on PureData by Miller Puckette and others.                             */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* coded while listening to:  William Parker: Posium Pendasem                   */
+/*                            Rowe/Lehn/Schmickler: Rabbit Run                  */
+/*                            Derek Bailey: Ballads                             */
+/*                                                                              */
+
+
+
+#include <flext.h>
+#include <algorithm>
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401)
+#error upgrade your flext version!!!!!!
+#endif
+
+class fftgrsort: public flext_dsp
+{
+  FLEXT_HEADER(fftgrsort,flext_dsp);
+
+public: // constructor
+  fftgrsort(int);
+
+protected:
+  virtual void m_signal (int n, float *const *in, float *const *out);
+  void set_grains(t_int);
+  void set_offset(t_int);
+  void set_reverse();
+  
+private:
+  FLEXT_CALLBACK_1(set_grains,t_int)
+  FLEXT_CALLBACK_1(set_offset,t_int)
+  FLEXT_CALLBACK(set_reverse)
+    
+  t_int grains;
+  t_int grainsize;
+  t_int offset;
+  
+  t_int bs; //blocksize
+  t_int bs1; //bs+1
+  t_int counter;
+
+  t_sample * data; //array with data
+  t_sample * d1; //1. element in array with data
+  t_sample * dend; //1 element after the last element
+  
+  t_sample * ins;
+  t_sample * outs;
+
+  bool reverse;
+  
+};
+
+
+FLEXT_LIB_DSP_1("fftgrsort~",fftgrsort,int)
+
+fftgrsort::fftgrsort(int arg):
+  grains(1),offset(0),counter(1),reverse(0)
+{
+  bs=arg/2;
+  grainsize=bs;
+  bs1=bs+1;
+  post("blocksize: %i",bs);
+  
+  data = new t_sample[bs+1];
+  
+  data[0]=0;
+  d1=data+1;
+  dend=data+bs+1;
+  
+  AddInSignal();
+  AddOutSignal();
+  FLEXT_ADDMETHOD_I(0,"grains",set_grains);
+  FLEXT_ADDMETHOD_I(0,"offset",set_offset);
+  FLEXT_ADDMETHOD_(0,"reverse",set_reverse);
+} 
+
+void fftgrsort::m_signal(int n, t_float * const *in, t_float *const *out)
+{
+  ins = in[0];
+  outs = out[0];
+
+
+  if (offset>0)
+    {
+      CopySamples(d1+bs-offset,ins,offset);
+      CopySamples(d1,ins+offset,bs-offset);
+    }
+  else if (offset<0)
+    {
+      CopySamples(d1-offset,ins,bs+offset);
+      CopySamples(d1,ins+bs+offset,-offset);
+    } 
+  else 
+    CopySamples(data,ins,bs1);
+  
+  
+  //grains
+  
+  counter=1;
+  
+  while (counter!=grains) 
+    {
+      std::sort(d1+grainsize*(counter-1),d1+grainsize*counter);
+      if (reverse)
+	std::reverse(d1+grainsize*(counter-1),d1+grainsize*counter);
+      ++counter;
+    }
+  
+  std::sort(d1+grainsize*(counter-1),dend);
+  if (reverse)
+    std::reverse(d1+grainsize*(counter-1),dend);
+
+  
+  CopySamples(outs,data,bs1);
+}
+
+void fftgrsort::set_offset(t_int o)
+{
+  if (o-bs<0 && o+bs>0)
+    {
+      offset=-o;
+      post("offset %i",o);
+    }
+  else
+    post("offset out of range!");
+}
+
+
+void fftgrsort::set_grains(t_int g)
+{
+  if (  (g > 0) )
+    {
+      grains=g;
+      grainsize=(bs)/grains;
+    }
+}
+
+void fftgrsort::set_reverse()
+{
+  reverse=!reverse;
+}
+
+
diff --git a/tbext/source/main.cpp b/tbext/source/main.cpp
index bd6d833..4b204f6 100644
--- a/tbext/source/main.cpp
+++ b/tbext/source/main.cpp
@@ -56,6 +56,7 @@ void ttbext_setup()
   FLEXT_SETUP(tbroute);
   //FLEXT_SETUP(tbstrg);
   FLEXT_DSP_SETUP(tbsroute);
+  FLEXT_DSP_SETUP(tbssel);
   FLEXT_DSP_SETUP(tbsig);
   FLEXT_DSP_SETUP(tbpow);
   //  FLEXT_DSP_SETUP(tbg7xx);
diff --git a/tbext/source/tbfft2.cpp b/tbext/source/tbfft2.cpp
new file mode 100644
index 0000000..6ed71d9
--- /dev/null
+++ b/tbext/source/tbfft2.cpp
@@ -0,0 +1,147 @@
+/* Copyright (c) 2003 Tim Blechmann.                                            */
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL     */
+/* WARRANTIES, see the file, "COPYING"  in this distribution.                   */
+/*                                                                              */
+/*                                                                              */
+/* tbfft2~ transforms the fft spectrum. it reverses the order of the samples in */
+/* the fft spectrum. see the help file for further instruction...               */
+/*                                                                              */
+/*                                                                              */
+/* tbfft2~ uses the flext C++ layer for Max/MSP and PD externals.               */
+/* get it at http://www.parasitaere-kapazitaeten.de/PD/ext                      */
+/* thanks to Thomas Grill                                                       */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* 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.                       */
+/*                                                                              */
+/* See file LICENSE for further informations on licensing terms.                */
+/*                                                                              */
+/* 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; if not, write to the Free Software                  */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  */
+/*                                                                              */
+/* Based on PureData by Miller Puckette and others.                             */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* coded while listening to: Naked City: Heretic, Jeux Des Dames Cruelles       */
+/*                           Bob Ostertag: Attention Span                       */
+/*                                                                              */
+/*                                                                              */
+
+
+
+#include <flext.h>
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401)
+#error upgrade your flext version!!!!!!
+#endif
+
+
+class tbfft2: public flext_dsp
+{
+  FLEXT_HEADER(tbfft2,flext_dsp);
+
+public: // constructor
+  tbfft2();
+
+protected:
+  virtual void m_signal (int n, float *const *in, float *const *out);
+  void set_freq(t_float);
+  void set_width(t_float);
+
+private:
+  FLEXT_CALLBACK_1(set_freq,t_float)
+  FLEXT_CALLBACK_1(set_width,t_float)
+  
+  t_int center;
+  t_int width;
+  
+  t_float pos;
+  t_int posi;
+
+  float *ins;
+  float *outs;
+  float *tmps;
+  t_float tmp[2049];
+  
+  t_float s;
+  t_float b;
+  
+  t_int n0;
+};
+
+
+FLEXT_LIB_DSP("tbfft2~",tbfft2)
+
+tbfft2::tbfft2()
+{
+  AddInSignal();
+  AddOutSignal();
+  FLEXT_ADDMETHOD_F(0,"center",set_freq);
+  FLEXT_ADDMETHOD_F(0,"width",set_width);
+} 
+
+
+void tbfft2::m_signal(int n, t_float *const *in, t_float *const *out)
+{
+  ins = in[0];
+  outs = out[0];
+
+  CopySamples(tmp,ins,n);
+  
+  n0=n/2;  
+
+  if (center-width>0)
+    {
+      n=center-width;
+    }
+  else
+    n=0;
+  
+  while (n<center+width)
+    {
+      tmp[n]=*(ins+2*center-n);
+      ++n;
+    }
+  
+
+
+  //memcp
+  CopySamples(outs,tmp,n0*2);
+  
+}
+
+void tbfft2::set_freq(t_float freq)
+{
+  center=freq;
+  set_width(width);
+}
+
+void tbfft2::set_width(t_float w)
+{
+
+  if (w+center>n0)
+    {
+      width=n0-center;
+      return;
+    }
+  if (center-w<0)
+    {
+      width=center;
+      return;
+    }
+
+  width=w;
+}
+
+
-- 
cgit v1.2.1


From 80e47e2a02fc3cb39baeea8db56ef362b86c6e04 Mon Sep 17 00:00:00 2001
From: Tim Blechmann <timblech@users.sourceforge.net>
Date: Sat, 20 Sep 2003 15:37:44 +0000
Subject: *** empty log message ***

svn path=/trunk/externals/tb/; revision=1013
---
 tbext/source/main.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'tbext/source')

diff --git a/tbext/source/main.cpp b/tbext/source/main.cpp
index 4b204f6..dd007df 100644
--- a/tbext/source/main.cpp
+++ b/tbext/source/main.cpp
@@ -56,7 +56,7 @@ void ttbext_setup()
   FLEXT_SETUP(tbroute);
   //FLEXT_SETUP(tbstrg);
   FLEXT_DSP_SETUP(tbsroute);
-  FLEXT_DSP_SETUP(tbssel);
+  //  FLEXT_DSP_SETUP(tbssel);
   FLEXT_DSP_SETUP(tbsig);
   FLEXT_DSP_SETUP(tbpow);
   //  FLEXT_DSP_SETUP(tbg7xx);
-- 
cgit v1.2.1


From 4ab9c44294867638df5c092bb2a9de1923a63dd2 Mon Sep 17 00:00:00 2001
From: Tim Blechmann <timblech@users.sourceforge.net>
Date: Sat, 20 Sep 2003 15:54:40 +0000
Subject: *** empty log message ***

svn path=/trunk/externals/tb/; revision=1014
---
 tbext/source/tbssel~.cpp | 100 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 100 insertions(+)
 create mode 100644 tbext/source/tbssel~.cpp

(limited to 'tbext/source')

diff --git a/tbext/source/tbssel~.cpp b/tbext/source/tbssel~.cpp
new file mode 100644
index 0000000..f9111aa
--- /dev/null
+++ b/tbext/source/tbssel~.cpp
@@ -0,0 +1,100 @@
+/* Copyright (c) 2003 Tim Blechmann.                                            */
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL     */
+/* WARRANTIES, see the file, "COPYING"  in this distribution.                   */
+/*                                                                              */
+/*                                                                              */
+/* tbssel~ selects one signal from the incoming signals                         */
+/* the number of inlets is specified by the creation argument                   */
+/*                                                                              */
+/*                                                                              */
+/* tbssel~ uses the flext C++ layer for Max/MSP and PD externals.               */
+/* get it at http://www.parasitaere-kapazitaeten.de/PD/ext                      */
+/* thanks to Thomas Grill                                                       */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* 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.                       */
+/*                                                                              */
+/* See file LICENSE for further informations on licensing terms.                */
+/*                                                                              */
+/* 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; if not, write to the Free Software                  */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  */
+/*                                                                              */
+/* Based on PureData by Miller Puckette and others.                             */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* coded while listening to: AMM: AMMMUSIC 1966                                 */
+/*                           Sun Ra: Dancing Shadows                            */
+/*                                                                              */
+
+
+#include <flext.h>
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401)
+#error upgrade your flext version!!!!!!
+#endif
+
+class tbssel: public flext_dsp
+{
+  FLEXT_HEADER(tbssel,flext_dsp)
+
+public: // constructor
+  tbssel(t_int chan);
+
+protected:
+  virtual void m_signal (int n, float *const *in, float *const *out);
+  void set_source(int i);
+
+private:
+  FLEXT_CALLBACK_1(set_source,int)
+  t_int source;
+};
+
+
+FLEXT_LIB_DSP_1("tbroute~",tbssel,int);
+
+tbssel::tbssel (t_int chan):
+  source(0)
+{
+  for (t_int i=0; i!=chan;++i)
+    {    
+      AddInSignal();
+    }
+  
+  AddOutSignal();
+  
+  FLEXT_ADDMETHOD(1,set_source);
+} 
+
+
+void tbssel::m_signal(int n, float *const *in, float *const *out)
+{
+
+  CopySamples(out[0],in[source],n);
+  
+
+}
+
+void tbssel::set_source(int i)
+{
+  if ((i>-1) && (i<CntInSig()))
+    {  
+      source=i;
+      post("selecting inlet %i",i);
+    }
+  else
+    {
+      post("no such inlet");
+    }
+  
+}
-- 
cgit v1.2.1


From ce8d118561bd86df80eae140f2e0a64db55998e3 Mon Sep 17 00:00:00 2001
From: Tim Blechmann <timblech@users.sourceforge.net>
Date: Wed, 28 Jan 2004 11:09:13 +0000
Subject: *** empty log message ***

svn path=/trunk/externals/tb/; revision=1298
---
 tbext/source/fftbuf.cpp | 38 +++++++++++++++++++++++++-------------
 tbext/source/main.cpp   |  5 +++--
 tbext/source/tbfft2.cpp |  2 +-
 3 files changed, 29 insertions(+), 16 deletions(-)

(limited to 'tbext/source')

diff --git a/tbext/source/fftbuf.cpp b/tbext/source/fftbuf.cpp
index eff81e3..13f0b9e 100644
--- a/tbext/source/fftbuf.cpp
+++ b/tbext/source/fftbuf.cpp
@@ -121,27 +121,36 @@ fftbuf::~fftbuf()
 
 void fftbuf::m_signal(int n, t_float *const *in, t_float *const *out)
 {
-  outs = out[0];
-  
-  if (counter!=0)
+  if (check(buf))
     {
-      n=n/2+1;
+      outs = out[0];
+      
+      if (counter!=0)
+	{
+	  n=n/2+1;
       while (--n)
 	data[n] = data[n] - offset[n];
       
       
       /*      for(int i=0;i!=bs;++i)
-      {
+	      {
 	data[i] = data[i] - offset[i];
-      }
+	}
       */
-
+      
       --counter;
+	}
+      
+      CopySamples(out[0],data,bs);
     }
-
-  CopySamples(out[0],data,bs);
+  else
+    CopySamples(out[0],data,bs);
+  
 }
 
+//perform und dsp gleichzeitig?!?
+
+
 void fftbuf::perform()
 {
   counter=blknumber();
@@ -196,7 +205,7 @@ void fftbuf::set_buf(int argc, t_atom *argv)
 }
 
 template<typename T>
-/*inline*/ void fftbuf::clear(T* buf)
+inline void fftbuf::clear(T* buf)
 {
   if (buf)
     {
@@ -207,6 +216,8 @@ template<typename T>
 
 inline bool fftbuf::check(buffer * buf) 
 {
+  if (buf==NULL)
+    return false;
 //code taken from the flext tutorial (buffer 1) by thomas grill
 
   if(buf->Update()) 
@@ -241,7 +252,8 @@ void fftbuf::set_line(int argc, t_atom *argv)
 
 inline int fftbuf::blknumber()
 {
-  //  post("%i %i %i",delay,bs,sr);
-  //  post("computer counter: %i",delay*bs/sr*1000);
-  return delay*bs/sr*1000; //ms/sample
+  post("%i %i %i",delay,bs,sr);
+  post("blknumber: %i",delay*bs/sr);
+
+  return delay*bs/sr; //ms/sample
 }
diff --git a/tbext/source/main.cpp b/tbext/source/main.cpp
index dd007df..5a3bb14 100644
--- a/tbext/source/main.cpp
+++ b/tbext/source/main.cpp
@@ -51,10 +51,10 @@ void ttbext_setup()
   post("TBEXT: by tim blechmann");
   post("version "TBEXT_VERSION);
   post("compiled on "__DATE__);
-  post("");
+  post("contains: tbroute(~), tbsig~, tbpow~, tbfft1~, tbfft2~, bufline~, fftgrrev~");
+  post("          fftgrsort~, fftgrshuf~");
 
   FLEXT_SETUP(tbroute);
-  //FLEXT_SETUP(tbstrg);
   FLEXT_DSP_SETUP(tbsroute);
   //  FLEXT_DSP_SETUP(tbssel);
   FLEXT_DSP_SETUP(tbsig);
@@ -66,6 +66,7 @@ void ttbext_setup()
   FLEXT_DSP_SETUP(fftgrsort);
   FLEXT_DSP_SETUP(fftgrshuf);
   FLEXT_DSP_SETUP(fftgrrev);
+  FLEXT_DSP_SETUP(spigot_tilde);
 }
 
 FLEXT_LIB_SETUP(tbext,ttbext_setup)
diff --git a/tbext/source/tbfft2.cpp b/tbext/source/tbfft2.cpp
index 6ed71d9..99d16fe 100644
--- a/tbext/source/tbfft2.cpp
+++ b/tbext/source/tbfft2.cpp
@@ -72,7 +72,7 @@ private:
   float *ins;
   float *outs;
   float *tmps;
-  t_float tmp[2049];
+  t_float tmp[17000];
   
   t_float s;
   t_float b;
-- 
cgit v1.2.1


From b37d7f4d59d1ec038f6920e7a44436558d84befe Mon Sep 17 00:00:00 2001
From: Tim Blechmann <timblech@users.sourceforge.net>
Date: Sun, 29 Feb 2004 13:57:19 +0000
Subject: *** empty log message ***

svn path=/trunk/externals/tb/; revision=1364
---
 tbext/source/main.cpp    |  15 +++--
 tbext/source/rfftw~.cpp  | 138 ++++++++++++++++++++++++++++++++++++++++
 tbext/source/rifftw~.cpp | 161 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 310 insertions(+), 4 deletions(-)
 create mode 100644 tbext/source/rfftw~.cpp
 create mode 100644 tbext/source/rifftw~.cpp

(limited to 'tbext/source')

diff --git a/tbext/source/main.cpp b/tbext/source/main.cpp
index 5a3bb14..07a0713 100644
--- a/tbext/source/main.cpp
+++ b/tbext/source/main.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2003 Tim Blechmann.                                            */
+/* Copyright (c) 2003-2004 Tim Blechmann.                                       */
 /* For information on usage and redistribution, and for a DISCLAIMER OF ALL     */
 /* WARRANTIES, see the file, "COPYING"  in this distribution.                   */
 /*                                                                              */
@@ -40,7 +40,7 @@
 
 
 #include <flext.h>
-#define TBEXT_VERSION "0.03"
+#define TBEXT_VERSION "0.04"
 
 #if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 400)
 #error upgrade your flext version!!!!!!
@@ -52,7 +52,7 @@ void ttbext_setup()
   post("version "TBEXT_VERSION);
   post("compiled on "__DATE__);
   post("contains: tbroute(~), tbsig~, tbpow~, tbfft1~, tbfft2~, bufline~, fftgrrev~");
-  post("          fftgrsort~, fftgrshuf~");
+  post("          fftgrsort~, fftgrshuf~, rfftw~, rifftw~");
 
   FLEXT_SETUP(tbroute);
   FLEXT_DSP_SETUP(tbsroute);
@@ -66,7 +66,14 @@ void ttbext_setup()
   FLEXT_DSP_SETUP(fftgrsort);
   FLEXT_DSP_SETUP(fftgrshuf);
   FLEXT_DSP_SETUP(fftgrrev);
-  FLEXT_DSP_SETUP(spigot_tilde);
+
+
+#if (FFTW == 1)
+  FLEXT_DSP_SETUP(rfftw);
+  FLEXT_DSP_SETUP(rifftw);
+#endif
+
+
 }
 
 FLEXT_LIB_SETUP(tbext,ttbext_setup)
diff --git a/tbext/source/rfftw~.cpp b/tbext/source/rfftw~.cpp
new file mode 100644
index 0000000..dd10517
--- /dev/null
+++ b/tbext/source/rfftw~.cpp
@@ -0,0 +1,138 @@
+/* Copyright (c) 2004 Tim Blechmann.                                            */
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL     */
+/* WARRANTIES, see the file, "COPYING"  in this distribution.                   */
+/*                                                                              */
+/*                                                                              */
+/* rfftw~ is doing the same as rfft~, but it's based on the fftw library,       */
+/* that is much faster that pd's internal fft ...                               */
+/*                                                                              */
+/*                                                                              */
+/* rfftw~ uses the flext C++ layer for Max/MSP and PD externals.                */
+/* get it at http://www.parasitaere-kapazitaeten.de/PD/ext                      */
+/* thanks to Thomas Grill                                                       */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* 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.                       */
+/*                                                                              */
+/* See file LICENSE for further informations on licensing terms.                */
+/*                                                                              */
+/* 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; if not, write to the Free Software                  */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  */
+/*                                                                              */
+/* Based on PureData by Miller Puckette and others.                             */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* coded while listening to: Wolfgang Mitterer: Radiofractal & Beat Music       */
+/*                           Sun Ra: Reflections In Blue                        */
+/*                                                                              */
+/*                                                                              */
+
+
+
+#include <flext.h>
+
+#include "fftw3.h"
+#include <algorithm>
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401)
+#error upgrade your flext version!!!!!!
+#endif
+
+class rfftw: public flext_dsp
+{
+  FLEXT_HEADER(rfftw,flext_dsp);
+
+public: // constructor
+  rfftw();
+  ~rfftw();
+
+protected:
+  virtual void m_signal (int n, float *const *in, float *const *out);
+  
+  fftwf_plan p;    //fftw plan
+  int bins;        //number of bins
+  float * outreal; //pointer to real output
+  float * outimag; //pointer to imaginary output
+  
+  float * infft;   //array fftw is working on
+  float * outfft;  //array fftw uses to output it's values
+  
+
+ private:
+};
+
+
+FLEXT_LIB_DSP("rfftw~",rfftw);
+
+rfftw::rfftw()
+  :bins(64)
+{
+  //get ready for the default blocksize
+  infft = fftwf_malloc(sizeof(float) * bins);
+  outfft = fftwf_malloc(sizeof(float) * bins);
+  p=fftwf_plan_r2r_1d(bins,infft,outfft,FFTW_FORWARD,FFTW_MEASURE);
+  
+  AddInSignal();
+  AddOutSignal();
+  AddOutSignal();
+} 
+
+rfftw::~rfftw()
+{
+  fftwf_free(infft);
+  fftwf_free(outfft);
+  fftwf_destroy_plan(p);
+} 
+
+
+void rfftw::m_signal(int n, float *const *in, float *const *out)
+{
+  //set output pointers
+  outreal = out[0];
+  outimag = out[1];
+
+  //if blocksize changed, we have to set a new plan for the fft
+  if (n!=bins)
+    {
+      bins=n;
+
+      //re-allocate fft buffers
+      fftwf_free(infft);
+      infft = fftwf_malloc(sizeof(float) * bins);
+      fftwf_free(outfft);
+      outfft = fftwf_malloc(sizeof(float) * bins);
+      
+      //set plan, this might take a few seconds
+      //but you don't have to do that on the fly...
+      fftwf_destroy_plan(p);
+      p=fftwf_plan_r2r_1d(bins,infft,outfft,FFTW_FORWARD,FFTW_MEASURE);
+  }
+
+  CopySamples(infft,in[0],n);
+  
+  //execute
+  fftwf_execute(p);
+
+  //Copy samples to outlets
+  CopySamples(outreal,outfft,n/2);
+  std::reverse_copy(outfft+n/2+1,outfft+n,outimag+1);
+
+  //why do we have to invert the samples???
+  for (int i = n/2+1; i!=0;--i)
+    {
+      *(outimag+i)=-*(outimag+i);
+    }
+
+}
+
diff --git a/tbext/source/rifftw~.cpp b/tbext/source/rifftw~.cpp
new file mode 100644
index 0000000..ee6f126
--- /dev/null
+++ b/tbext/source/rifftw~.cpp
@@ -0,0 +1,161 @@
+/* Copyright (c) 2004 Tim Blechmann.                                            */
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL     */
+/* WARRANTIES, see the file, "COPYING"  in this distribution.                   */
+/*                                                                              */
+/*                                                                              */
+/* rifftw~ is doing the same as rifft~, but it's based on the fftw library,     */
+/* that is much faster that pd's internal fft ...                               */
+/*                                                                              */
+/*                                                                              */
+/* rifftw~ uses the flext C++ layer for Max/MSP and PD externals.               */
+/* get it at http://www.parasitaere-kapazitaeten.de/PD/ext                      */
+/* thanks to Thomas Grill                                                       */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* 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.                       */
+/*                                                                              */
+/* See file LICENSE for further informations on licensing terms.                */
+/*                                                                              */
+/* 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; if not, write to the Free Software                  */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  */
+/*                                                                              */
+/* Based on PureData by Miller Puckette and others.                             */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* coded while listening to: Caged/Uncaged                                      */
+/*                           Sunny Murray: Hommage To Africa                    */
+/*                                                                              */
+/*                                                                              */
+
+
+
+#include <flext.h>
+
+#include "fftw3.h"
+#include <algorithm>
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401)
+#error upgrade your flext version!!!!!!
+#endif
+
+class rifftw: public flext_dsp
+{
+  FLEXT_HEADER(rifftw,flext_dsp);
+
+public: // constructor
+  rifftw();
+  ~rifftw();
+
+protected:
+  virtual void m_signal (int n, float *const *in, float *const *out);
+  
+  fftwf_plan p;    //fftw plan
+  int bins;        //number of bins
+  float * inreal; //pointer to real input
+  float * inimag; //pointer to imaginary input
+  
+  fftwf_complex * incomplex;
+
+  //float * infft;   //array fftw is working on
+  float * outfft;  //array fftw uses to output it's values
+  
+
+ private:
+};
+
+
+FLEXT_LIB_DSP("rifftw~",rifftw);
+
+rifftw::rifftw()
+  :bins(64)
+{
+  //get ready for the default blocksize
+  //  infft = fftwf_malloc(sizeof(float) * bins);
+  outfft = fftwf_malloc(sizeof(float) * bins);
+
+
+  incomplex = fftwf_malloc(sizeof(fftwf_complex) * bins);
+
+
+  //  p=fftwf_plan_r2r_1d(bins,infft,outfft,FFTW_BACKWARD,FFTW_MEASURE);
+  p=fftwf_plan_dft_c2r_1d(bins,incomplex,outfft,FFTW_BACKWARD,FFTW_MEASURE);
+  
+  AddInSignal();
+  AddInSignal();
+  AddOutSignal();
+} 
+
+rifftw::~rifftw()
+{
+  //  fftwf_free(infft);
+  fftwf_free(outfft);
+  fftwf_free(incomplex);
+  fftwf_destroy_plan(p);
+} 
+
+
+void rifftw::m_signal(int n, float *const *in, float *const *out)
+{
+  //set output pointers
+  inreal = in[0];
+  inimag = in[1];
+
+  //if blocksize changed, we have to set a new plan for the fft
+  if (n!=bins)
+    {
+      bins=n;
+
+      //re-allocate fft buffers
+      //      fftwf_free(infft);
+      //      infft = fftwf_malloc(sizeof(float) * bins);
+      fftwf_free(outfft);
+      outfft = fftwf_malloc(sizeof(float) * bins);
+
+      fftwf_free(incomplex);
+      incomplex = fftwf_malloc(sizeof(fftwf_complex) * bins);
+      
+      //set plan, this might take a few seconds
+      //but you don't have to do that on the fly...
+      fftwf_destroy_plan(p);
+      //p=fftwf_plan_r2r_1d(bins,infft,outfft,FFTW_BACKWARD,FFTW_MEASURE);
+      p=fftwf_plan_dft_c2r_1d(bins,incomplex,outfft,FFTW_BACKWARD,FFTW_MEASURE);
+
+  }
+
+  //Copy samples to the fft
+  //  CopySamples(infft,inreal,n/2);
+  //  std::reverse_copy(inimag,inimag+n/2,infft+n/2);
+  
+  
+  /*
+  //why do we have to invert the samples???
+    for (int i = n/2+1; i!=n;++i)
+    {
+      *(infft+i)=-*(infft+i);
+    }
+  */
+
+  for (int i=0;i!=n/2;++i)
+    {
+      incomplex[i][0]=inreal[i];
+      incomplex[i][1]=-inimag[i];
+    }
+
+  //execute
+  fftwf_execute(p);
+
+  CopySamples(out[0],outfft,n);
+
+}
+
-- 
cgit v1.2.1


From fc4811ceddd4d2138d01e78b1c002a1582f9ee69 Mon Sep 17 00:00:00 2001
From: Tim Blechmann <timblech@users.sourceforge.net>
Date: Tue, 30 Mar 2004 18:49:02 +0000
Subject: added him~ object

svn path=/trunk/externals/tb/; revision=1525
---
 tbext/source/him.cpp  | 389 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tbext/source/main.cpp |  11 +-
 2 files changed, 392 insertions(+), 8 deletions(-)
 create mode 100644 tbext/source/him.cpp

(limited to 'tbext/source')

diff --git a/tbext/source/him.cpp b/tbext/source/him.cpp
new file mode 100644
index 0000000..5d1c029
--- /dev/null
+++ b/tbext/source/him.cpp
@@ -0,0 +1,389 @@
+/* Copyright (c) 2004 Tim Blechmann.                                            */
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL     */
+/* WARRANTIES, see the file, "COPYING"  in this distribution.                   */
+/*                                                                              */
+/*                                                                              */
+/* him~ is a semi-classicical simulation of an hydrogen atom in a magnetic field*/
+/*                                                                              */
+/* him~ uses the flext C++ layer for Max/MSP and PD externals.                  */
+/* get it at http://www.parasitaere-kapazitaeten.de/PD/ext                      */
+/* thanks to Thomas Grill                                                       */
+/*                                                                              */
+/* him~ is based on code provided in the lecture "physik auf dem computer 1"    */
+/* held by joerg main during the winter semester 2003/04 at the university      */
+/* stuttgart ... many thanks to him and his assistant ralf habel                */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* 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.                       */
+/*                                                                              */
+/* See file LICENSE for further informations on licensing terms.                */
+/*                                                                              */
+/* 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; if not, write to the Free Software                  */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  */
+/*                                                                              */
+/* Based on PureData by Miller Puckette and others.                             */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* coded while listening to: Elliott Sharp: The Velocity Of Hue                 */
+/*                           Fred Frith: Traffic Continues                      */
+/*                           Nmperign: Twisted Village                          */
+/*                           Frank Lowe: Black Beings                           */
+/*                                                                              */
+
+
+
+#include <flext.h>
+#include <cstdlib>
+#include <cmath>
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401)
+#error upgrade your flext version!!!!!!
+#endif
+
+#define NUMB_EQ 4
+
+class him: public flext_dsp
+{
+  FLEXT_HEADER(him,flext_dsp);
+
+public: 
+    him(int argc, t_atom *argv);
+
+protected:
+    virtual void m_signal (int n, float *const *in, float *const *out);
+    t_float *outs;
+    
+    void set_mu(t_float);
+    void set_muv(t_float);
+    void set_nu(t_float);
+    void set_nuv(t_float);
+    void set_etilde(t_float);
+    void set_dt(t_float);
+    void set_regtime(bool);
+    void set_output(t_int);
+    void state();
+    void reset();
+
+private:
+    // contains DGL-System
+    t_float deriv(t_float x[],int eq);
+    t_float result;
+
+    // 4th order Runge Kutta update of the dynamical variables 
+    void   runge_kutta_4(t_float dt);
+    int i;
+    t_float k1[NUMB_EQ],k2[NUMB_EQ],k3[NUMB_EQ],k4[NUMB_EQ];
+    t_float temp1[NUMB_EQ], temp2[NUMB_EQ], temp3[NUMB_EQ];
+
+    //these are our data
+    t_float data[4]; //mu, muv, nu, nuv (semi-parabolische koordinaten)
+    t_float E;
+
+    //and these our settings
+    t_float dt;
+    t_int output;   //mu, muv, nu, nuv, x, y 
+    bool regtime; //if true "regularisierte zeit"
+
+    //Callbacks
+    FLEXT_CALLBACK_1(set_mu,t_float);
+    FLEXT_CALLBACK_1(set_muv,t_float);
+    FLEXT_CALLBACK_1(set_nu,t_float);
+    FLEXT_CALLBACK_1(set_nuv,t_float);
+    FLEXT_CALLBACK_1(set_etilde,t_float);
+    FLEXT_CALLBACK_1(set_dt,t_float);
+    FLEXT_CALLBACK_1(set_regtime,bool);
+    FLEXT_CALLBACK_1(set_output,t_int);
+    FLEXT_CALLBACK(state);
+    FLEXT_CALLBACK(reset);
+
+    //reset mus / nus 
+    void reset_nuv()
+    {
+	data[3]= 0.5*sqrt( - (4*data[1]*data[1]) - 
+			   ( data[0]*data[0]*data[1]*data[1]*data[1]*data[1])
+			   + (8*E*data[0]) - (8*E*data[2]) - 
+			   (data[0]*data[0]*data[0]*data[0]*data[1]*data[1])
+			   + 16);
+    }
+
+    void reset_muv()
+    {
+	data[1]= 0.5*sqrt( - (4*data[3]*data[3]) - 
+			   ( data[0]*data[0]*data[1]*data[1]*data[1]*data[1])
+			   + (8*E*data[0]) - (8*E*data[2]) - 
+			   (data[0]*data[0]*data[0]*data[0]*data[1]*data[1])
+			   + 16);
+    }
+    
+};
+
+
+FLEXT_LIB_DSP_V("him~",him)
+
+him::him(int argc, t_atom *argv)
+{
+    AddInAnything();
+    AddOutSignal();
+    FLEXT_ADDMETHOD_F(0,"mu",set_mu);
+    FLEXT_ADDMETHOD_F(0,"muv",set_muv);
+    FLEXT_ADDMETHOD_F(0,"nu",set_nu);
+    FLEXT_ADDMETHOD_F(0,"nuv",set_nuv);
+    FLEXT_ADDMETHOD_F(0,"e",set_etilde);
+    FLEXT_ADDMETHOD_F(0,"dt",set_dt);
+    FLEXT_ADDMETHOD_B(0,"regtime",set_regtime);
+    FLEXT_ADDMETHOD_I(0,"output",set_output);
+    FLEXT_ADDMETHOD_(0,"state",state);
+    FLEXT_ADDMETHOD_(0,"reset",reset);
+    
+    
+    //beginning values
+    if (argc==1)
+	E=atom_getfloat(argv);
+    else
+	E= -float(rand())/float(RAND_MAX);
+    
+    reset();
+
+    state();
+
+    //default mode
+    regtime=true;
+    output=0;
+    dt=0.01;
+} 
+
+t_float him::deriv(t_float x[], int eq)
+{
+  // set DGL-System here
+    if (eq == 0) result =  x[1];
+    if (eq == 1) result = 2*E*x[0]-0.25*x[0]*x[2]*x[2]*(2*x[0]*x[0]+x[2]*x[2]);
+    if (eq == 2) result =  x[3];
+    if (eq == 3) result = 2*E*x[2]-0.25*x[2]*x[0]*x[0]*(2*x[2]*x[2]+x[0]*x[0]);
+
+  return result;
+}
+
+void him::runge_kutta_4(t_float dt)                          
+{
+    for(i=0;i<=NUMB_EQ-1;i++) // iterate over equations 
+	{
+	    k1[i] = dt * deriv(data,i);
+	    temp1[i] = data[i] + 0.5*k1[i];	    	    
+	}
+    
+    for(i=0;i<=NUMB_EQ-1;i++)
+	{
+	    k2[i] = dt * deriv(temp1,i);
+	    temp2[i] = data[i] + 0.5*k2[i];
+        }
+    
+    for(i=0;i<=NUMB_EQ-1;i++)
+	{
+	    k3[i] = dt * deriv(temp2,i);
+	    temp3[i] = data[i] + k3[i];    
+	}
+    
+    for(i=0;i<=NUMB_EQ-1;i++)
+	{
+	    k4[i] = dt * deriv(temp3,i);
+	    data[i] = data[i] + (k1[i] + (2.*(k2[i]+k3[i])) + k4[i])/6.;
+        }
+    
+    reset_muv;
+    
+}
+
+
+
+void him::m_signal(int n, t_float *const *in, t_float *const *out)
+{
+    outs = out[0];
+    
+    if (regtime)
+	{
+	    switch (output)
+		{
+		case 0:
+		    for (int j=0;j!=n;++j)
+			{
+			runge_kutta_4(dt);
+			*(outs+j)=data[0];
+			}
+		    break;
+		    
+		case 1:
+		    for (int j=0;j!=n;++j)
+			{
+			    runge_kutta_4(dt);
+			    *(outs+j)=data[1];
+			}
+		    break;
+		    
+		case 2:
+		    for (int j=0;j!=n;++j)
+			{
+			runge_kutta_4(dt);
+			*(outs+j)=data[2];
+			}
+		    break;
+		
+		case 3:
+		    for (int j=0;j!=n;++j)
+			{
+			    runge_kutta_4(dt);
+			    *(outs+j)=data[3];
+			}
+		    break;
+		    
+		case 4:
+		    for (int j=0;j!=n;++j)
+			{
+			    runge_kutta_4(dt);
+			    *(outs+j)=data[0]*data[2];
+			}
+		    break;
+		    
+		case 5:
+		    for (int j=0;j!=n;++j)
+			{
+			    runge_kutta_4(dt);
+			    *(outs+j)=(data[0]*data[0]-data[2]*data[2])*0.5;
+			}
+		    break;
+		}
+	}
+    else
+	{
+	    switch (output)
+		{	    
+		case 0:
+		    for (int j=0;j!=n;++j)
+			{
+			    runge_kutta_4(dt/
+					  (2*sqrt(data[0]*data[0]+data[2]*data[2])));
+			    *(outs+j)=data[0];
+			}
+		    break;
+		    
+		case 1:
+		    for (int j=0;j!=n;++j)
+			{
+			    runge_kutta_4(dt/
+					  (2*sqrt(data[0]*data[0]+data[2]*data[2])));
+			    *(outs+j)=data[1];
+			}
+		    break;
+		    
+		case 2:
+		    for (int j=0;j!=n;++j)
+		    {
+			runge_kutta_4(dt/
+				      (2*sqrt(data[0]*data[0]+data[2]*data[2])));
+			*(outs+j)=data[2];
+		    }
+		    break;
+		    
+		case 3:
+		    for (int j=0;j!=n;++j)
+		    {
+			runge_kutta_4(dt/
+				      (2*sqrt(data[0]*data[0]+data[2]*data[2])));
+			*(outs+j)=data[3];
+		    }
+		    break;
+		    
+		case 4:
+		    for (int j=0;j!=n;++j)
+			{
+			    runge_kutta_4(dt/
+					  (2*sqrt(data[0]*data[0]+data[2]*data[2])));
+			    *(outs+j)=data[0]*data[2];
+			}
+		break;
+		
+		case 5:
+		    for (int j=0;j!=n;++j)
+			{
+			    runge_kutta_4(dt/
+					  (2*sqrt(data[0]*data[0]+data[2]*data[2])));
+			    *(outs+j)=(data[0]*data[0]-data[2]*data[2])*0.5;
+			}
+		    break;
+		}
+	}
+}    
+
+void him::set_mu(t_float f)
+{
+    data[0]=f;
+    reset_nuv;
+}
+
+void him::set_muv(t_float f)
+{
+    data[1]=f;
+    reset_nuv;
+}
+
+void him::set_nu(t_float f)
+{
+    data[3]=f;
+    reset_nuv;
+}
+
+void him::set_nuv(t_float f)
+{
+    data[3]=f;
+    reset_muv;
+    post("resetting muv!!!");
+}
+
+void him::set_etilde(t_float f)
+{
+    E=f;
+    reset_nuv;
+}
+
+void him::set_dt(t_float f)
+{
+    dt=f;
+}
+
+void him::set_regtime(bool b)
+{
+    regtime=b;
+}
+
+void him::set_output(t_int i)
+{
+    output=i;
+}
+
+void him::state()
+{
+    post("mu %f",data[0]);
+    post("mus %f",data[1]);
+    post("nu %f",data[2]);
+    post("nus %f",data[3]);
+    post("etilde %f",E);
+}
+
+void him::reset()
+{
+    data[0]=float(rand())/float(RAND_MAX);
+    data[1]=float(rand())/float(RAND_MAX);
+    data[2]=float(rand())/float(RAND_MAX);
+    reset_muv;
+    post("randomizing values");
+}
diff --git a/tbext/source/main.cpp b/tbext/source/main.cpp
index 07a0713..bb7c517 100644
--- a/tbext/source/main.cpp
+++ b/tbext/source/main.cpp
@@ -40,7 +40,7 @@
 
 
 #include <flext.h>
-#define TBEXT_VERSION "0.04"
+#define TBEXT_VERSION "0.05"
 
 #if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 400)
 #error upgrade your flext version!!!!!!
@@ -52,11 +52,10 @@ void ttbext_setup()
   post("version "TBEXT_VERSION);
   post("compiled on "__DATE__);
   post("contains: tbroute(~), tbsig~, tbpow~, tbfft1~, tbfft2~, bufline~, fftgrrev~");
-  post("          fftgrsort~, fftgrshuf~, rfftw~, rifftw~");
+  post("          fftgrsort~, fftgrshuf~, him~");
 
   FLEXT_SETUP(tbroute);
   FLEXT_DSP_SETUP(tbsroute);
-  //  FLEXT_DSP_SETUP(tbssel);
   FLEXT_DSP_SETUP(tbsig);
   FLEXT_DSP_SETUP(tbpow);
   //  FLEXT_DSP_SETUP(tbg7xx);
@@ -66,13 +65,9 @@ void ttbext_setup()
   FLEXT_DSP_SETUP(fftgrsort);
   FLEXT_DSP_SETUP(fftgrshuf);
   FLEXT_DSP_SETUP(fftgrrev);
+  FLEXT_DSP_SETUP(him);
 
 
-#if (FFTW == 1)
-  FLEXT_DSP_SETUP(rfftw);
-  FLEXT_DSP_SETUP(rifftw);
-#endif
-
 
 }
 
-- 
cgit v1.2.1


From 092e3f239e8108d161ad03fb7047d51853dd0008 Mon Sep 17 00:00:00 2001
From: Tim Blechmann <timblech@users.sourceforge.net>
Date: Wed, 31 Mar 2004 11:44:38 +0000
Subject: bug fixed ... now it compiles with gcc, too

svn path=/trunk/externals/tb/; revision=1527
---
 tbext/source/him.cpp | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

(limited to 'tbext/source')

diff --git a/tbext/source/him.cpp b/tbext/source/him.cpp
index 5d1c029..169e4ad 100644
--- a/tbext/source/him.cpp
+++ b/tbext/source/him.cpp
@@ -200,7 +200,7 @@ void him::runge_kutta_4(t_float dt)
 	    data[i] = data[i] + (k1[i] + (2.*(k2[i]+k3[i])) + k4[i])/6.;
         }
     
-    reset_muv;
+    reset_muv();
     
 }
 
@@ -327,32 +327,32 @@ void him::m_signal(int n, t_float *const *in, t_float *const *out)
 void him::set_mu(t_float f)
 {
     data[0]=f;
-    reset_nuv;
+    reset_nuv();
 }
 
 void him::set_muv(t_float f)
 {
     data[1]=f;
-    reset_nuv;
+    reset_nuv();
 }
 
 void him::set_nu(t_float f)
 {
     data[3]=f;
-    reset_nuv;
+    reset_nuv();
 }
 
 void him::set_nuv(t_float f)
 {
     data[3]=f;
-    reset_muv;
+    reset_muv();
     post("resetting muv!!!");
 }
 
 void him::set_etilde(t_float f)
 {
     E=f;
-    reset_nuv;
+    reset_nuv();
 }
 
 void him::set_dt(t_float f)
@@ -384,6 +384,6 @@ void him::reset()
     data[0]=float(rand())/float(RAND_MAX);
     data[1]=float(rand())/float(RAND_MAX);
     data[2]=float(rand())/float(RAND_MAX);
-    reset_muv;
+    reset_muv();
     post("randomizing values");
 }
-- 
cgit v1.2.1


From 604a3ed6ad86c5e25f1a904c012639f821c4d999 Mon Sep 17 00:00:00 2001
From: Tim Blechmann <timblech@users.sourceforge.net>
Date: Fri, 9 Apr 2004 13:42:58 +0000
Subject: some updates

svn path=/trunk/externals/tb/; revision=1589
---
 tbext/source/him.cpp | 153 ++++++++++++---------------------------------------
 1 file changed, 36 insertions(+), 117 deletions(-)

(limited to 'tbext/source')

diff --git a/tbext/source/him.cpp b/tbext/source/him.cpp
index 169e4ad..4c6c62e 100644
--- a/tbext/source/him.cpp
+++ b/tbext/source/him.cpp
@@ -71,7 +71,6 @@ protected:
     void set_etilde(t_float);
     void set_dt(t_float);
     void set_regtime(bool);
-    void set_output(t_int);
     void state();
     void reset();
 
@@ -92,7 +91,6 @@ private:
 
     //and these our settings
     t_float dt;
-    t_int output;   //mu, muv, nu, nuv, x, y 
     bool regtime; //if true "regularisierte zeit"
 
     //Callbacks
@@ -103,7 +101,6 @@ private:
     FLEXT_CALLBACK_1(set_etilde,t_float);
     FLEXT_CALLBACK_1(set_dt,t_float);
     FLEXT_CALLBACK_1(set_regtime,bool);
-    FLEXT_CALLBACK_1(set_output,t_int);
     FLEXT_CALLBACK(state);
     FLEXT_CALLBACK(reset);
 
@@ -135,6 +132,11 @@ him::him(int argc, t_atom *argv)
 {
     AddInAnything();
     AddOutSignal();
+    AddOutSignal();
+    AddOutSignal();
+    AddOutSignal();
+    AddOutSignal();
+    AddOutSignal();
     FLEXT_ADDMETHOD_F(0,"mu",set_mu);
     FLEXT_ADDMETHOD_F(0,"muv",set_muv);
     FLEXT_ADDMETHOD_F(0,"nu",set_nu);
@@ -142,7 +144,6 @@ him::him(int argc, t_atom *argv)
     FLEXT_ADDMETHOD_F(0,"e",set_etilde);
     FLEXT_ADDMETHOD_F(0,"dt",set_dt);
     FLEXT_ADDMETHOD_B(0,"regtime",set_regtime);
-    FLEXT_ADDMETHOD_I(0,"output",set_output);
     FLEXT_ADDMETHOD_(0,"state",state);
     FLEXT_ADDMETHOD_(0,"reset",reset);
     
@@ -159,7 +160,6 @@ him::him(int argc, t_atom *argv)
 
     //default mode
     regtime=true;
-    output=0;
     dt=0.01;
 } 
 
@@ -199,8 +199,18 @@ void him::runge_kutta_4(t_float dt)
 	    k4[i] = dt * deriv(temp3,i);
 	    data[i] = data[i] + (k1[i] + (2.*(k2[i]+k3[i])) + k4[i])/6.;
         }
-    
-    reset_muv();
+
+ 
+    /*
+      the system might become unstable ... in this case, we'll reset the system
+    */    
+
+    for(i=0;i<=NUMB_EQ-1;i++)
+	if(data[i]>2)
+	    reset();
+	else
+	    if(PD_BADFLOAT(data[i])) //not that we get some troubles with denormals
+		data[i]=0;
     
 }
 
@@ -208,118 +218,31 @@ void him::runge_kutta_4(t_float dt)
 
 void him::m_signal(int n, t_float *const *in, t_float *const *out)
 {
-    outs = out[0];
-    
     if (regtime)
 	{
-	    switch (output)
+	    for (int j=0;j!=n;++j)
 		{
-		case 0:
-		    for (int j=0;j!=n;++j)
-			{
-			runge_kutta_4(dt);
-			*(outs+j)=data[0];
-			}
-		    break;
-		    
-		case 1:
-		    for (int j=0;j!=n;++j)
-			{
-			    runge_kutta_4(dt);
-			    *(outs+j)=data[1];
-			}
-		    break;
-		    
-		case 2:
-		    for (int j=0;j!=n;++j)
-			{
-			runge_kutta_4(dt);
-			*(outs+j)=data[2];
-			}
-		    break;
-		
-		case 3:
-		    for (int j=0;j!=n;++j)
-			{
-			    runge_kutta_4(dt);
-			    *(outs+j)=data[3];
-			}
-		    break;
-		    
-		case 4:
-		    for (int j=0;j!=n;++j)
-			{
-			    runge_kutta_4(dt);
-			    *(outs+j)=data[0]*data[2];
-			}
-		    break;
-		    
-		case 5:
-		    for (int j=0;j!=n;++j)
-			{
-			    runge_kutta_4(dt);
-			    *(outs+j)=(data[0]*data[0]-data[2]*data[2])*0.5;
-			}
-		    break;
+		    runge_kutta_4(dt);
+		    *(out[0]+j)=data[0];
+		    *(out[1]+j)=data[1];
+		    *(out[2]+j)=data[2];
+		    *(out[3]+j)=data[3];
+		    *(out[4]+j)=data[0]*data[2];
+		    *(out[5]+j)=(data[0]*data[0]-data[2]*data[2])*0.5;
 		}
 	}
     else
 	{
-	    switch (output)
-		{	    
-		case 0:
-		    for (int j=0;j!=n;++j)
-			{
-			    runge_kutta_4(dt/
-					  (2*sqrt(data[0]*data[0]+data[2]*data[2])));
-			    *(outs+j)=data[0];
-			}
-		    break;
-		    
-		case 1:
-		    for (int j=0;j!=n;++j)
-			{
-			    runge_kutta_4(dt/
-					  (2*sqrt(data[0]*data[0]+data[2]*data[2])));
-			    *(outs+j)=data[1];
-			}
-		    break;
-		    
-		case 2:
-		    for (int j=0;j!=n;++j)
-		    {
-			runge_kutta_4(dt/
-				      (2*sqrt(data[0]*data[0]+data[2]*data[2])));
-			*(outs+j)=data[2];
-		    }
-		    break;
-		    
-		case 3:
-		    for (int j=0;j!=n;++j)
-		    {
-			runge_kutta_4(dt/
-				      (2*sqrt(data[0]*data[0]+data[2]*data[2])));
-			*(outs+j)=data[3];
-		    }
-		    break;
-		    
-		case 4:
-		    for (int j=0;j!=n;++j)
-			{
-			    runge_kutta_4(dt/
-					  (2*sqrt(data[0]*data[0]+data[2]*data[2])));
-			    *(outs+j)=data[0]*data[2];
-			}
-		break;
-		
-		case 5:
-		    for (int j=0;j!=n;++j)
-			{
-			    runge_kutta_4(dt/
-					  (2*sqrt(data[0]*data[0]+data[2]*data[2])));
-			    *(outs+j)=(data[0]*data[0]-data[2]*data[2])*0.5;
-			}
-		    break;
+	    for (int j=0;j!=n;++j)
+		{
+		    runge_kutta_4(dt/
+				  (2*sqrt(data[0]*data[0]+data[2]*data[2])));
+		    *(out[0]+j)=data[0];
+		    *(out[1]+j)=data[1];
+		    *(out[2]+j)=data[2];
+		    *(out[3]+j)=data[3];
+		    *(out[4]+j)=data[0]*data[2];
+		    *(out[5]+j)=(data[0]*data[0]-data[2]*data[2])*0.5;
 		}
 	}
 }    
@@ -365,10 +288,6 @@ void him::set_regtime(bool b)
     regtime=b;
 }
 
-void him::set_output(t_int i)
-{
-    output=i;
-}
 
 void him::state()
 {
@@ -384,6 +303,6 @@ void him::reset()
     data[0]=float(rand())/float(RAND_MAX);
     data[1]=float(rand())/float(RAND_MAX);
     data[2]=float(rand())/float(RAND_MAX);
-    reset_muv();
+    reset_nuv();
     post("randomizing values");
 }
-- 
cgit v1.2.1


From d25a145c5e18d32a43e60ea7be9c621bac83badf Mon Sep 17 00:00:00 2001
From: Tim Blechmann <timblech@users.sourceforge.net>
Date: Tue, 13 Jul 2004 20:04:52 +0000
Subject: hopefully a speedup

svn path=/trunk/externals/tb/; revision=1854
---
 tbext/source/him.cpp | 124 ++++++++++++++++++++++++++++-----------------------
 1 file changed, 68 insertions(+), 56 deletions(-)

(limited to 'tbext/source')

diff --git a/tbext/source/him.cpp b/tbext/source/him.cpp
index 4c6c62e..c6b1593 100644
--- a/tbext/source/him.cpp
+++ b/tbext/source/him.cpp
@@ -62,7 +62,6 @@ public:
 
 protected:
     virtual void m_signal (int n, float *const *in, float *const *out);
-    t_float *outs;
     
     void set_mu(t_float);
     void set_muv(t_float);
@@ -77,13 +76,9 @@ protected:
 private:
     // contains DGL-System
     t_float deriv(t_float x[],int eq);
-    t_float result;
 
     // 4th order Runge Kutta update of the dynamical variables 
     void   runge_kutta_4(t_float dt);
-    int i;
-    t_float k1[NUMB_EQ],k2[NUMB_EQ],k3[NUMB_EQ],k4[NUMB_EQ];
-    t_float temp1[NUMB_EQ], temp2[NUMB_EQ], temp3[NUMB_EQ];
 
     //these are our data
     t_float data[4]; //mu, muv, nu, nuv (semi-parabolische koordinaten)
@@ -112,8 +107,10 @@ private:
 			   + (8*E*data[0]) - (8*E*data[2]) - 
 			   (data[0]*data[0]*data[0]*data[0]*data[1]*data[1])
 			   + 16);
+     	if (fabs((data[3]))<1e-5)
+ 	    data[3]=0;
     }
-
+    
     void reset_muv()
     {
 	data[1]= 0.5*sqrt( - (4*data[3]*data[3]) - 
@@ -121,6 +118,8 @@ private:
 			   + (8*E*data[0]) - (8*E*data[2]) - 
 			   (data[0]*data[0]*data[0]*data[0]*data[1]*data[1])
 			   + 16);
+ 	if (fabs((data[1]))<1e-5)
+ 	    data[1]=0;
     }
     
 };
@@ -163,9 +162,10 @@ him::him(int argc, t_atom *argv)
     dt=0.01;
 } 
 
-t_float him::deriv(t_float x[], int eq)
+inline t_float him::deriv(t_float * x, int eq)
 {
-  // set DGL-System here
+    t_float result;
+    // set DGL-System here
     if (eq == 0) result =  x[1];
     if (eq == 1) result = 2*E*x[0]-0.25*x[0]*x[2]*x[2]*(2*x[0]*x[0]+x[2]*x[2]);
     if (eq == 2) result =  x[3];
@@ -174,77 +174,89 @@ t_float him::deriv(t_float x[], int eq)
   return result;
 }
 
-void him::runge_kutta_4(t_float dt)                          
+inline void him::runge_kutta_4(t_float dt)                          
 {
-    for(i=0;i<=NUMB_EQ-1;i++) // iterate over equations 
-	{
-	    k1[i] = dt * deriv(data,i);
-	    temp1[i] = data[i] + 0.5*k1[i];	    	    
-	}
+    t_float k1[NUMB_EQ],k2[NUMB_EQ],k3[NUMB_EQ],k4[NUMB_EQ];
+    t_float temp1[NUMB_EQ], temp2[NUMB_EQ], temp3[NUMB_EQ];
     
-    for(i=0;i<=NUMB_EQ-1;i++)
-	{
-	    k2[i] = dt * deriv(temp1,i);
-	    temp2[i] = data[i] + 0.5*k2[i];
-        }
+    for(int i=0;i<=NUMB_EQ-1;i++) // iterate over equations 
+    {
+	k1[i] = dt * deriv(data,i);
+	temp1[i] = data[i] + 0.5*k1[i];	    	    
+    }
     
-    for(i=0;i<=NUMB_EQ-1;i++)
-	{
-	    k3[i] = dt * deriv(temp2,i);
-	    temp3[i] = data[i] + k3[i];    
-	}
+    for(int i=0;i<=NUMB_EQ-1;i++)
+    {
+	k2[i] = dt * deriv(temp1,i);
+	temp2[i] = data[i] + 0.5*k2[i];
+    }
     
-    for(i=0;i<=NUMB_EQ-1;i++)
-	{
-	    k4[i] = dt * deriv(temp3,i);
-	    data[i] = data[i] + (k1[i] + (2.*(k2[i]+k3[i])) + k4[i])/6.;
-        }
+    for(int i=0;i<=NUMB_EQ-1;i++)
+    {
+	k3[i] = dt * deriv(temp2,i);
+	temp3[i] = data[i] + k3[i];    
+    }
+    
+    for(int i=0;i<=NUMB_EQ-1;i++)
+    {
+	k4[i] = dt * deriv(temp3,i);
+	data[i] = data[i] + (k1[i] + (2.*(k2[i]+k3[i])) + k4[i])/6.;
+    	
+	// we don't want to experience denormals in the next step */
+	if(fabs((data[i]))<1e-5)   
+	    data[i]=0;
+    }
 
- 
+    
     /*
       the system might become unstable ... in this case, we'll reset the system
     */    
 
-    for(i=0;i<=NUMB_EQ-1;i++)
+    for(int i=0;i<=NUMB_EQ-1;i++)
+    {
 	if(data[i]>2)
 	    reset();
-	else
-	    if(PD_BADFLOAT(data[i])) //not that we get some troubles with denormals
-		data[i]=0;
-    
+    }
 }
 
 
 
 void him::m_signal(int n, t_float *const *in, t_float *const *out)
 {
+    t_float * out0 = out[0];
+    t_float * out1 = out[1];
+    t_float * out2 = out[2];
+    t_float * out3 = out[3];
+    t_float * out4 = out[4];
+    t_float * out5 = out[5];
+
+    
     if (regtime)
+    {
+	for (int j=0;j!=n;++j)
 	{
-	    for (int j=0;j!=n;++j)
-		{
-		    runge_kutta_4(dt);
-		    *(out[0]+j)=data[0];
-		    *(out[1]+j)=data[1];
-		    *(out[2]+j)=data[2];
-		    *(out[3]+j)=data[3];
-		    *(out[4]+j)=data[0]*data[2];
-		    *(out[5]+j)=(data[0]*data[0]-data[2]*data[2])*0.5;
-		}
+	    runge_kutta_4(dt);
+	    (*(out0)++)=data[0];
+	    (*(out1)++)=data[1];
+	    (*(out2)++)=data[2];
+	    (*(out3)++)=data[3];
+	    (*(out4)++)=data[0]*data[2];
+	    (*(out5)++)=(data[0]*data[0]-data[2]*data[2])*0.5;
 	}
+    }
     else
+    {
+	for (int j=0;j!=n;++j)
 	{
-	    for (int j=0;j!=n;++j)
-		{
-		    runge_kutta_4(dt/
-				  (2*sqrt(data[0]*data[0]+data[2]*data[2])));
-		    *(out[0]+j)=data[0];
-		    *(out[1]+j)=data[1];
-		    *(out[2]+j)=data[2];
-		    *(out[3]+j)=data[3];
-		    *(out[4]+j)=data[0]*data[2];
-		    *(out[5]+j)=(data[0]*data[0]-data[2]*data[2])*0.5;
-		}
+	    runge_kutta_4(dt/(2*sqrt(data[0]*data[0]+data[2]*data[2])));
+	    (*(out0)++)=data[0];
+	    (*(out1)++)=data[1];
+	    (*(out2)++)=data[2];
+	    (*(out3)++)=data[3];
+	    (*(out4)++)=data[0]*data[2];
+	    (*(out5)++)=(data[0]*data[0]-data[2]*data[2])*0.5;
 	}
+    }
 }    
 
 void him::set_mu(t_float f)
-- 
cgit v1.2.1


From 07468876d7ad699977fd3f67d708dfe90a9d1626 Mon Sep 17 00:00:00 2001
From: Tim Blechmann <timblech@users.sourceforge.net>
Date: Tue, 13 Jul 2004 20:06:10 +0000
Subject: cleanup

svn path=/trunk/externals/tb/; revision=1855
---
 tbext/source/tbfft2.cpp | 93 ++++++++++++++++++++++++++-----------------------
 1 file changed, 49 insertions(+), 44 deletions(-)

(limited to 'tbext/source')

diff --git a/tbext/source/tbfft2.cpp b/tbext/source/tbfft2.cpp
index 99d16fe..1ab08db 100644
--- a/tbext/source/tbfft2.cpp
+++ b/tbext/source/tbfft2.cpp
@@ -49,35 +49,28 @@
 
 class tbfft2: public flext_dsp
 {
-  FLEXT_HEADER(tbfft2,flext_dsp);
-
+    FLEXT_HEADER(tbfft2,flext_dsp);
+    
 public: // constructor
-  tbfft2();
+    tbfft2();
+    ~tbfft2();
 
 protected:
-  virtual void m_signal (int n, float *const *in, float *const *out);
-  void set_freq(t_float);
-  void set_width(t_float);
-
+    virtual void m_signal (int n, float *const *in, float *const *out);
+    virtual void m_dsp (int n, float *const *in, float *const *out);
+    void set_freq(t_float);
+    void set_width(t_float);
+    
 private:
-  FLEXT_CALLBACK_1(set_freq,t_float)
-  FLEXT_CALLBACK_1(set_width,t_float)
-  
-  t_int center;
-  t_int width;
-  
-  t_float pos;
-  t_int posi;
-
-  float *ins;
-  float *outs;
-  float *tmps;
-  t_float tmp[17000];
+    FLEXT_CALLBACK_1(set_freq,t_float);
+    FLEXT_CALLBACK_1(set_width,t_float);
   
-  t_float s;
-  t_float b;
-  
-  t_int n0;
+    t_int center;
+    t_int width;
+    
+    t_float * tmp;
+    
+    t_int n0;
 };
 
 
@@ -91,40 +84,52 @@ tbfft2::tbfft2()
   FLEXT_ADDMETHOD_F(0,"width",set_width);
 } 
 
+tbfft2::~tbfft2()
+{
+    free(tmp);
+}
 
-void tbfft2::m_signal(int n, t_float *const *in, t_float *const *out)
+void tbfft2::m_dsp(int n, t_float *const *in, t_float *const *out)
 {
-  ins = in[0];
-  outs = out[0];
+    free(tmp);
+    tmp=(t_float*)malloc(n*sizeof(t_float));
+}
 
-  CopySamples(tmp,ins,n);
-  
-  n0=n/2;  
 
-  if (center-width>0)
+
+void tbfft2::m_signal(int n, t_float *const *in, t_float *const *out)
+{
+    t_float * ins = in[0];
+    t_float * outs = out[0];
+
+    CopySamples(tmp,ins,n);
+    
+    n0=n/2;  
+    
+    if (center-width>0)
     {
-      n=center-width;
+	n=center-width;
     }
-  else
-    n=0;
-  
-  while (n<center+width)
+    else
+	n=0;
+    
+    while (n<center+width)
     {
-      tmp[n]=*(ins+2*center-n);
-      ++n;
+	tmp[n]=*(ins+2*center-n);
+	++n;
     }
-  
-
+    
 
-  //memcp
-  CopySamples(outs,tmp,n0*2);
+    
+    //memcpy
+    CopySamples(outs,tmp,n0*2);
   
 }
 
 void tbfft2::set_freq(t_float freq)
 {
-  center=freq;
-  set_width(width);
+    center=freq;
+    set_width(width);
 }
 
 void tbfft2::set_width(t_float w)
-- 
cgit v1.2.1


From e0775c6066f90ece58bf84326ab7180cb6c3d539 Mon Sep 17 00:00:00 2001
From: Tim Blechmann <timblech@users.sourceforge.net>
Date: Tue, 13 Jul 2004 20:11:34 +0000
Subject: obsolete ... part of pd now...

svn path=/trunk/externals/tb/; revision=1856
---
 tbext/source/rfftw~.cpp  | 138 ----------------------------------------
 tbext/source/rifftw~.cpp | 161 -----------------------------------------------
 2 files changed, 299 deletions(-)
 delete mode 100644 tbext/source/rfftw~.cpp
 delete mode 100644 tbext/source/rifftw~.cpp

(limited to 'tbext/source')

diff --git a/tbext/source/rfftw~.cpp b/tbext/source/rfftw~.cpp
deleted file mode 100644
index dd10517..0000000
--- a/tbext/source/rfftw~.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/* Copyright (c) 2004 Tim Blechmann.                                            */
-/* For information on usage and redistribution, and for a DISCLAIMER OF ALL     */
-/* WARRANTIES, see the file, "COPYING"  in this distribution.                   */
-/*                                                                              */
-/*                                                                              */
-/* rfftw~ is doing the same as rfft~, but it's based on the fftw library,       */
-/* that is much faster that pd's internal fft ...                               */
-/*                                                                              */
-/*                                                                              */
-/* rfftw~ uses the flext C++ layer for Max/MSP and PD externals.                */
-/* get it at http://www.parasitaere-kapazitaeten.de/PD/ext                      */
-/* thanks to Thomas Grill                                                       */
-/*                                                                              */
-/*                                                                              */
-/*                                                                              */
-/* 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.                       */
-/*                                                                              */
-/* See file LICENSE for further informations on licensing terms.                */
-/*                                                                              */
-/* 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; if not, write to the Free Software                  */
-/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  */
-/*                                                                              */
-/* Based on PureData by Miller Puckette and others.                             */
-/*                                                                              */
-/*                                                                              */
-/*                                                                              */
-/* coded while listening to: Wolfgang Mitterer: Radiofractal & Beat Music       */
-/*                           Sun Ra: Reflections In Blue                        */
-/*                                                                              */
-/*                                                                              */
-
-
-
-#include <flext.h>
-
-#include "fftw3.h"
-#include <algorithm>
-
-#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401)
-#error upgrade your flext version!!!!!!
-#endif
-
-class rfftw: public flext_dsp
-{
-  FLEXT_HEADER(rfftw,flext_dsp);
-
-public: // constructor
-  rfftw();
-  ~rfftw();
-
-protected:
-  virtual void m_signal (int n, float *const *in, float *const *out);
-  
-  fftwf_plan p;    //fftw plan
-  int bins;        //number of bins
-  float * outreal; //pointer to real output
-  float * outimag; //pointer to imaginary output
-  
-  float * infft;   //array fftw is working on
-  float * outfft;  //array fftw uses to output it's values
-  
-
- private:
-};
-
-
-FLEXT_LIB_DSP("rfftw~",rfftw);
-
-rfftw::rfftw()
-  :bins(64)
-{
-  //get ready for the default blocksize
-  infft = fftwf_malloc(sizeof(float) * bins);
-  outfft = fftwf_malloc(sizeof(float) * bins);
-  p=fftwf_plan_r2r_1d(bins,infft,outfft,FFTW_FORWARD,FFTW_MEASURE);
-  
-  AddInSignal();
-  AddOutSignal();
-  AddOutSignal();
-} 
-
-rfftw::~rfftw()
-{
-  fftwf_free(infft);
-  fftwf_free(outfft);
-  fftwf_destroy_plan(p);
-} 
-
-
-void rfftw::m_signal(int n, float *const *in, float *const *out)
-{
-  //set output pointers
-  outreal = out[0];
-  outimag = out[1];
-
-  //if blocksize changed, we have to set a new plan for the fft
-  if (n!=bins)
-    {
-      bins=n;
-
-      //re-allocate fft buffers
-      fftwf_free(infft);
-      infft = fftwf_malloc(sizeof(float) * bins);
-      fftwf_free(outfft);
-      outfft = fftwf_malloc(sizeof(float) * bins);
-      
-      //set plan, this might take a few seconds
-      //but you don't have to do that on the fly...
-      fftwf_destroy_plan(p);
-      p=fftwf_plan_r2r_1d(bins,infft,outfft,FFTW_FORWARD,FFTW_MEASURE);
-  }
-
-  CopySamples(infft,in[0],n);
-  
-  //execute
-  fftwf_execute(p);
-
-  //Copy samples to outlets
-  CopySamples(outreal,outfft,n/2);
-  std::reverse_copy(outfft+n/2+1,outfft+n,outimag+1);
-
-  //why do we have to invert the samples???
-  for (int i = n/2+1; i!=0;--i)
-    {
-      *(outimag+i)=-*(outimag+i);
-    }
-
-}
-
diff --git a/tbext/source/rifftw~.cpp b/tbext/source/rifftw~.cpp
deleted file mode 100644
index ee6f126..0000000
--- a/tbext/source/rifftw~.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/* Copyright (c) 2004 Tim Blechmann.                                            */
-/* For information on usage and redistribution, and for a DISCLAIMER OF ALL     */
-/* WARRANTIES, see the file, "COPYING"  in this distribution.                   */
-/*                                                                              */
-/*                                                                              */
-/* rifftw~ is doing the same as rifft~, but it's based on the fftw library,     */
-/* that is much faster that pd's internal fft ...                               */
-/*                                                                              */
-/*                                                                              */
-/* rifftw~ uses the flext C++ layer for Max/MSP and PD externals.               */
-/* get it at http://www.parasitaere-kapazitaeten.de/PD/ext                      */
-/* thanks to Thomas Grill                                                       */
-/*                                                                              */
-/*                                                                              */
-/*                                                                              */
-/* 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.                       */
-/*                                                                              */
-/* See file LICENSE for further informations on licensing terms.                */
-/*                                                                              */
-/* 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; if not, write to the Free Software                  */
-/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  */
-/*                                                                              */
-/* Based on PureData by Miller Puckette and others.                             */
-/*                                                                              */
-/*                                                                              */
-/*                                                                              */
-/* coded while listening to: Caged/Uncaged                                      */
-/*                           Sunny Murray: Hommage To Africa                    */
-/*                                                                              */
-/*                                                                              */
-
-
-
-#include <flext.h>
-
-#include "fftw3.h"
-#include <algorithm>
-
-#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401)
-#error upgrade your flext version!!!!!!
-#endif
-
-class rifftw: public flext_dsp
-{
-  FLEXT_HEADER(rifftw,flext_dsp);
-
-public: // constructor
-  rifftw();
-  ~rifftw();
-
-protected:
-  virtual void m_signal (int n, float *const *in, float *const *out);
-  
-  fftwf_plan p;    //fftw plan
-  int bins;        //number of bins
-  float * inreal; //pointer to real input
-  float * inimag; //pointer to imaginary input
-  
-  fftwf_complex * incomplex;
-
-  //float * infft;   //array fftw is working on
-  float * outfft;  //array fftw uses to output it's values
-  
-
- private:
-};
-
-
-FLEXT_LIB_DSP("rifftw~",rifftw);
-
-rifftw::rifftw()
-  :bins(64)
-{
-  //get ready for the default blocksize
-  //  infft = fftwf_malloc(sizeof(float) * bins);
-  outfft = fftwf_malloc(sizeof(float) * bins);
-
-
-  incomplex = fftwf_malloc(sizeof(fftwf_complex) * bins);
-
-
-  //  p=fftwf_plan_r2r_1d(bins,infft,outfft,FFTW_BACKWARD,FFTW_MEASURE);
-  p=fftwf_plan_dft_c2r_1d(bins,incomplex,outfft,FFTW_BACKWARD,FFTW_MEASURE);
-  
-  AddInSignal();
-  AddInSignal();
-  AddOutSignal();
-} 
-
-rifftw::~rifftw()
-{
-  //  fftwf_free(infft);
-  fftwf_free(outfft);
-  fftwf_free(incomplex);
-  fftwf_destroy_plan(p);
-} 
-
-
-void rifftw::m_signal(int n, float *const *in, float *const *out)
-{
-  //set output pointers
-  inreal = in[0];
-  inimag = in[1];
-
-  //if blocksize changed, we have to set a new plan for the fft
-  if (n!=bins)
-    {
-      bins=n;
-
-      //re-allocate fft buffers
-      //      fftwf_free(infft);
-      //      infft = fftwf_malloc(sizeof(float) * bins);
-      fftwf_free(outfft);
-      outfft = fftwf_malloc(sizeof(float) * bins);
-
-      fftwf_free(incomplex);
-      incomplex = fftwf_malloc(sizeof(fftwf_complex) * bins);
-      
-      //set plan, this might take a few seconds
-      //but you don't have to do that on the fly...
-      fftwf_destroy_plan(p);
-      //p=fftwf_plan_r2r_1d(bins,infft,outfft,FFTW_BACKWARD,FFTW_MEASURE);
-      p=fftwf_plan_dft_c2r_1d(bins,incomplex,outfft,FFTW_BACKWARD,FFTW_MEASURE);
-
-  }
-
-  //Copy samples to the fft
-  //  CopySamples(infft,inreal,n/2);
-  //  std::reverse_copy(inimag,inimag+n/2,infft+n/2);
-  
-  
-  /*
-  //why do we have to invert the samples???
-    for (int i = n/2+1; i!=n;++i)
-    {
-      *(infft+i)=-*(infft+i);
-    }
-  */
-
-  for (int i=0;i!=n/2;++i)
-    {
-      incomplex[i][0]=inreal[i];
-      incomplex[i][1]=-inimag[i];
-    }
-
-  //execute
-  fftwf_execute(p);
-
-  CopySamples(out[0],outfft,n);
-
-}
-
-- 
cgit v1.2.1


From 652996b3720ddc909d1711b106618ae6d910d87f Mon Sep 17 00:00:00 2001
From: Tim Blechmann <timblech@users.sourceforge.net>
Date: Mon, 30 Aug 2004 13:52:39 +0000
Subject: removed some obsolete externals

svn path=/trunk/externals/tb/; revision=1978
---
 tbext/source/main.cpp | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

(limited to 'tbext/source')

diff --git a/tbext/source/main.cpp b/tbext/source/main.cpp
index bb7c517..39ac8b2 100644
--- a/tbext/source/main.cpp
+++ b/tbext/source/main.cpp
@@ -48,17 +48,16 @@
 
 void ttbext_setup()
 {
-  post("TBEXT: by tim blechmann");
+  post("\nTBEXT: by tim blechmann");
   post("version "TBEXT_VERSION);
   post("compiled on "__DATE__);
-  post("contains: tbroute(~), tbsig~, tbpow~, tbfft1~, tbfft2~, bufline~, fftgrrev~");
-  post("          fftgrsort~, fftgrshuf~, him~");
+  post("contains: tbroute(~), tbfft1~, tbfft2~, bufline~, fftgrrev~");
+  post("          fftgrsort~, fftgrshuf~, him~\n");
 
   FLEXT_SETUP(tbroute);
   FLEXT_DSP_SETUP(tbsroute);
-  FLEXT_DSP_SETUP(tbsig);
-  FLEXT_DSP_SETUP(tbpow);
-  //  FLEXT_DSP_SETUP(tbg7xx);
+  /* obsolete: FLEXT_DSP_SETUP(tbsig); */
+  /* obsolete: FLEXT_DSP_SETUP(tbpow); */
   FLEXT_DSP_SETUP(tbfft1);
   FLEXT_DSP_SETUP(tbfft2);
   FLEXT_DSP_SETUP(fftbuf);
-- 
cgit v1.2.1


From e37d21ff39bdb356591240aa338db903761379d0 Mon Sep 17 00:00:00 2001
From: Tim Blechmann <timblech@users.sourceforge.net>
Date: Mon, 30 Aug 2004 13:55:11 +0000
Subject: obsolete

svn path=/trunk/externals/tb/; revision=1979
---
 tbext/source/tbpow~.cpp | 100 ------------------------------------------------
 tbext/source/tbsig~.cpp |  85 ----------------------------------------
 2 files changed, 185 deletions(-)
 delete mode 100644 tbext/source/tbpow~.cpp
 delete mode 100644 tbext/source/tbsig~.cpp

(limited to 'tbext/source')

diff --git a/tbext/source/tbpow~.cpp b/tbext/source/tbpow~.cpp
deleted file mode 100644
index 14a383c..0000000
--- a/tbext/source/tbpow~.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/* Copyright (c) 2003 Tim Blechmann.                                            */
-/* For information on usage and redistribution, and for a DISCLAIMER OF ALL     */
-/* WARRANTIES, see the file, "COPYING"  in this distribution.                   */
-/*                                                                              */
-/*                                                                              */
-/* tbpow~ calculates the power of each sample. In fact i expected it to sound   */
-/* better than it does. but maybe someone is interested in using it...          */
-/*                                                                              */
-/*                                                                              */
-/* tbpow~ uses the flext C++ layer for Max/MSP and PD externals.                */
-/* get it at http://www.parasitaere-kapazitaeten.de/PD/ext                      */
-/* thanks to Thomas Grill                                                       */
-/*                                                                              */
-/*                                                                              */
-/*                                                                              */
-/* 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.                       */
-/*                                                                              */
-/* See file LICENSE for further informations on licensing terms.                */
-/*                                                                              */
-/* 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; if not, write to the Free Software                  */
-/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  */
-/*                                                                              */
-/* Based on PureData by Miller Puckette and others.                             */
-/*                                                                              */
-/*                                                                              */
-/*                                                                              */
-/* coded while listening to: Assif Tsahar & Susie Ibarra: Home Cookin'          */
-/*                           Painkiller: Talisman                               */
-/*                                                                              */
-
-
-
-#include <flext.h>
-
-#include <cmath>
-
-#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401)
-#error upgrade your flext version!!!!!!
-#endif
-
-class tbpow: public flext_dsp
-{
-  FLEXT_HEADER(tbpow,flext_dsp);
-
-public: // constructor
-  tbpow();
-
-protected:
-  virtual void m_signal (int n, float *const *in, float *const *out);
-
-  void set_power(float f);
-  
-private:
-  float power;
-  
-  FLEXT_CALLBACK_1(set_power,float)
-  
-};
-
-
-FLEXT_LIB_DSP("tbpow~",tbpow);
-
-tbpow::tbpow()
-{
-  AddInSignal();
-  AddInFloat();
-  AddOutSignal();
-  
-  FLEXT_ADDMETHOD(1,set_power);
-  power=1;
-} 
-
-
-void tbpow::m_signal(int n, float *const *in, float *const *out)
-{
-  const float *ins=in[0];
-  float *outs = out[0];
-
-  while (n--)
-    {
-      *outs = pow(*ins,power);
-      *outs++;
-      *ins++;
-    }
- 
-}
-
-void tbpow::set_power(float f)
-{
-  power=f;
-}
diff --git a/tbext/source/tbsig~.cpp b/tbext/source/tbsig~.cpp
deleted file mode 100644
index cda79cc..0000000
--- a/tbext/source/tbsig~.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/* Copyright (c) 2003 Tim Blechmann.                                            */
-/* For information on usage and redistribution, and for a DISCLAIMER OF ALL     */
-/* WARRANTIES, see the file, "COPYING"  in this distribution.                   */
-/*                                                                              */
-/*                                                                              */
-/* tbsig~ is gives you the sign of an audio signal. should be useful to create  */
-/* a square oscillator or some noisy sounds                                     */
-/*                                                                              */
-/*                                                                              */
-/* tbsig~ uses the flext C++ layer for Max/MSP and PD externals.                */
-/* get it at http://www.parasitaere-kapazitaeten.de/PD/ext                      */
-/* thanks to Thomas Grill                                                       */
-/*                                                                              */
-/*                                                                              */
-/*                                                                              */
-/* 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.                       */
-/*                                                                              */
-/* See file LICENSE for further informations on licensing terms.                */
-/*                                                                              */
-/* 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; if not, write to the Free Software                  */
-/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  */
-/*                                                                              */
-/* Based on PureData by Miller Puckette and others.                             */
-/*                                                                              */
-/*                                                                              */
-/*                                                                              */
-/* coded while listening to: Peter Broetzmann & Hamid Drake: The Dried Rat-Dog  */
-/*                                                                              */
-/*                                                                              */
-
-
-
-#include <flext.h>
-
-#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401)
-#error upgrade your flext version!!!!!!
-#endif
-
-class tbsig: public flext_dsp
-{
-  FLEXT_HEADER(tbsig,flext_dsp);
-
-public: // constructor
-  tbsig();
-
-protected:
-  virtual void m_signal (int n, float *const *in, float *const *out);
-
-};
-
-
-FLEXT_LIB_DSP("tbsig~",tbsig);
-
-tbsig::tbsig()
-{
-  AddInSignal();
-  AddOutSignal();
-} 
-
-
-void tbsig::m_signal(int n, float *const *in, float *const *out)
-{
-  const float *ins=in[0];
-  float *outs = out[0];
-
-  while (n--)
-    {
-      if (*ins>0) 
-	*outs = 1;
-      else
-	*outs = -1;
-      *outs++;
-      *ins++;
-    }
- 
-}
-- 
cgit v1.2.1


From 11287cecd754c0e7181ee763aab44cf954526b61 Mon Sep 17 00:00:00 2001
From: Tim Blechmann <timblech@users.sourceforge.net>
Date: Sun, 5 Sep 2004 21:28:52 +0000
Subject: added crossfade

svn path=/trunk/externals/tb/; revision=2005
---
 tbext/source/him.cpp | 129 ++++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 118 insertions(+), 11 deletions(-)

(limited to 'tbext/source')

diff --git a/tbext/source/him.cpp b/tbext/source/him.cpp
index c6b1593..56872df 100644
--- a/tbext/source/him.cpp
+++ b/tbext/source/him.cpp
@@ -62,6 +62,7 @@ public:
 
 protected:
     virtual void m_signal (int n, float *const *in, float *const *out);
+    virtual void m_dsp (int n, float *const *in, float *const *out);
     
     void set_mu(t_float);
     void set_muv(t_float);
@@ -78,7 +79,7 @@ private:
     t_float deriv(t_float x[],int eq);
 
     // 4th order Runge Kutta update of the dynamical variables 
-    void   runge_kutta_4(t_float dt);
+    void runge_kutta_4(t_float dt);
 
     //these are our data
     t_float data[4]; //mu, muv, nu, nuv (semi-parabolische koordinaten)
@@ -88,6 +89,14 @@ private:
     t_float dt;
     bool regtime; //if true "regularisierte zeit"
 
+    bool xfade;
+    t_float newE;
+    t_float newdt;
+    bool newsystem;
+    bool newregtime;
+
+    t_float * m_fader;
+
     //Callbacks
     FLEXT_CALLBACK_1(set_mu,t_float);
     FLEXT_CALLBACK_1(set_muv,t_float);
@@ -209,13 +218,21 @@ inline void him::runge_kutta_4(t_float dt)
 
     
     /*
-      the system might become unstable ... in this case, we'll reset the system
+      the system might become unstable ... in this case, we'll request a new system
     */    
 
     for(int i=0;i<=NUMB_EQ-1;i++)
     {
 	if(data[i]>2)
-	    reset();
+	    {
+		xfade = newsystem =  true;
+		data[i] = 2;
+	    }
+	if(data[i]<-2)
+	    {
+		xfade = newsystem = true;
+		data[i] = -2;
+	    }
     }
 }
 
@@ -233,7 +250,7 @@ void him::m_signal(int n, t_float *const *in, t_float *const *out)
     
     if (regtime)
     {
-	for (int j=0;j!=n;++j)
+	for (int i=0;i!=n;++i)
 	{
 	    runge_kutta_4(dt);
 	    (*(out0)++)=data[0];
@@ -246,7 +263,7 @@ void him::m_signal(int n, t_float *const *in, t_float *const *out)
     }
     else
     {
-	for (int j=0;j!=n;++j)
+	for (int i=0;i!=n;++i)
 	{
 	    runge_kutta_4(dt/(2*sqrt(data[0]*data[0]+data[2]*data[2])));
 	    (*(out0)++)=data[0];
@@ -257,8 +274,97 @@ void him::m_signal(int n, t_float *const *in, t_float *const *out)
 	    (*(out5)++)=(data[0]*data[0]-data[2]*data[2])*0.5;
 	}
     }
+    
+    if (xfade)
+    {
+	/* fading */
+	out0 = out[0];
+	out1 = out[1];
+	out2 = out[2];
+	out3 = out[3];
+	out4 = out[4];
+	out5 = out[5];
+	
+	t_float * fader = m_fader + n - 1;
+	for (int i=0;i!=n;++i)
+	{
+	    (*(out0)++) *= *fader;
+	    (*(out1)++) *= *fader;
+	    (*(out2)++) *= *fader;
+	    (*(out3)++) *= *fader;
+	    (*(out4)++) *= *fader;
+	    (*(out5)++) *= *fader--;
+	}
+
+	if (newsystem)
+	{
+	    reset();
+	    newsystem = false;
+	}
+	
+	E = newE;
+	dt = newdt;
+	regtime = newregtime;
+
+	out0 = out[0];
+	out1 = out[1];
+	out2 = out[2];
+	out3 = out[3];
+	out4 = out[4];
+	out5 = out[5];
+    
+	fader = m_fader;
+	if (regtime)
+	{
+	    for (int i=0;i!=n;++i)
+	    {
+		runge_kutta_4(dt);
+		(*(out0)++)+= data[0]* *fader;
+		(*(out1)++)+= data[1]* *fader;
+		(*(out2)++)+= data[2]* *fader;
+		(*(out3)++)+= data[3]* *fader;
+		(*(out4)++)+= data[0]*data[2]* *fader;
+		(*(out5)++)+= (data[0]*data[0]-data[2]*data[2])*0.5* *fader++;
+	    }
+	}
+	else
+	{
+	    for (int i=0;i!=n;++i)
+	    {
+		runge_kutta_4(dt/(2*sqrt(data[0]*data[0]+data[2]*data[2])));
+		(*(out0)++)+= data[0]* *fader;
+		(*(out1)++)+= data[1]* *fader;
+		(*(out2)++)+= data[2]* *fader;
+		(*(out3)++)+= data[3]* *fader;
+		(*(out4)++)+= data[0]*data[2]* *fader;
+		(*(out5)++)+= (data[0]*data[0]-data[2]*data[2])*0.5* *fader++;
+	    }
+	}
+	
+	xfade = false;
+    }
+    
 }    
 
+void him::m_dsp(int n, t_float *const *in, t_float *const *out)
+{
+    m_fader = new t_float[n];
+    t_float on = 1.f/(n-1);
+    
+    t_float value = 0;
+
+    t_float* localfader = m_fader;
+
+    while (n--)
+    {
+	*localfader = value;
+	value += on;
+	++localfader;
+    }
+    xfade = false;
+}
+
+
 void him::set_mu(t_float f)
 {
     data[0]=f;
@@ -281,23 +387,25 @@ void him::set_nuv(t_float f)
 {
     data[3]=f;
     reset_muv();
-    post("resetting muv!!!");
 }
 
 void him::set_etilde(t_float f)
 {
-    E=f;
-    reset_nuv();
+    newE=f;
+    xfade = true;
+    //reset_nuv();
 }
 
 void him::set_dt(t_float f)
 {
-    dt=f;
+    newdt=f;
+    xfade = true;
 }
 
 void him::set_regtime(bool b)
 {
-    regtime=b;
+    newregtime=b;
+    xfade = true;
 }
 
 
@@ -316,5 +424,4 @@ void him::reset()
     data[1]=float(rand())/float(RAND_MAX);
     data[2]=float(rand())/float(RAND_MAX);
     reset_nuv();
-    post("randomizing values");
 }
-- 
cgit v1.2.1


From 17bd73bf9c9da670727345b00e639398a8f3d296 Mon Sep 17 00:00:00 2001
From: Tim Blechmann <timblech@users.sourceforge.net>
Date: Tue, 7 Sep 2004 09:13:52 +0000
Subject: *** empty log message ***

svn path=/trunk/externals/tb/; revision=2015
---
 tbext/source/fftgrrev.cpp  | 13 ++++---------
 tbext/source/fftgrshuf.cpp | 16 ++++------------
 tbext/source/fftgrsort.cpp | 15 ++++++---------
 3 files changed, 14 insertions(+), 30 deletions(-)

(limited to 'tbext/source')

diff --git a/tbext/source/fftgrrev.cpp b/tbext/source/fftgrrev.cpp
index e26135c..fd844f0 100644
--- a/tbext/source/fftgrrev.cpp
+++ b/tbext/source/fftgrrev.cpp
@@ -68,14 +68,11 @@ private:
   
   t_int bs; //blocksize
   t_int bs1; //bs+1
-  t_int counter;
 
   t_sample * data; //array with data
   t_sample * d1; //1. element in array with data
   t_sample * dend; //1 element after the last element
   
-  t_sample * ins;
-  t_sample * outs;
 
   bool reverse;
   
@@ -85,7 +82,7 @@ private:
 FLEXT_LIB_DSP_1("fftgrrev~",fftgrrev,int)
 
 fftgrrev::fftgrrev(int arg):
-  grains(1),offset(0),counter(1)
+  grains(1),offset(0)
 {
   bs=arg/2;
   grainsize=bs;
@@ -106,9 +103,8 @@ fftgrrev::fftgrrev(int arg):
 
 void fftgrrev::m_signal(int n, t_float * const *in, t_float *const *out)
 {
-  ins = in[0];
-  outs = out[0];
-
+  t_sample * ins = in[0];
+  t_sample * outs = out[0];
 
   if (offset>0)
     {
@@ -126,7 +122,7 @@ void fftgrrev::m_signal(int n, t_float * const *in, t_float *const *out)
   
   //grains
   
-  counter=1;
+  int counter=1;
   
   while (counter!=grains)
     {
@@ -144,7 +140,6 @@ void fftgrrev::set_offset(t_int o)
   if (o-bs<0 && o+bs>0)
     {
       offset=-o;
-      post("offset %i",o);
     }
   else
     post("Offset out of range!");
diff --git a/tbext/source/fftgrshuf.cpp b/tbext/source/fftgrshuf.cpp
index b490dcf..d9ecdfb 100644
--- a/tbext/source/fftgrshuf.cpp
+++ b/tbext/source/fftgrshuf.cpp
@@ -67,23 +67,17 @@ private:
   
   t_int bs; //blocksize
   t_int bs1; //bs+1
-  t_int counter;
 
   t_sample * data; //array with data
   t_sample * d1; //1. element in array with data
   t_sample * dend; //1 element after the last element
-  
-  t_sample * ins;
-  t_sample * outs;
-
-  
 };
 
 
 FLEXT_LIB_DSP_1("fftgrshuf~",fftgrshuf,int)
 
 fftgrshuf::fftgrshuf(int arg):
-  grains(1),offset(0),counter(1)
+  grains(1),offset(0)
 {
   bs=arg/2;
   grainsize=bs;
@@ -104,9 +98,8 @@ fftgrshuf::fftgrshuf(int arg):
 
 void fftgrshuf::m_signal(int n, t_float * const *in, t_float *const *out)
 {
-  ins = in[0];
-  outs = out[0];
-
+  t_sample * ins = in[0];
+  t_sample * outs = out[0];
 
   if (offset>0)
     {
@@ -124,7 +117,7 @@ void fftgrshuf::m_signal(int n, t_float * const *in, t_float *const *out)
   
   //grains
   
-  counter=1;
+  int counter=1;
   
   while (counter!=grains) 
     {
@@ -143,7 +136,6 @@ void fftgrshuf::set_offset(t_int o)
   if (o-bs<0 && o+bs>0)
     {
       offset=o;
-      post("offset %i",-o);
     }
   else
     post("offset out of range!");
diff --git a/tbext/source/fftgrsort.cpp b/tbext/source/fftgrsort.cpp
index f24ed0f..1764c02 100644
--- a/tbext/source/fftgrsort.cpp
+++ b/tbext/source/fftgrsort.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2003 Tim Blechmann.                                            */
+/* Copyright (c) 2003-2004 Tim Blechmann.                                       */
 /* For information on usage and redistribution, and for a DISCLAIMER OF ALL     */
 /* WARRANTIES, see the file, "COPYING"  in this distribution.                   */
 /*                                                                              */
@@ -70,14 +70,11 @@ private:
   
   t_int bs; //blocksize
   t_int bs1; //bs+1
-  t_int counter;
 
   t_sample * data; //array with data
   t_sample * d1; //1. element in array with data
   t_sample * dend; //1 element after the last element
   
-  t_sample * ins;
-  t_sample * outs;
 
   bool reverse;
   
@@ -87,7 +84,7 @@ private:
 FLEXT_LIB_DSP_1("fftgrsort~",fftgrsort,int)
 
 fftgrsort::fftgrsort(int arg):
-  grains(1),offset(0),counter(1),reverse(0)
+  grains(1),offset(0),reverse(0)
 {
   bs=arg/2;
   grainsize=bs;
@@ -109,8 +106,8 @@ fftgrsort::fftgrsort(int arg):
 
 void fftgrsort::m_signal(int n, t_float * const *in, t_float *const *out)
 {
-  ins = in[0];
-  outs = out[0];
+  t_sample * ins = in[0];
+  t_sample * outs = out[0];
 
 
   if (offset>0)
@@ -129,7 +126,7 @@ void fftgrsort::m_signal(int n, t_float * const *in, t_float *const *out)
   
   //grains
   
-  counter=1;
+  int counter=1;
   
   while (counter!=grains) 
     {
@@ -152,7 +149,7 @@ void fftgrsort::set_offset(t_int o)
   if (o-bs<0 && o+bs>0)
     {
       offset=-o;
-      post("offset %i",o);
+      //      post("offset %i",o);
     }
   else
     post("offset out of range!");
-- 
cgit v1.2.1


From 1a1d31d95b241dff59a11311b70be603742eeb32 Mon Sep 17 00:00:00 2001
From: Tim Blechmann <timblech@users.sourceforge.net>
Date: Tue, 7 Sep 2004 09:32:44 +0000
Subject: *** empty log message ***

svn path=/trunk/externals/tb/; revision=2016
---
 tbext/source/main.cpp    |  3 +-
 tbext/source/sym2num.cpp | 90 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 92 insertions(+), 1 deletion(-)
 create mode 100644 tbext/source/sym2num.cpp

(limited to 'tbext/source')

diff --git a/tbext/source/main.cpp b/tbext/source/main.cpp
index 39ac8b2..0c9285d 100644
--- a/tbext/source/main.cpp
+++ b/tbext/source/main.cpp
@@ -52,7 +52,7 @@ void ttbext_setup()
   post("version "TBEXT_VERSION);
   post("compiled on "__DATE__);
   post("contains: tbroute(~), tbfft1~, tbfft2~, bufline~, fftgrrev~");
-  post("          fftgrsort~, fftgrshuf~, him~\n");
+  post("          fftgrsort~, fftgrshuf~, him~, sym2num\n");
 
   FLEXT_SETUP(tbroute);
   FLEXT_DSP_SETUP(tbsroute);
@@ -65,6 +65,7 @@ void ttbext_setup()
   FLEXT_DSP_SETUP(fftgrshuf);
   FLEXT_DSP_SETUP(fftgrrev);
   FLEXT_DSP_SETUP(him);
+  FLEXT_SETUP(sym2num);
 
 
 
diff --git a/tbext/source/sym2num.cpp b/tbext/source/sym2num.cpp
new file mode 100644
index 0000000..8f7bece
--- /dev/null
+++ b/tbext/source/sym2num.cpp
@@ -0,0 +1,90 @@
+/* Copyright (c) 2004 Tim Blechmann.                                            */
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL     */
+/* WARRANTIES, see the file, "COPYING"  in this distribution.                   */
+/*                                                                              */
+/* sym2num interpretes a symbol as decimal number that is related to the ascii  */
+/* representation.                                                              */
+/*                                                                              */
+/*                                                                              */
+/* sym2num uses the flext C++ layer for Max/MSP and PD externals.               */
+/* get it at http://www.parasitaere-kapazitaeten.de/PD/ext                      */
+/* thanks to Thomas Grill                                                       */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* 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.                       */
+/*                                                                              */
+/* See file LICENSE for further informations on licensing terms.                */
+/*                                                                              */
+/* 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; if not, write to the Free Software                  */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  */
+/*                                                                              */
+/* Based on PureData by Miller Puckette and others.                             */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+/* coded while listening to: Phil Minton & Veryan Weston: Ways                  */
+/*                                                                              */
+/*                                                                              */
+/*                                                                              */
+
+
+
+#include <flext.h>
+
+#include <cstring>
+#include <cmath>
+
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 400)
+#error upgrade your flext version!!!!!!
+#endif
+
+class sym2num: public flext_base
+{
+  FLEXT_HEADER(sym2num,flext_base);
+
+public:
+    sym2num();
+  
+protected:
+    void m_symbol(t_symbol *s);
+
+private:
+
+    FLEXT_CALLBACK_S(m_symbol);
+};
+
+FLEXT_LIB("sym2num",sym2num);
+
+sym2num::sym2num()
+{
+  AddInSymbol();
+  
+  FLEXT_ADDMETHOD(0,m_symbol);
+
+  AddOutFloat();
+}
+
+void sym2num::m_symbol(t_symbol * s)
+{
+    const char* str = GetString(s);
+    
+    int length = strlen(str);
+    
+    int ret(0);
+    while (length--)
+    {
+	ret+=str[length]*pow(2,length);
+    }
+    ToOutFloat(0,ret);
+}
-- 
cgit v1.2.1