From 432472fe416edfb1f5548e7a4998e62869ff41e5 Mon Sep 17 00:00:00 2001 From: Tim Blechmann 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/make-files.txt | 6 +++ tbext/makefile | 114 +++++++++++++++++++++++++++++++++++++++++++++ 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 +++++++++++++++++++++++++++++++++++++ tbext/tbroute.pd | 13 ++++++ tbext/tbroute~.pd | 9 ++++ tbext/tbsig~.pd | 16 +++++++ tbext/tbstrg.pd | 10 ++++ 12 files changed, 733 insertions(+) create mode 100755 tbext/make-files.txt create mode 100644 tbext/makefile 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 create mode 100644 tbext/tbroute.pd create mode 100644 tbext/tbroute~.pd create mode 100644 tbext/tbsig~.pd create mode 100644 tbext/tbstrg.pd (limited to 'tbext') diff --git a/tbext/make-files.txt b/tbext/make-files.txt new file mode 100755 index 0000000..609e57b --- /dev/null +++ b/tbext/make-files.txt @@ -0,0 +1,6 @@ +# all the source files from the package +SRCS= \ + main.cpp tbroute.cpp tbstrg.cpp tbsig~.cpp tbsroute~.cpp tbpow~.cpp + +#HDRS= \ + main.h diff --git a/tbext/makefile b/tbext/makefile new file mode 100644 index 0000000..a9577e7 --- /dev/null +++ b/tbext/makefile @@ -0,0 +1,114 @@ +# Makefile for icc @ linux adapted from Thomas Grill's xsample makefile +# +# usage: +# to build run "make" +# to install (as root), do "make install" +# + + + + +# your c++ compiler (if not g++) + CXX=icc + +# where does the PD installation reside? +PD=/usr/lib/pdsrc/pd + +# where are the PD header files? +# leave it blank if it is a system directory (like /usr/local/include), +# since gcc 3.2 complains about it +PDINC= + +# where do the flext libraries reside? +FLEXTPATH=/usr/lib/flext + +# where should the objects be built? +TARGDIR=./ + +# where should tbext be installed? +# (leave blank to omit installation) +INSTDIR=${PD}/externs + +# where should the tbext help be installed? +# (leave blank to omit installation) +HELPDIR=${PD}/doc/5.reference + +# additional compiler flags +# (check whether they fit to your system!) +# UFLAGS=-mcpu=pentiumpro # gcc 2.95 +# UFLAGS=-mcpu=pentium4 -mmmx -msse2 -msse -mfpmath=sse # gcc 3.2 +UFLAGS= -O3 -xW -tpp7 -ip -ipo #icc + + +FLEXTLIB=$(FLEXTPATH)/flext.a + +# compiler stuff +INCLUDES=$(PDINC) +FLAGS=-DFLEXT_SYS=2 -D__GNUG__ +CFLAGS=${UFLAGS} -O6 -funroll-loops -fmove-all-movables -frerun-loop-opt -finline-functions -fno-rtti -fno-exceptions +LDFLAGS=$(CFLAGS) +LIBS=m + +# ---------------------------------------------- +# the rest can stay untouched +# ---------------------------------------------- + +NAME=tbext +SRCDIR=source + +include make-files.txt + +MAKEFILE=makefile +TARGET=$(TARGDIR)/$(NAME).pd_linux + +# default target +all: $(TARGDIR) $(TARGET) + +$(patsubst %,$(SRCDIR)/%,$(SRCS)): $(patsubst %,$(SRCDIR)/%,$(HDRS)) $(MAKEFILE) $(CONFIG) + touch $(patsubst %,$(SRCDIR)/%,$(SRCS)) + +$(TARGDIR): + -mkdir $(TARGDIR) + +$(TARGDIR)/%.o : $(SRCDIR)/%.cpp + $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(FLEXTPATH)) $< -o $@ + +$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS)) $(FLEXTLIB) + $(CXX) $(LDFLAGS) -shared $^ $(patsubst %,-l%,$(LIBS)) -o $@ + strip --strip-unneeded $@ + chmod 755 $@ + +$(INSTDIR): + -mkdir $(INSTDIR) + +install:: $(INSTDIR) + +install:: $(TARGET) + cp $^ $(INSTDIR) + chown root.root $(patsubst %,$(INSTDIR)/%,$(notdir $^)) + +$(HELPDIR): + -mkdir $(HELPDIR) + +install-help:: $(HELPDIR) + +install-help:: ./pd + chmod 644 $^/*.* + cp $^/*.* $(HELPDIR) + + +.PHONY: clean +clean: + rm -f $(TARGDIR)/*.o $(TARGDIR)/*.il $(TARGET) + + + + + + + + + + + + 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 +#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 + +#include + +#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 + +#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 + +#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 + +#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 + +#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 Date: Sun, 7 Sep 2003 00:42:00 +0000 Subject: *** empty log message *** svn path=/trunk/externals/tb/; revision=934 --- tbext/config-pd-linux.txt | 36 ++++++++++++++ tbext/make-files.txt | 4 +- tbext/makefile | 114 --------------------------------------------- tbext/makefile.pd-linux | 92 ++++++++++++++++++++++++++++++++++++ tbext/source/main.cpp | 5 +- tbext/source/tbroute.cpp | 16 +++---- tbext/source/tbsroute~.cpp | 12 ++--- tbext/source/tbstrg.cpp | 2 +- 8 files changed, 150 insertions(+), 131 deletions(-) create mode 100755 tbext/config-pd-linux.txt delete mode 100644 tbext/makefile create mode 100644 tbext/makefile.pd-linux (limited to 'tbext') diff --git a/tbext/config-pd-linux.txt b/tbext/config-pd-linux.txt new file mode 100755 index 0000000..e1fa248 --- /dev/null +++ b/tbext/config-pd-linux.txt @@ -0,0 +1,36 @@ +# config file for tbext, adapted from Thomas Grill's xsample makefile + +# your c++ compiler (if not g++) + CXX=icc + + +# where does the PD installation reside? +PD=/usr/lib/pd + +# where are the PD header files? +# leave it blank if it is a system directory (like /usr/local/include), +# since gcc 3.2 complains about it +PDINC=/home/tim/pd/devel_0_36/pd/src + +# where do the flext libraries reside? +FLEXTPATH=/usr/lib/flext + +# where should xsample objects be built? +TARGDIR=./pd-linux + +# where should xsample be installed? +# (leave blank to omit installation) +INSTDIR=${PD}/externs + +# where should the xsample help be installed? +# (leave blank to omit installation) +HELPDIR=${PD}/doc/5.reference + +# additional compiler flags +# (check whether they fit to your system!) +UFLAGS=-xW -tpp7 -ip -ipo_obj -g # icc +# UFLAGS=-mcpu=pentium4 -mmmx -msse2 -msse -mfpmath=sse # gcc 3.2 + +# define to link against shared flext library (flext version >= 0.5.0) +FLEXT_SHARED=1 + diff --git a/tbext/make-files.txt b/tbext/make-files.txt index 609e57b..ba3fe55 100755 --- a/tbext/make-files.txt +++ b/tbext/make-files.txt @@ -1,6 +1,8 @@ # all the source files from the package +SRCDIR = source SRCS= \ - main.cpp tbroute.cpp tbstrg.cpp tbsig~.cpp tbsroute~.cpp tbpow~.cpp + main.cpp tbroute.cpp tbsig~.cpp tbsroute~.cpp tbpow~.cpp tbfft1.cpp # tbg7xx.cpp tbstrg.cpp + #HDRS= \ main.h diff --git a/tbext/makefile b/tbext/makefile deleted file mode 100644 index a9577e7..0000000 --- a/tbext/makefile +++ /dev/null @@ -1,114 +0,0 @@ -# Makefile for icc @ linux adapted from Thomas Grill's xsample makefile -# -# usage: -# to build run "make" -# to install (as root), do "make install" -# - - - - -# your c++ compiler (if not g++) - CXX=icc - -# where does the PD installation reside? -PD=/usr/lib/pdsrc/pd - -# where are the PD header files? -# leave it blank if it is a system directory (like /usr/local/include), -# since gcc 3.2 complains about it -PDINC= - -# where do the flext libraries reside? -FLEXTPATH=/usr/lib/flext - -# where should the objects be built? -TARGDIR=./ - -# where should tbext be installed? -# (leave blank to omit installation) -INSTDIR=${PD}/externs - -# where should the tbext help be installed? -# (leave blank to omit installation) -HELPDIR=${PD}/doc/5.reference - -# additional compiler flags -# (check whether they fit to your system!) -# UFLAGS=-mcpu=pentiumpro # gcc 2.95 -# UFLAGS=-mcpu=pentium4 -mmmx -msse2 -msse -mfpmath=sse # gcc 3.2 -UFLAGS= -O3 -xW -tpp7 -ip -ipo #icc - - -FLEXTLIB=$(FLEXTPATH)/flext.a - -# compiler stuff -INCLUDES=$(PDINC) -FLAGS=-DFLEXT_SYS=2 -D__GNUG__ -CFLAGS=${UFLAGS} -O6 -funroll-loops -fmove-all-movables -frerun-loop-opt -finline-functions -fno-rtti -fno-exceptions -LDFLAGS=$(CFLAGS) -LIBS=m - -# ---------------------------------------------- -# the rest can stay untouched -# ---------------------------------------------- - -NAME=tbext -SRCDIR=source - -include make-files.txt - -MAKEFILE=makefile -TARGET=$(TARGDIR)/$(NAME).pd_linux - -# default target -all: $(TARGDIR) $(TARGET) - -$(patsubst %,$(SRCDIR)/%,$(SRCS)): $(patsubst %,$(SRCDIR)/%,$(HDRS)) $(MAKEFILE) $(CONFIG) - touch $(patsubst %,$(SRCDIR)/%,$(SRCS)) - -$(TARGDIR): - -mkdir $(TARGDIR) - -$(TARGDIR)/%.o : $(SRCDIR)/%.cpp - $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(FLEXTPATH)) $< -o $@ - -$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS)) $(FLEXTLIB) - $(CXX) $(LDFLAGS) -shared $^ $(patsubst %,-l%,$(LIBS)) -o $@ - strip --strip-unneeded $@ - chmod 755 $@ - -$(INSTDIR): - -mkdir $(INSTDIR) - -install:: $(INSTDIR) - -install:: $(TARGET) - cp $^ $(INSTDIR) - chown root.root $(patsubst %,$(INSTDIR)/%,$(notdir $^)) - -$(HELPDIR): - -mkdir $(HELPDIR) - -install-help:: $(HELPDIR) - -install-help:: ./pd - chmod 644 $^/*.* - cp $^/*.* $(HELPDIR) - - -.PHONY: clean -clean: - rm -f $(TARGDIR)/*.o $(TARGDIR)/*.il $(TARGET) - - - - - - - - - - - - diff --git a/tbext/makefile.pd-linux b/tbext/makefile.pd-linux new file mode 100644 index 0000000..25b7f3b --- /dev/null +++ b/tbext/makefile.pd-linux @@ -0,0 +1,92 @@ +# xsample - extended sample objects for Max/MSP and pd (pure data) +# Copyright (c) 2001-2003 Thomas Grill (xovo@gmx.net) +# +# Makefile for gcc @ linux +# +# usage: +# to build run "make -f makefile.pd-linux" +# to install (as root), do "make -f makefile.pd-linux install" +# + +CONFIG=config-pd-linux.txt + +include ${CONFIG} + +FLEXTLIB=$(FLEXTPATH)/flext.a + +# compiler stuff +INCLUDES=$(PDINC) +FLAGS=-DFLEXT_SYS=2 +CFLAGS=${UFLAGS} -O3 -I/usr/lib/flext -funroll-loops -fmove-all-movables -frerun-loop-opt -finline-functions -fno-rtti -fno-exceptions +LIBS=m + +ifdef FLEXT_SHARED +CFLAGS+=-DFLEXT_SHARED -DFLEXT_THREADS +LDFLAGS+=-Bdynamic +LINKFLEXT=-lflext #-L/usr/lib/flext/libflext.so +else +LINKFLEXT=$(FLEXTLIB) +endif + +# ---------------------------------------------- +# the rest can stay untouched +# ---------------------------------------------- + +NAME=tbext + +include make-files.txt + +MAKEFILE=makefile.pd-linux +TARGET=$(TARGDIR)/$(NAME).pd_linux + +# default target +all: $(TARGDIR) $(TARGET) + +$(patsubst %,$(SRCDIR)/%,$(SRCS)): $(patsubst %,$(SRCDIR)/%,$(HDRS)) $(MAKEFILE) $(CONFIG) + touch $(patsubst %,$(SRCDIR)/%,$(SRCS)) + +$(TARGDIR): + -mkdir $(TARGDIR) + +$(TARGDIR)/%.o : $(SRCDIR)/%.cpp + $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(FLEXTPATH)) $< -o $@ + +$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS)) + $(CXX) $(LDFLAGS) -shared $^ $(patsubst %,-l%,$(LIBS)) -L$(FLEXTPATH) $(LINKFLEXT) -o $@ + strip --strip-unneeded $@ + chmod 755 $@ + +$(INSTDIR): + -mkdir $(INSTDIR) + +install:: $(INSTDIR) + +install:: $(TARGET) + cp $^ $(INSTDIR) + chown root.root $(patsubst %,$(INSTDIR)/%,$(notdir $^)) + +$(HELPDIR): + -mkdir $(HELPDIR) + +install-help:: $(HELPDIR) + +install-help:: ./pd + chmod 644 $^/*.* + cp $^/*.* $(HELPDIR) + + +.PHONY: clean +clean: + rm -f $(TARGDIR)/*.o $(TARGET) + + + + + + + + + + + + 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 #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-1) && (i 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') 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 + +#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 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') 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 -#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 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') 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 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') 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 7ee4655a5bd0324808cb851a54e0d4cc402c9ada Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sun, 14 Sep 2003 16:45:54 +0000 Subject: *** empty log message *** svn path=/trunk/externals/tb/; revision=964 --- tbext/make-files.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tbext') diff --git a/tbext/make-files.txt b/tbext/make-files.txt index ba3fe55..7816e3c 100755 --- a/tbext/make-files.txt +++ b/tbext/make-files.txt @@ -1,7 +1,7 @@ # all the source files from the package SRCDIR = source SRCS= \ - main.cpp tbroute.cpp tbsig~.cpp tbsroute~.cpp tbpow~.cpp tbfft1.cpp # tbg7xx.cpp tbstrg.cpp + main.cpp tbroute.cpp tbsig~.cpp tbsroute~.cpp tbpow~.cpp tbfft1.cpp tbfft2.cpp #fftbuf.cpp # tbg7xx.cpp tbstrg.cpp #HDRS= \ -- cgit v1.2.1 From e06c0dcda335f4c6009750c9cf9366e7c2e72fe8 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Mon, 15 Sep 2003 04:49:59 +0000 Subject: *** empty log message *** svn path=/trunk/externals/tb/; revision=966 --- tbext/make-files.txt | 2 +- tbext/source/main.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'tbext') diff --git a/tbext/make-files.txt b/tbext/make-files.txt index 7816e3c..846ab54 100755 --- a/tbext/make-files.txt +++ b/tbext/make-files.txt @@ -1,7 +1,7 @@ # all the source files from the package SRCDIR = source SRCS= \ - main.cpp tbroute.cpp tbsig~.cpp tbsroute~.cpp tbpow~.cpp tbfft1.cpp tbfft2.cpp #fftbuf.cpp # tbg7xx.cpp tbstrg.cpp + main.cpp tbroute.cpp tbsig~.cpp tbsroute~.cpp tbpow~.cpp tbfft1.cpp tbfft2.cpp fftbuf.cpp # tbg7xx.cpp tbstrg.cpp #HDRS= \ 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 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') 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 -#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 b2f05c9b120dc9a6578a06053207bd567254ce36 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Thu, 18 Sep 2003 05:05:30 +0000 Subject: some spectral processors have been added svn path=/trunk/externals/tb/; revision=1008 --- tbext/make-files.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tbext') diff --git a/tbext/make-files.txt b/tbext/make-files.txt index 846ab54..273787a 100755 --- a/tbext/make-files.txt +++ b/tbext/make-files.txt @@ -1,7 +1,9 @@ # all the source files from the package SRCDIR = source SRCS= \ - main.cpp tbroute.cpp tbsig~.cpp tbsroute~.cpp tbpow~.cpp tbfft1.cpp tbfft2.cpp fftbuf.cpp # tbg7xx.cpp tbstrg.cpp + main.cpp tbroute.cpp tbsig~.cpp tbsroute~.cpp tbpow~.cpp \ + tbfft1.cpp tbfft2.cpp fftbuf.cpp fftgrsort.cpp fftgrshuf.cpp \ + fftgrrev.cpp # tbg7xx.cpp tbstrg.cpp #HDRS= \ -- cgit v1.2.1 From 81d751e8824f6a9b3975c1da517d1d163a2eace5 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sat, 20 Sep 2003 00:05:08 +0000 Subject: *** empty log message *** svn path=/trunk/externals/tb/; revision=1012 --- tbext/bufline~.pd | 56 ++++++++++ tbext/config-pd-linux.txt | 6 +- tbext/make-files.txt | 6 +- tbext/makefile.pd-linux | 2 +- tbext/reverse.pd | 49 +++++++++ tbext/shuf.pd | 49 +++++++++ tbext/sort.pd | 51 ++++++++++ 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 +++++++++++++++++++++++++++ tbext/tbfft1.pd | 44 ++++++++ tbext/tbfft2.pd | 50 +++++++++ 15 files changed, 1203 insertions(+), 7 deletions(-) create mode 100644 tbext/bufline~.pd create mode 100644 tbext/reverse.pd create mode 100644 tbext/shuf.pd create mode 100644 tbext/sort.pd 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 create mode 100644 tbext/tbfft1.pd create mode 100644 tbext/tbfft2.pd (limited to 'tbext') diff --git a/tbext/bufline~.pd b/tbext/bufline~.pd new file mode 100644 index 0000000..7fd7d59 --- /dev/null +++ b/tbext/bufline~.pd @@ -0,0 +1,56 @@ +#N canvas 221 141 714 505 10; +#N canvas 0 0 450 300 graph1 0; +#X array from1 64 float 1; +#A 0 0 0 0 0 0 0 0.0285714 0.0357143 0.0428571 0.0714286 0.0857143 +0.114286 0.128571 0.142857 0.142857 0.157143 0.171429 0.185714 0.2 +0.214286 0.242857 0.242857 0.242857 0.242857 0.242857 0.214286 0.2 +0.15 0.0714286 0.0714286 1.86265e-09 -0.0142857 -0.0285714 0 0 0 0 +0 0 0 0 -0.0142857 -0.0285714 -0.0428571 -0.0571429 -0.0571429 -0.0571429 +-0.0571429 -0.0571429 -0.0571429 -0.0571429 0.00714286 0.0714286 0.142857 +0.242857 0.314286 0.457143 0 0 0 0 0 0 0; +#X coords 0 1 63 -1 200 140 1; +#X restore 80 20 graph; +#X obj 607 14 block~ 128; +#N canvas 0 0 450 300 graph1 0; +#X array from2 64 float 1; +#A 0 0 0 0 0 0 0 0 0 0 0.0285714 0.0571429 0.0761905 0.0952381 0.114286 +0.12381 0.133333 0.142857 0.2 0.207143 0.228571 0.228571 0.257143 0.257143 +0.257143 0.242857 -0.0142857 0 0 0 0 0 0 0 0 0 -0.471429 -0.628572 +-0.685714 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; +#X coords 0 1 63 -1 200 140 1; +#X restore 335 23 graph; +#N canvas 0 0 450 300 graph1 0; +#X array to 64 float 1; +#A 0 0 0 0 0 0 0 0.00682475 0.00853045 0.0102368 0.0388103 0.0639679 +0.0852809 0.10321 0.121109 0.128353 0.139015 0.149682 0.196567 0.205455 +0.225179 0.232002 0.253755 0.253755 0.253755 0.242854 0.0403107 0.047774 +0.0358276 0.0170609 0.0170609 4.44924e-10 -0.00341237 -0.00682475 0 +0 -0.35882 -0.478471 -0.521873 0 0 0 -0.00341233 -0.00682466 -0.0102368 +-0.0136493 -0.0136493 -0.0136493 -0.0136493 -0.0136493 -0.0136493 -0.0136493 +0.00170617 0.0170609 0.0341218 0.0580107 0.0750683 0.109195 0 0 0 0 +0 0 0; +#X coords 0 1 63 -1 200 140 1; +#X restore 456 301 graph; +#X obj 144 412 tabwrite~ to; +#X obj 208 373 metro 50; +#X obj 208 349 loadbang; +#X obj 83 280 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 212 269 set from1; +#X msg 212 292 set from2; +#X msg 133 271 line 5000; +#X obj 63 385 print~; +#X obj 26 332 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 88 321 bufline~ 128; +#X msg 119 239 line 400; +#X connect 5 0 4 0; +#X connect 6 0 5 0; +#X connect 7 0 13 0; +#X connect 8 0 13 0; +#X connect 9 0 13 0; +#X connect 10 0 13 0; +#X connect 12 0 11 0; +#X connect 13 0 11 0; +#X connect 13 0 4 0; +#X connect 14 0 13 0; diff --git a/tbext/config-pd-linux.txt b/tbext/config-pd-linux.txt index e1fa248..495aad9 100755 --- a/tbext/config-pd-linux.txt +++ b/tbext/config-pd-linux.txt @@ -1,7 +1,7 @@ # config file for tbext, adapted from Thomas Grill's xsample makefile # your c++ compiler (if not g++) - CXX=icc +# CXX=icc # where does the PD installation reside? @@ -10,7 +10,7 @@ PD=/usr/lib/pd # where are the PD header files? # leave it blank if it is a system directory (like /usr/local/include), # since gcc 3.2 complains about it -PDINC=/home/tim/pd/devel_0_36/pd/src +PDINC=/home/tim/pd/pd-0.37-0/src # where do the flext libraries reside? FLEXTPATH=/usr/lib/flext @@ -28,7 +28,7 @@ HELPDIR=${PD}/doc/5.reference # additional compiler flags # (check whether they fit to your system!) -UFLAGS=-xW -tpp7 -ip -ipo_obj -g # icc +#UFLAGS=-xW -tpp7 -ip -ipo_obj -g # icc # UFLAGS=-mcpu=pentium4 -mmmx -msse2 -msse -mfpmath=sse # gcc 3.2 # define to link against shared flext library (flext version >= 0.5.0) diff --git a/tbext/make-files.txt b/tbext/make-files.txt index 273787a..e299154 100755 --- a/tbext/make-files.txt +++ b/tbext/make-files.txt @@ -1,9 +1,9 @@ # all the source files from the package SRCDIR = source SRCS= \ - main.cpp tbroute.cpp tbsig~.cpp tbsroute~.cpp tbpow~.cpp \ - tbfft1.cpp tbfft2.cpp fftbuf.cpp fftgrsort.cpp fftgrshuf.cpp \ - fftgrrev.cpp # tbg7xx.cpp tbstrg.cpp + main.cpp tbroute.cpp tbsig~.cpp tbsroute~.cpp tbssel~.cpp \ + tbpow~.cpp tbfft1.cpp tbfft2.cpp fftbuf.cpp fftgrsort.cpp \ + fftgrshuf.cpp fftgrrev.cpp # tbg7xx.cpp tbstrg.cpp #HDRS= \ diff --git a/tbext/makefile.pd-linux b/tbext/makefile.pd-linux index 25b7f3b..7948a19 100644 --- a/tbext/makefile.pd-linux +++ b/tbext/makefile.pd-linux @@ -17,7 +17,7 @@ FLEXTLIB=$(FLEXTPATH)/flext.a # compiler stuff INCLUDES=$(PDINC) FLAGS=-DFLEXT_SYS=2 -CFLAGS=${UFLAGS} -O3 -I/usr/lib/flext -funroll-loops -fmove-all-movables -frerun-loop-opt -finline-functions -fno-rtti -fno-exceptions +CFLAGS=${UFLAGS} -O3 -I/home/tim/pd/externals/grill/flext/source -funroll-loops -fmove-all-movables -frerun-loop-opt -finline-functions -fno-rtti -fno-exceptions LIBS=m ifdef FLEXT_SHARED diff --git a/tbext/reverse.pd b/tbext/reverse.pd new file mode 100644 index 0000000..34ac6d4 --- /dev/null +++ b/tbext/reverse.pd @@ -0,0 +1,49 @@ +#N canvas 245 106 453 369 10; +#N canvas 0 0 450 300 graph2 0; +#X array array1 63 float 1; +#A 0 0 0 0 0 0 0 0 0 -0.0142857 -0.0428571 -0.0714286 -0.0857143 -0.128571 +-0.214286 -0.285714 -0.357143 -0.4 -0.428571 -0.428571 -0.428571 -0.428571 +-0.428571 -0.414286 -0.414286 -0.4 -0.371429 -0.328571 -0.328571 -0.314286 +-0.3 -0.271429 -0.242857 -0.228571 -0.214286 -0.157143 -0.128571 -0.0714286 +-0.0571429 -0.0285715 0.0571428 0.1 0.128571 0.135714 0.142857 0.171429 +0.214286 0.228571 0.242857 0.271429 0.271429 0.3 0.3 -0.0571429 -0.0857143 +0.0214285 0.0285714 0.0571428 0.0714285 0.0714285 0.057143 0.0428573 +0.0428573 0; +#X coords 0 1 62 -1 200 140 1; +#X restore -67 3 graph; +#N canvas 0 0 450 300 graph3 0; +#X array array2 64 float 1; +#A 0 0 0 0 0 0 0 0 0 -0.0142857 -0.0428571 -0.0714286 -0.0857143 -0.128571 +-0.214286 -0.285714 -0.357143 -0.4 -0.428571 -0.428571 -0.428571 -0.428571 +-0.414286 -0.428571 -0.4 -0.414286 -0.328571 -0.371429 -0.314286 -0.328571 +-0.271429 -0.3 -0.228571 -0.242857 -0.157143 -0.214286 -0.0714286 -0.128571 +-0.0285715 -0.0571429 0.1 0.0571428 0.135714 0.128571 0.3 0.3 0.271429 +0.271429 0.242857 0.228571 0.214286 0.171429 0.142857 0.0714285 0.0714285 +0.057143 0.0571428 0.0428573 0.0428573 0.0285714 0.0214285 0 0 0 -0.0571429 +; +#X coords 0 1 63 -1 200 140 1; +#X restore 159 1 graph; +#X obj 30 234 tabplay~ array1; +#X obj -28 270 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 30 323 tabwrite~ array2; +#X floatatom 229 240 5 0 0 0 - - -; +#X obj -68 307 metro 50; +#X obj -81 275 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 267 183 block~ 128; +#X msg 229 259 grains \$1; +#X obj 209 291 hsl 128 15 -64 64 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 0 1; +#X msg 206 315 offset \$1; +#X obj 29 276 fftgrrev~ 128; +#X connect 2 0 12 0; +#X connect 3 0 2 0; +#X connect 3 0 4 0; +#X connect 5 0 9 0; +#X connect 6 0 3 0; +#X connect 7 0 6 0; +#X connect 9 0 12 0; +#X connect 10 0 11 0; +#X connect 11 0 12 0; +#X connect 12 0 4 0; diff --git a/tbext/shuf.pd b/tbext/shuf.pd new file mode 100644 index 0000000..1144ffe --- /dev/null +++ b/tbext/shuf.pd @@ -0,0 +1,49 @@ +#N canvas 245 106 453 369 10; +#N canvas 0 0 450 300 graph2 0; +#X array array1 63 float 1; +#A 0 0 0 0 0 0 0 0 0 -0.0142857 -0.0428571 -0.0714286 -0.0857143 -0.128571 +-0.214286 -0.285714 -0.357143 -0.4 -0.428571 -0.428571 -0.428571 -0.428571 +-0.428571 -0.414286 -0.414286 -0.4 -0.371429 -0.328571 -0.328571 -0.314286 +-0.3 -0.271429 -0.242857 -0.228571 -0.214286 -0.157143 -0.128571 -0.0714286 +-0.0571429 -0.0285715 0.0571428 0.1 0.128571 0.135714 0.142857 0.171429 +0.214286 0.228571 0.242857 0.271429 0.271429 0.3 0.3 -0.0571429 -0.0857143 +0.0214285 0.0285714 0.0571428 0.0714285 0.0714285 0.057143 0.0428573 +0.0428573 0; +#X coords 0 1 62 -1 200 140 1; +#X restore -67 3 graph; +#N canvas 0 0 450 300 graph3 0; +#X array array2 64 float 1; +#A 0 0 0.0214285 -0.371429 -0.0571429 -0.0857143 0.128571 0.0571428 +0.0285714 0 0.0714285 -0.314286 0.0571428 -0.128571 -0.428571 -0.214286 +0.1 -0.328571 -0.271429 -0.428571 0 0.142857 -0.157143 0.228571 0 -0.128571 +-0.428571 0 -0.228571 0 0.0428573 0 -0.0714286 -0.428571 -0.414286 +0.271429 0.057143 -0.328571 0.0714285 -0.0285715 -0.428571 -0.0142857 +-0.242857 -0.285714 -0.0714286 0.242857 -0.4 -0.3 -0.0857143 0.3 0.214286 +-0.0428571 -0.414286 0.135714 0.3 -0.214286 -0.357143 -0.0571429 0 +0 0.171429 0 0.0428573 0.271429 -0.4; +#X coords 0 1 63 -1 200 140 1; +#X restore 159 1 graph; +#X obj 30 234 tabplay~ array1; +#X obj -28 270 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 30 323 tabwrite~ array2; +#X floatatom 229 240 5 0 0 0 - - -; +#X obj -68 307 metro 50; +#X obj -81 275 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 267 183 block~ 128; +#X msg 229 259 grains \$1; +#X obj 209 291 hsl 128 15 -64 64 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 0 1; +#X msg 206 315 offset \$1; +#X obj 29 276 fftgrshuf~ 128; +#X connect 2 0 12 0; +#X connect 3 0 2 0; +#X connect 3 0 4 0; +#X connect 5 0 9 0; +#X connect 6 0 3 0; +#X connect 7 0 6 0; +#X connect 9 0 12 0; +#X connect 10 0 11 0; +#X connect 11 0 12 0; +#X connect 12 0 4 0; diff --git a/tbext/sort.pd b/tbext/sort.pd new file mode 100644 index 0000000..482cf31 --- /dev/null +++ b/tbext/sort.pd @@ -0,0 +1,51 @@ +#N canvas 245 106 453 369 10; +#N canvas 0 0 450 300 graph2 0; +#X array array1 63 float 1; +#A 0 0 0 0 0 0 0 0 0 -0.0142857 -0.0428571 -0.0714286 -0.0857143 -0.128571 +-0.214286 -0.285714 -0.357143 -0.4 -0.428571 -0.428571 -0.428571 -0.428571 +-0.428571 -0.414286 -0.414286 -0.4 -0.371429 -0.328571 -0.328571 -0.314286 +-0.3 -0.271429 -0.242857 -0.228571 -0.214286 -0.157143 -0.128571 -0.0714286 +-0.0571429 -0.0285715 0.0571428 0.1 0.128571 0.135714 0.142857 0.171429 +0.214286 0.228571 0.242857 0.271429 0.271429 0.3 0.3 -0.0571429 -0.0857143 +0.0214285 0.0285714 0.0571428 0.0714285 0.0714285 0.057143 0.0428573 +0.0428573 0; +#X coords 0 1 62 -1 200 140 1; +#X restore -67 3 graph; +#N canvas 0 0 450 300 graph3 0; +#X array array2 64 float 1; +#A 0 0 0 0 0 0 0 0 0 -0.0142857 -0.0428571 -0.0714286 -0.0857143 -0.128571 +-0.214286 -0.285714 -0.357143 -0.4 -0.428571 -0.428571 -0.428571 -0.428571 +-0.414286 -0.428571 -0.4 -0.414286 -0.328571 -0.371429 -0.314286 -0.328571 +-0.271429 -0.3 -0.228571 -0.242857 -0.157143 -0.214286 -0.0714286 -0.128571 +-0.0285715 -0.0571429 0.1 0.0571428 0.135714 0.128571 0.3 0.3 0.271429 +0.271429 0.242857 0.228571 0.214286 0.171429 0.142857 0.0714285 0.0714285 +0.057143 0.0571428 0.0428573 0.0428573 0.0285714 0.0214285 0 0 0 -0.0571429 +; +#X coords 0 1 63 -1 200 140 1; +#X restore 159 1 graph; +#X obj 30 234 tabplay~ array1; +#X obj -28 270 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 30 323 tabwrite~ array2; +#X floatatom 229 240 5 0 0 0 - - -; +#X obj -68 307 metro 50; +#X obj -81 275 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 267 183 block~ 128; +#X msg 229 259 grains \$1; +#X obj 209 291 hsl 128 15 -64 64 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 6300 1; +#X msg 206 315 offset \$1; +#X obj 29 276 fftgrsort~ 128; +#X msg 168 203 reverse; +#X connect 2 0 12 0; +#X connect 3 0 2 0; +#X connect 3 0 4 0; +#X connect 5 0 9 0; +#X connect 6 0 3 0; +#X connect 7 0 6 0; +#X connect 9 0 12 0; +#X connect 10 0 11 0; +#X connect 11 0 12 0; +#X connect 12 0 4 0; +#X connect 13 0 12 0; 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 + +#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 + 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 +/*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 +#include + +#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 +#include + +#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 +#include + +#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 + +#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 (nn0) + { + width=n0-center; + return; + } + if (center-w<0) + { + width=center; + return; + } + + width=w; +} + + diff --git a/tbext/tbfft1.pd b/tbext/tbfft1.pd new file mode 100644 index 0000000..c9ced88 --- /dev/null +++ b/tbext/tbfft1.pd @@ -0,0 +1,44 @@ +#N canvas 245 106 453 369 10; +#N canvas 0 0 450 300 graph2 0; +#X array array1 63 float 1; +#A 0 0 0 0 0 0 0 0 0 0 -1 -1.24286 -1.45714 -1.61429 -1.7 -1.82857 +-1.88571 -1.92857 -2.04286 -2.17143 -2.18571 -2.2 -2.21429 -2.27143 +-2.28571 -2.28571 -2.3 -2.31429 -2.31429 -2.32857 -0.528571 -0.528571 +-0.542857 -0.514286 -0.485714 -0.4 -0.357143 -0.314286 -0.185714 -0.114286 +-0.0142857 0.185714 0.214286 0.314286 0.342857 0.4 0.5 0.514286 0.557143 +0.571429 0.628572 0.642857 0.671429 1.14286 0.428572 0.3 0.228572 0.157143 +0.114286 0.057143 0.057143 0.0428573 0.0428573 0; +#X coords 0 1 62 -1 200 140 1; +#X restore -67 3 graph; +#N canvas 0 0 450 300 graph3 0; +#X array array2 64 float 1; +#A 0 0 0 0 0 0 0 0 0 0 -0.4 -0.585 -0.685714 -0.767857 -0.824286 -0.869286 +-0.92 -0.945 -0.154551 -0.309103 -0.445624 -0.567631 -0.678947 -0.786968 +-0.876442 -0.953638 -1.02425 -1.04246 -0.02064 -0.031224 -0.04128 -0.0648 +-0.087 -0.147857 -0.191429 -0.4 -0.357143 -0.314286 -0.185714 -0.114286 +-0.0142857 0.185714 0.214286 0.314286 0.342857 0.4 0.5 0.514286 0.557143 +0.571429 0.628572 0.642857 0.671429 1.14286 0.428572 0.3 0.228572 0.157143 +0.114286 0.057143 0.057143 0.0428573 0.0428573 0 0; +#X coords 0 1 63 -1 200 140 1; +#X restore 159 1 graph; +#X obj -20 153 tabplay~ array1; +#X obj -78 189 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj -20 242 tabwrite~ array2; +#X obj -21 195 tbfft1~; +#X obj 164 152 hsl 128 15 -0.1 0.1 0 0 empty empty empty -2 -6 0 8 +-262144 -1 -1 0 1; +#X obj 150 216 hsl 128 15 0 44100 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 1400 1; +#X msg 161 176 factor \$1; +#X msg 147 235 center \$1; +#X floatatom 272 188 5 0 0 0 - - -; +#X connect 2 0 5 0; +#X connect 3 0 2 0; +#X connect 3 0 4 0; +#X connect 5 0 4 0; +#X connect 6 0 8 0; +#X connect 6 0 10 0; +#X connect 7 0 9 0; +#X connect 8 0 5 0; +#X connect 9 0 5 0; diff --git a/tbext/tbfft2.pd b/tbext/tbfft2.pd new file mode 100644 index 0000000..044b4aa --- /dev/null +++ b/tbext/tbfft2.pd @@ -0,0 +1,50 @@ +#N canvas 245 106 453 369 10; +#N canvas 0 0 450 300 graph2 0; +#X array array1 63 float 1; +#A 0 0 0 0 0 0 0 0.0571429 0.142857 0.171429 0.228571 0.314286 0.385714 +0.457143 0.542857 0.628572 0.714286 0.757143 0.742857 0.714286 0.671429 +0.628571 0.6 0 0 0 0.00714286 0.0142857 0.0142857 0.0142857 0.0142857 +0.0142857 0.0142857 0.0142857 0.0142857 0.0142857 0.0142857 0.0142857 +0.0142857 0.0142857 0.0142857 0.0142857 0.0142857 0.0285714 0.0714286 +0.121429 0.171429 0.192857 0.214286 0.257143 0.328571 0.342857 0.385714 +0.414286 0.442857 1.86265e-09 0.0142857 0.0142857 0.0142857 0.0142857 +0.0142857 0.0142857 0.0142857 0.0142857; +#X coords 0 1 62 -1 200 140 1; +#X restore -67 3 graph; +#N canvas 444 250 450 300 graph3 0; +#X array array2 64 float 1; +#A 0 0 0 0 0 0 0 0.0571429 0.142857 0.171429 0.228571 0.314286 0.385714 +0.457143 0.542857 0.628572 0.714286 0.757143 0.742857 0.714286 0.671429 +0.628571 0.6 0 0 0 0.00714286 0.0142857 0.0142857 0.0142857 0.0142857 +0.0142857 0.0142857 0.0142857 0.0142857 0.0142857 0.0142857 0.0142857 +0.0142857 0.0142857 0.0142857 0.0142857 0.0142857 0.0285714 0.0714286 +0 0 0.0142857 0.0142857 0.0142857 0.0142857 0.0142857 0.0142857 0.0142857 +0.0142857 1.86265e-09 0.442857 0.414286 0.385714 0.342857 0.328571 +0.257143 0.214286 0.192857 0.171429; +#X coords 0 1 63 -1 200 140 1; +#X restore 148 4 graph; +#X obj -20 153 tabplay~ array1; +#X obj -78 189 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj -20 242 tabwrite~ array2; +#X obj 164 152 hsl 128 15 0 64 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 2800 1; +#X obj 150 216 hsl 128 15 0 64 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 10900 1; +#X msg 147 235 center \$1; +#X floatatom 272 188 5 0 0 0 - - -; +#X obj -21 195 tbfft2~; +#X msg 161 176 width \$1; +#X obj -20 329 print~; +#X obj 140 308 block~ 128; +#X connect 2 0 9 0; +#X connect 3 0 2 0; +#X connect 3 0 4 0; +#X connect 3 0 11 0; +#X connect 5 0 10 0; +#X connect 5 0 8 0; +#X connect 6 0 7 0; +#X connect 7 0 9 0; +#X connect 9 0 4 0; +#X connect 9 0 11 0; +#X connect 10 0 9 0; -- cgit v1.2.1 From 80e47e2a02fc3cb39baeea8db56ef362b86c6e04 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sat, 20 Sep 2003 15:37:44 +0000 Subject: *** empty log message *** svn path=/trunk/externals/tb/; revision=1013 --- tbext/make-files.txt | 2 +- tbext/source/main.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'tbext') diff --git a/tbext/make-files.txt b/tbext/make-files.txt index e299154..b3a83b5 100755 --- a/tbext/make-files.txt +++ b/tbext/make-files.txt @@ -1,7 +1,7 @@ # all the source files from the package SRCDIR = source SRCS= \ - main.cpp tbroute.cpp tbsig~.cpp tbsroute~.cpp tbssel~.cpp \ + main.cpp tbroute.cpp tbsig~.cpp tbsroute~.cpp \ tbpow~.cpp tbfft1.cpp tbfft2.cpp fftbuf.cpp fftgrsort.cpp \ fftgrshuf.cpp fftgrrev.cpp # tbg7xx.cpp tbstrg.cpp 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 Date: Sat, 20 Sep 2003 15:54:40 +0000 Subject: *** empty log message *** svn path=/trunk/externals/tb/; revision=1014 --- tbext/config-pd-linux.txt | 2 +- tbext/makefile.pd-linux | 4 +- tbext/source/tbssel~.cpp | 100 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 tbext/source/tbssel~.cpp (limited to 'tbext') diff --git a/tbext/config-pd-linux.txt b/tbext/config-pd-linux.txt index 495aad9..7c9fbde 100755 --- a/tbext/config-pd-linux.txt +++ b/tbext/config-pd-linux.txt @@ -32,5 +32,5 @@ HELPDIR=${PD}/doc/5.reference # UFLAGS=-mcpu=pentium4 -mmmx -msse2 -msse -mfpmath=sse # gcc 3.2 # define to link against shared flext library (flext version >= 0.5.0) -FLEXT_SHARED=1 +#FLEXT_SHARED=1 diff --git a/tbext/makefile.pd-linux b/tbext/makefile.pd-linux index 7948a19..56fbc17 100644 --- a/tbext/makefile.pd-linux +++ b/tbext/makefile.pd-linux @@ -17,11 +17,11 @@ FLEXTLIB=$(FLEXTPATH)/flext.a # compiler stuff INCLUDES=$(PDINC) FLAGS=-DFLEXT_SYS=2 -CFLAGS=${UFLAGS} -O3 -I/home/tim/pd/externals/grill/flext/source -funroll-loops -fmove-all-movables -frerun-loop-opt -finline-functions -fno-rtti -fno-exceptions +CFLAGS=${UFLAGS} -O3 -I/home/tim/pd/externals/grill/flext/source -funroll-loops -fmove-all-movables -frerun-loop-opt -finline-functions -fno-rtti -fno-exceptions -DFLEXT_THREADS LIBS=m ifdef FLEXT_SHARED -CFLAGS+=-DFLEXT_SHARED -DFLEXT_THREADS +CFLAGS+=-DFLEXT_SHARED LDFLAGS+=-Bdynamic LINKFLEXT=-lflext #-L/usr/lib/flext/libflext.so else 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 + +#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 Date: Wed, 28 Jan 2004 11:09:13 +0000 Subject: *** empty log message *** svn path=/trunk/externals/tb/; revision=1298 --- tbext/bufline~.pd | 315 ++++++++++++++++++++++++++++++++++++++++++---- tbext/config-pd-linux.txt | 9 +- tbext/make-files.txt | 2 +- tbext/makefile.pd-linux | 4 +- tbext/source/fftbuf.cpp | 38 ++++-- tbext/source/main.cpp | 5 +- tbext/source/tbfft2.cpp | 2 +- 7 files changed, 328 insertions(+), 47 deletions(-) (limited to 'tbext') diff --git a/tbext/bufline~.pd b/tbext/bufline~.pd index 7fd7d59..66d35c0 100644 --- a/tbext/bufline~.pd +++ b/tbext/bufline~.pd @@ -1,35 +1,294 @@ #N canvas 221 141 714 505 10; #N canvas 0 0 450 300 graph1 0; -#X array from1 64 float 1; +#X array from1 1024 float 1; #A 0 0 0 0 0 0 0 0.0285714 0.0357143 0.0428571 0.0714286 0.0857143 0.114286 0.128571 0.142857 0.142857 0.157143 0.171429 0.185714 0.2 0.214286 0.242857 0.242857 0.242857 0.242857 0.242857 0.214286 0.2 0.15 0.0714286 0.0714286 1.86265e-09 -0.0142857 -0.0285714 0 0 0 0 0 0 0 0 -0.0142857 -0.0285714 -0.0428571 -0.0571429 -0.0571429 -0.0571429 -0.0571429 -0.0571429 -0.0571429 -0.0571429 0.00714286 0.0714286 0.142857 -0.242857 0.314286 0.457143 0 0 0 0 0 0 0; -#X coords 0 1 63 -1 200 140 1; +0.242857 0.314286 0.457143 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.0142857 -0.0190476 +-0.0238095 -0.0285714 -0.0333333 -0.0380952 -0.0428571 -0.0476191 -0.052381 +-0.0571429 -0.0619048 -0.0666667 -0.0714286 -0.0761905 -0.0809524 -0.0857141 +-0.0884919 -0.0912697 -0.0940475 -0.0968252 -0.099603 -0.102381 -0.105159 +-0.107936 -0.110714 -0.113492 -0.11627 -0.119047 -0.121825 -0.124603 +-0.127381 -0.130159 -0.132936 -0.135714 -0.138492 -0.14127 -0.144048 +-0.146825 -0.149603 -0.152381 -0.155159 -0.157936 -0.160714 -0.163492 +-0.16627 -0.169048 -0.171825 -0.174603 -0.177381 -0.180159 -0.182937 +-0.185714 -0.189796 -0.193877 -0.197959 -0.202041 -0.206122 -0.210204 +-0.214286 -0.218367 -0.222449 -0.226531 -0.230612 -0.234694 -0.238775 +-0.242857 -0.246939 -0.25102 -0.255102 -0.259184 -0.263265 -0.267347 +-0.271429 -0.27551 -0.279592 -0.283673 -0.287755 -0.291837 -0.295918 +-0.3 -0.304082 -0.308163 -0.312245 -0.316327 -0.320408 -0.32449 -0.328571 +-0.330494 -0.332417 -0.33434 -0.336263 -0.338186 -0.34011 -0.342033 +-0.343956 -0.345879 -0.347802 -0.349725 -0.351648 -0.353571 -0.355494 +-0.357417 -0.35934 -0.361263 -0.363187 -0.36511 -0.367033 -0.368956 +-0.370879 -0.372802 -0.374725 -0.376648 -0.378571 -0.380494 -0.382417 +-0.38434 -0.386264 -0.388187 -0.39011 -0.392033 -0.393956 -0.395879 +-0.397802 -0.399725 -0.401648 -0.403571 -0.405494 -0.407418 -0.409341 +-0.411264 -0.413187 -0.41511 -0.417033 -0.418956 -0.420879 -0.422802 +-0.424725 -0.426648 -0.428572 -0.432056 -0.435541 -0.439025 -0.442509 +-0.445993 -0.449478 -0.452962 -0.456446 -0.459931 -0.463415 -0.466899 +-0.470384 -0.473868 -0.477352 -0.480837 -0.484321 -0.487805 -0.491289 +-0.494774 -0.498258 -0.501742 -0.505227 -0.508711 -0.512195 -0.51568 +-0.519164 -0.522648 -0.526133 -0.529617 -0.533101 -0.536586 -0.54007 +-0.543554 -0.547038 -0.550523 -0.554007 -0.557491 -0.560976 -0.56446 +-0.567944 -0.571429 -0.573669 -0.57591 -0.578151 -0.580392 -0.582633 +-0.584874 -0.587115 -0.589356 -0.591597 -0.593838 -0.596078 -0.598319 +-0.60056 -0.602801 -0.605042 -0.607283 -0.609524 -0.611765 -0.614006 +-0.616247 -0.618487 -0.620728 -0.622969 -0.62521 -0.627451 -0.629692 +-0.631933 -0.634174 -0.636415 -0.638655 -0.640896 -0.643137 -0.645378 +-0.647619 -0.64986 -0.652101 -0.654342 -0.656583 -0.658824 -0.661064 +-0.663305 -0.665546 -0.667787 -0.670028 -0.672269 -0.67451 -0.676751 +-0.678992 -0.681233 -0.683473 -0.685714 -0.687143 -0.688571 -0.69 -0.691428 +-0.692857 -0.694286 -0.695714 -0.697143 -0.698571 -0.7 -0.702286 -0.704571 +-0.706857 -0.709143 -0.711429 -0.713714 -0.716 -0.718286 -0.720571 +-0.722857 -0.725143 -0.727429 -0.729714 -0.732 -0.734286 -0.736571 +-0.738857 -0.741143 -0.743429 -0.745714 -0.748 -0.750286 -0.752571 +-0.754857 -0.757143 -0.757143 -0.757143 -0.757143 -0.757143 -0.757143 +-0.757143 -0.758571 -0.76 -0.761428 -0.762857 -0.764286 -0.765714 -0.767143 +-0.768571 -0.77 -0.771429 -0.771429 -0.771429 -0.771429 -0.771429 -0.771429 +-0.774286 -0.777143 -0.78 -0.782857 -0.8 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; +#A 1000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; +#X coords 0 1 1023 -1 200 140 1; #X restore 80 20 graph; -#X obj 607 14 block~ 128; #N canvas 0 0 450 300 graph1 0; -#X array from2 64 float 1; +#X array from2 1024 float 1; #A 0 0 0 0 0 0 0 0 0 0 0.0285714 0.0571429 0.0761905 0.0952381 0.114286 0.12381 0.133333 0.142857 0.2 0.207143 0.228571 0.228571 0.257143 0.257143 0.257143 0.242857 -0.0142857 0 0 0 0 0 0 0 0 0 -0.471429 -0.628572 --0.685714 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; -#X coords 0 1 63 -1 200 140 1; +-0.685714 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 1.86265e-10 0.00428571 0.00857143 0.0128571 +0.0171429 0.0214286 0.0257143 0.03 0.0342857 0.0385714 0.0428572 0.0457143 +0.0485715 0.0514286 0.0542857 0.0571429 0.06 0.0628572 0.0657143 0.0685714 +0.0714286 0.0742857 0.0771429 0.08 0.0828571 0.0857144 0.0884794 0.0912443 +0.0940093 0.0967743 0.0995393 0.102304 0.105069 0.107834 0.110599 0.113364 +0.116129 0.118894 0.121659 0.124424 0.127189 0.129954 0.132719 0.135484 +0.138249 0.141014 0.143779 0.146544 0.149309 0.152074 0.154839 0.157604 +0.160369 0.163134 0.165899 0.168664 0.171428 0.174286 0.177143 0.18 +0.182857 0.185714 0.188571 0.191429 0.194286 0.197143 0.2 0.202857 +0.205714 0.208571 0.211429 0.214286 0.216527 0.218768 0.221008 0.223249 +0.22549 0.227731 0.229972 0.232213 0.234454 0.236695 0.238936 0.241176 +0.243417 0.245658 0.247899 0.25014 0.252381 0.254622 0.256863 0.259104 +0.261345 0.263585 0.265826 0.268067 0.270308 0.272549 0.27479 0.277031 +0.279272 0.281513 0.283754 0.285994 0.288235 0.290476 0.292717 0.294958 +0.297199 0.29944 0.301681 0.303922 0.306162 0.308403 0.310644 0.312885 +0.315126 0.317367 0.319608 0.321849 0.32409 0.326331 0.328571 0.330952 +0.333333 0.335714 0.338095 0.340476 0.342857 0.345238 0.347619 0.35 +0.352381 0.354762 0.357143 0.359523 0.361904 0.364285 0.366666 0.369047 +0.371428 0.373809 0.37619 0.378571 0.380952 0.383333 0.385714 0.388095 +0.390476 0.392857 0.395238 0.397619 0.4 0.402381 0.404762 0.407143 +0.409524 0.411905 0.414286 0.416484 0.418681 0.420879 0.423077 0.425275 +0.427473 0.42967 0.431868 0.434066 0.436264 0.438462 0.440659 0.442857 +0.445055 0.447253 0.449451 0.451648 0.453846 0.456044 0.458242 0.46044 +0.462637 0.464835 0.467033 0.469231 0.471429 0.472 0.472571 0.473143 +0.473714 0.474286 0.474857 0.475429 0.476 0.476571 0.477143 0.477714 +0.478286 0.478857 0.479429 0.48 0.480571 0.481143 0.481714 0.482286 +0.482857 0.483429 0.484 0.484571 0.485143 0.485715 0.486412 0.487108 +0.487805 0.488502 0.489199 0.489896 0.490593 0.49129 0.491987 0.492683 +0.49338 0.494077 0.494774 0.495471 0.496168 0.496865 0.497562 0.498258 +0.498955 0.499652 0.500349 0.501046 0.501743 0.502439 0.503136 0.503833 +0.50453 0.505227 0.505924 0.506621 0.507317 0.508014 0.508711 0.509408 +0.510105 0.510802 0.511498 0.512195 0.512892 0.513589 0.514287 0.515385 +0.516484 0.517583 0.518682 0.519781 0.52088 0.521979 0.523077 0.524176 +0.525275 0.526374 0.527473 0.528572 0.529671 0.53077 0.531868 0.532967 +0.534066 0.535165 0.536264 0.537363 0.538462 0.539561 0.540659 0.541758 +0.542857 0.544 0.545143 0.546286 0.547429 0.548571 0.549714 0.550857 +0.552 0.553143 0.554286 0.555429 0.556571 0.557714 0.558857 0.56 0.561143 +0.562286 0.563429 0.564571 0.565714 0.566857 0.568 0.569143 0.570286 +0.571429 0.571429 0.571429 0.571429 0.571429 0.571429 0.571429 0.571429 +0.571429 0.571429 0.571429 0.571429 0.571429 0.571429 0.571429 0.571429 +0.571428 0.570476 0.569524 0.568571 0.567619 0.566666 0.565714 0.564762 +0.563809 0.562857 0.561905 0.560952 0.56 0.559048 0.558095 0.557143 +0.555714 0.554286 0.552857 0.551429 0.55 0.548571 0.547143 0.545714 +0.544286 0.542857 0.54 0.537143 0.534286 0.531429 0.528571 0.525714 +0.522857 0.52 0.517143 0.514286 0.511429 0.508571 0.505714 0.502857 +0.5 0.498701 0.497403 0.496104 0.494805 0.493506 0.492208 0.490909 +0.48961 0.488312 0.487013 0.485714 0.483429 0.481143 0.478857 0.476572 +0.474286 0.472 0.469714 0.467429 0.465143 0.462857 0.460571 0.458286 +0.456 0.453714 0.451429 0.449143 0.446857 0.444571 0.442286 0.44 0.437714 +0.435429 0.433143 0.430857 0.428571 0.425893 0.423214 0.420536 0.417857 +0.415179 0.4125 0.409821 0.407143 0.404464 0.401786 0.399107 0.396429 +0.39375 0.391071 0.388393 0.385714 0.382143 0.378571 0.375 0.371428 +0.367857 0.364286 0.360714 0.357143 0.353571 0.35 0.346428 0.342857 +0.339286 0.335714 0.332143 0.328571 0.325 0.321429 0.317857 0.314286 +0.31 0.305714 0.301429 0.297143 0.292857 0.288571 0.284286 0.28 0.275714 +0.271429 0.270046 0.268664 0.267281 0.265899 0.264516 0.263134 0.261751 +0.260369 0.258986 0.257604 0.256221 0.254839 0.253456 0.252074 0.250691 +0.249309 0.247926 0.246544 0.245161 0.243779 0.242396 0.241014 0.239631 +0.238249 0.236866 0.235484 0.234101 0.232719 0.231336 0.229954 0.228572 +0.225714 0.222857 0.22 0.217143 0.214286 0.211429 0.208571 0.205714 +0.202857 0.2 0.197143 0.194286 0.191429 0.188571 0.185714 0.177143 +0.168571 0.16 0.151429 0.142857 0.141558 0.14026 0.138961 0.137662 +0.136364 0.135065 0.133766 0.132468 0.131169 0.12987 0.128571 0.128571 +0.128571 0.128571 0.128571 0.128571 0.125714 0.122857 0.12 0.117143 +0.1 0.1 0.1 0.1 0.1 0.1 0.0914286 0.0828571 0.0742857 0.0657143 0.0571428 +0.0542857 0.0514286 0.0485714 0.0457143 0.0285714 0.0285714 0.0285714 +0.0285714 0.0285714 0.0285714 0.0285714 0.0285714 0.0285714 0.0285714 +0.0285714 0.0285714 0.0285714 0.0285714 0.0285714 0.0285714 0.0285714 +0.0285714 0.0285714 0.0285714 0.0285714 0.0285714 0.0285714 0.0285714 +0.0285714 0.0285714 0.0285714 0.0257143 0.0228571 0.02 0.0171429 0.0142857 +0.0114286 0.00857142 0.00571428 0.00285714 -5.58794e-09 -5.58794e-09 +-5.58794e-09 -5.58794e-09 -5.58794e-09 -5.58794e-09 -5.58794e-09 -5.58794e-09 +-5.58794e-09 -5.58794e-09 -5.58794e-09 -5.58794e-09 -5.58794e-09 -5.58794e-09 +-5.58794e-09 -5.58794e-09 0.563636 0.562338 0.561039 0.55974 0.558442 +0.557143 0.555429 0.553714 0.552 0.550286 0.548571 0.546857 0.545143 +0.543429 0.541714 0.54 0.538286 0.536571 0.534857 0.533143 0.531429 +0.529714 0.528 0.526286 0.524571 0.522857 0.521143 0.519429 0.517714 +0.516 0.514285 0.512857 0.511428 0.51 0.508571 0.507143 0.505714 0.504286 +0.502857 0.501429 0.5 0.497222 0.494445 0.491667 0.488889 0.486111 +0.483334 0.480556 0.477778 0.475 0.472222 0.469445 0.466667 0.463889 +0.461111 0.458333 0.455556 0.452778 0.45 0.447222 0.444445 0.441667 +0.438889 0.436111 0.433333 0.430556 0.427778 0.425 0.422222 0.419444 +0.416667 0.413889 0.411111 0.408333 0.405556 0.402778 0.4 0.398352 +0.396704 0.395055 0.393407 0.391759 0.39011 0.388462 0.386813 0.385165 +0.383517 0.381868 0.38022 0.378572 0.376923 0.375275 0.373626 0.371978 +0.37033 0.368681 0.367033 0.365385 0.363736 0.362088 0.36044 0.358791 +0.357143 0.354286 0.351429 0.348571 0.345714 0.342857 0.34 0.337143 +0.334286 0.331429 0.328571 0.325714 0.322857 0.32 0.317143 0.314286 +0.308571 0.302857 0.297143 0.291429 0.285714 0.282857 0.28 0.277143 +0.274286 0.271429 0.268571 0.265714 0.262857 0.26 0.242857 0.240476 +0.238095 0.235714 0.233333 0.230952 0.214286 0.214286 0.214286 0.214286 +0.214286 0.214286 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0; +#A 1000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; +#X coords 0 1 1023 -1 200 140 1; #X restore 335 23 graph; #N canvas 0 0 450 300 graph1 0; -#X array to 64 float 1; -#A 0 0 0 0 0 0 0 0.00682475 0.00853045 0.0102368 0.0388103 0.0639679 -0.0852809 0.10321 0.121109 0.128353 0.139015 0.149682 0.196567 0.205455 -0.225179 0.232002 0.253755 0.253755 0.253755 0.242854 0.0403107 0.047774 -0.0358276 0.0170609 0.0170609 4.44924e-10 -0.00341237 -0.00682475 0 -0 -0.35882 -0.478471 -0.521873 0 0 0 -0.00341233 -0.00682466 -0.0102368 --0.0136493 -0.0136493 -0.0136493 -0.0136493 -0.0136493 -0.0136493 -0.0136493 -0.00170617 0.0170609 0.0341218 0.0580107 0.0750683 0.109195 0 0 0 0 -0 0 0; -#X coords 0 1 63 -1 200 140 1; +#X array to 1024 float 1; +#A 0 0 0 0 0 0 0 1.39698e-08 -1.33878e-09 -1.57743e-08 0.0285713 0.0571426 +0.0761908 0.095238 0.114286 0.12381 0.133332 0.142856 0.2 0.207142 +0.228571 0.228571 0.257142 0.257142 0.257142 0.242857 -0.0142856 -9.49949e-08 +3.05008e-08 -2.67755e-09 -2.67755e-09 -1.8735e-15 -6.98492e-09 -1.39698e-08 +0 0 -0.471429 -0.628572 -0.685714 0 0 0 -6.98492e-09 -1.39698e-08 1.57743e-08 +-4.42378e-08 -4.42378e-08 -4.42378e-08 -4.42378e-08 -4.42378e-08 -4.42378e-08 +-4.42378e-08 4.64206e-09 -2.67755e-09 -5.51809e-08 -2.07219e-07 2.25846e-07 +3.8743e-07 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -9.28412e-09 -1.87138e-08 -1.97324e-08 +-2.52039e-08 -1.04774e-08 -3.05008e-08 1.18162e-08 -2.88128e-08 3.52156e-08 +-4.79631e-08 5.58794e-08 -1.38534e-08 0.00428565 0.00857141 0.0128571 +0.0171429 0.0214285 0.0257142 0.03 0.0342858 0.0385715 0.0428572 0.0457143 +0.0485715 0.0514285 0.0542857 0.0571429 0.0600001 0.0628572 0.0657144 +0.0685714 0.0714285 0.0742857 0.0771428 0.08 0.0828572 0.0857145 0.0884794 +0.0912442 0.0940094 0.0967743 0.0995392 0.102304 0.105069 0.107834 +0.110599 0.113364 0.116129 0.118894 0.121659 0.124424 0.127189 0.129954 +0.132719 0.135484 0.138249 0.141014 0.143779 0.146544 0.149309 0.152074 +0.154839 0.157604 0.160369 0.163134 0.165898 0.168663 0.171428 0.174285 +0.177143 0.18 0.182857 0.185714 0.188571 0.191429 0.194286 0.197143 +0.2 0.202857 0.205714 0.208571 0.211429 0.214286 0.216527 0.218767 +0.221008 0.22325 0.22549 0.227731 0.229972 0.232213 0.234454 0.236695 +0.238935 0.241176 0.243417 0.245658 0.247899 0.25014 0.252381 0.254622 +0.256863 0.259104 0.261344 0.263586 0.265826 0.268068 0.270308 0.272549 +0.27479 0.277031 0.279272 0.281512 0.283754 0.285994 0.288236 0.290476 +0.292717 0.294958 0.297199 0.299439 0.301681 0.303921 0.306163 0.308403 +0.310644 0.312885 0.315126 0.317367 0.319608 0.321849 0.32409 0.32633 +0.328571 0.330952 0.333333 0.335714 0.338095 0.340476 0.342856 0.345238 +0.347618 0.35 0.352381 0.354761 0.357143 0.359523 0.361905 0.364286 +0.366666 0.369048 0.371428 0.373809 0.376191 0.378571 0.380952 0.383333 +0.385714 0.388095 0.390476 0.392857 0.395238 0.397619 0.4 0.40238 0.404762 +0.407142 0.409524 0.411905 0.414285 0.416484 0.418681 0.420879 0.423077 +0.425274 0.427472 0.429671 0.431868 0.434066 0.436263 0.438461 0.440659 +0.442857 0.445055 0.447253 0.44945 0.451648 0.453846 0.456044 0.458242 +0.46044 0.462637 0.464835 0.467033 0.469231 0.471429 0.472 0.472572 +0.473143 0.473715 0.474285 0.474858 0.475429 0.476 0.476571 0.477143 +0.477714 0.478286 0.478857 0.479429 0.48 0.480572 0.481143 0.481715 +0.482286 0.482857 0.483428 0.484001 0.484572 0.485143 0.485714 0.486412 +0.487109 0.487806 0.488502 0.489199 0.489896 0.490593 0.49129 0.491986 +0.492683 0.49338 0.494078 0.494774 0.495471 0.496167 0.496864 0.497562 +0.498259 0.498955 0.499652 0.500349 0.501046 0.501742 0.50244 0.503137 +0.503833 0.50453 0.505227 0.505924 0.506621 0.507317 0.508015 0.508712 +0.509407 0.510105 0.510801 0.511498 0.512196 0.512892 0.513588 0.514287 +0.515385 0.516484 0.517584 0.518682 0.519781 0.52088 0.521979 0.523078 +0.524176 0.525276 0.526374 0.527473 0.528571 0.529671 0.530769 0.531869 +0.532967 0.534066 0.535165 0.536263 0.537363 0.538462 0.539561 0.54066 +0.541759 0.542858 0.544 0.545143 0.546286 0.547428 0.548572 0.549715 +0.550857 0.552 0.553143 0.554286 0.555429 0.556571 0.557715 0.558857 +0.56 0.561143 0.562286 0.563429 0.564571 0.565715 0.566857 0.568 0.569144 +0.570285 0.571429 0.571429 0.571429 0.571429 0.571429 0.571429 0.571429 +0.571429 0.571429 0.571429 0.571429 0.571429 0.571429 0.571429 0.571429 +0.571429 0.571428 0.570476 0.569524 0.568571 0.567619 0.566667 0.565714 +0.564761 0.563809 0.562857 0.561905 0.560952 0.56 0.559047 0.558095 +0.557143 0.555714 0.554286 0.552857 0.551429 0.55 0.548572 0.547143 +0.545715 0.544285 0.542857 0.54 0.537143 0.534286 0.531428 0.528572 +0.525714 0.522857 0.519999 0.517143 0.514286 0.511428 0.508572 0.505714 +0.502858 0.5 0.498701 0.497403 0.496104 0.494805 0.493507 0.492207 +0.490908 0.489611 0.488311 0.487013 0.485715 0.483429 0.481143 0.478857 +0.476571 0.474286 0.472 0.469715 0.467429 0.465142 0.462857 0.460571 +0.458286 0.456001 0.453714 0.451428 0.449143 0.446857 0.444572 0.442286 +0.44 0.437714 0.435428 0.433143 0.430858 0.428572 0.425893 0.423214 +0.420535 0.417857 0.415179 0.4125 0.409822 0.407143 0.404464 0.401785 +0.399107 0.396429 0.39375 0.391071 0.388392 0.385715 0.382142 0.378571 +0.375 0.371428 0.367857 0.364285 0.360714 0.357143 0.353572 0.35 0.346429 +0.342857 0.339286 0.335714 0.332143 0.328571 0.325 0.321428 0.317857 +0.314286 0.31 0.305714 0.301429 0.297143 0.292857 0.288572 0.284286 +0.28 0.275715 0.271428 0.270046 0.268664 0.267281 0.265899 0.264516 +0.263133 0.261751 0.260369 0.258986 0.257604 0.256221 0.254838 0.253456 +0.252074 0.250691 0.249308 0.247926 0.246544 0.245161 0.243779 0.242396 +0.241013 0.239632 0.238249 0.236866 0.235484 0.234101 0.232719 0.231337 +0.229954 0.228571 0.225714 0.222857 0.22 0.217143 0.214286 0.211429 +0.208572 0.205714 0.202857 0.2 0.197143 0.194286 0.191428 0.188571 +0.185714 0.177143 0.168571 0.16 0.151428 0.142857 0.141558 0.14026 +0.138961 0.137662 0.136364 0.135065 0.133766 0.132467 0.131169 0.12987 +0.128571 0.128571 0.128571 0.128571 0.128571 0.128571 0.125714 0.122857 +0.12 0.117143 0.1 0.1 0.1 0.1 0.1 0.1 0.0914285 0.0828572 0.0742856 +0.0657142 0.0571428 0.0542856 0.0514286 0.0485714 0.0457143 0.0285714 +0.0285714 0.0285714 0.0285714 0.0285714 0.0285714 0.0285714 0.0285714 +0.0285714 0.0285714 0.0285714 0.0285714 0.0285714 0.0285714 0.0285714 +0.0285714 0.0285714 0.0285714 0.0285714 0.0285714 0.0285714 0.0285714 +0.0285714 0.0285714 0.0285714 0.0285714 0.0285714 0.0257143 0.0228571 +0.02 0.0171428 0.0142857 0.0114286 0.00857142 0.00571428 0.00285713 +-5.58793e-09 -5.58793e-09 -5.58793e-09 -5.58793e-09 -5.58793e-09 -5.58793e-09 +-5.58793e-09 -5.58793e-09 -5.58793e-09 -5.58793e-09 -5.58793e-09 -5.58793e-09 +-5.58793e-09 -5.58793e-09 -5.58793e-09 -5.58793e-09 0.563637 0.562338 +0.561039 0.559741 0.558441 0.557143 0.555429 0.553714 0.552 0.550286 +0.548572 0.546857 0.545143 0.543428 0.541715 0.54 0.538286 0.536572 +0.534857 0.533143 0.531428 0.529714 0.528001 0.526286 0.524572 0.522857 +0.521143 0.519428 0.517714 0.516 0.514285 0.512857 0.511428 0.51 0.508572 +0.507142 0.505714 0.504286 0.502858 0.501428 0.5 0.497223 0.494444 +0.491667 0.488889 0.486112 0.483333 0.480556 0.477778 0.475001 0.472222 +0.469445 0.466667 0.463889 0.461111 0.458334 0.455555 0.452778 0.45 +0.447223 0.444444 0.441667 0.438889 0.436112 0.433333 0.430556 0.427778 +0.425001 0.422222 0.419445 0.416667 0.413888 0.411111 0.408333 0.405556 +0.402777 0.4 0.398352 0.396703 0.395056 0.393407 0.391759 0.39011 0.388462 +0.386814 0.385165 0.383517 0.381868 0.38022 0.378572 0.376923 0.375275 +0.373626 0.371978 0.370329 0.368682 0.367033 0.365385 0.363736 0.362088 +0.36044 0.358792 0.357143 0.354286 0.351428 0.348572 0.345714 0.342857 +0.34 0.337143 0.334286 0.331429 0.328571 0.325714 0.322857 0.32 0.317143 +0.314286 0.308571 0.302857 0.297143 0.291429 0.285714 0.282857 0.28 +0.277143 0.274286 0.271428 0.268571 0.265714 0.262857 0.26 0.242857 +0.240476 0.238095 0.235715 0.233333 0.230953 0.214286 0.214286 0.214286 +0.214286 0.214286 0.214286 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0; +#A 1000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; +#X coords 0 1 1023 -1 200 140 1; #X restore 456 301 graph; #X obj 144 412 tabwrite~ to; #X obj 208 373 metro 50; @@ -42,15 +301,23 @@ #X obj 63 385 print~; #X obj 26 332 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; -#X obj 88 321 bufline~ 128; #X msg 119 239 line 400; +#X obj 88 321 bufline~ 1024; +#X obj 607 14 block~ 2048; +#X obj 341 332 delay; +#X obj 341 355 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 338 287 5000; +#X connect 4 0 3 0; #X connect 5 0 4 0; -#X connect 6 0 5 0; +#X connect 6 0 13 0; +#X connect 6 0 17 0; #X connect 7 0 13 0; #X connect 8 0 13 0; #X connect 9 0 13 0; -#X connect 10 0 13 0; -#X connect 12 0 11 0; -#X connect 13 0 11 0; -#X connect 13 0 4 0; -#X connect 14 0 13 0; +#X connect 11 0 10 0; +#X connect 12 0 13 0; +#X connect 13 0 10 0; +#X connect 13 0 3 0; +#X connect 15 0 16 0; +#X connect 17 0 15 0; diff --git a/tbext/config-pd-linux.txt b/tbext/config-pd-linux.txt index 7c9fbde..b1479f8 100755 --- a/tbext/config-pd-linux.txt +++ b/tbext/config-pd-linux.txt @@ -1,7 +1,7 @@ # config file for tbext, adapted from Thomas Grill's xsample makefile # your c++ compiler (if not g++) -# CXX=icc + CXX=icc # where does the PD installation reside? @@ -10,7 +10,8 @@ PD=/usr/lib/pd # where are the PD header files? # leave it blank if it is a system directory (like /usr/local/include), # since gcc 3.2 complains about it -PDINC=/home/tim/pd/pd-0.37-0/src +PDINC=/home/tim/pd/pd/src +#PDINC=/home/tim/pd/devel_0_36/pd/src # where do the flext libraries reside? FLEXTPATH=/usr/lib/flext @@ -28,9 +29,9 @@ HELPDIR=${PD}/doc/5.reference # additional compiler flags # (check whether they fit to your system!) -#UFLAGS=-xW -tpp7 -ip -ipo_obj -g # icc +UFLAGS=-g -xW -tpp7 -ip -ipo_obj # icc # UFLAGS=-mcpu=pentium4 -mmmx -msse2 -msse -mfpmath=sse # gcc 3.2 # define to link against shared flext library (flext version >= 0.5.0) -#FLEXT_SHARED=1 +FLEXT_SHARED=1 diff --git a/tbext/make-files.txt b/tbext/make-files.txt index b3a83b5..559a851 100755 --- a/tbext/make-files.txt +++ b/tbext/make-files.txt @@ -3,7 +3,7 @@ SRCDIR = source SRCS= \ main.cpp tbroute.cpp tbsig~.cpp tbsroute~.cpp \ tbpow~.cpp tbfft1.cpp tbfft2.cpp fftbuf.cpp fftgrsort.cpp \ - fftgrshuf.cpp fftgrrev.cpp # tbg7xx.cpp tbstrg.cpp + fftgrshuf.cpp fftgrrev.cpp #HDRS= \ diff --git a/tbext/makefile.pd-linux b/tbext/makefile.pd-linux index 56fbc17..7948a19 100644 --- a/tbext/makefile.pd-linux +++ b/tbext/makefile.pd-linux @@ -17,11 +17,11 @@ FLEXTLIB=$(FLEXTPATH)/flext.a # compiler stuff INCLUDES=$(PDINC) FLAGS=-DFLEXT_SYS=2 -CFLAGS=${UFLAGS} -O3 -I/home/tim/pd/externals/grill/flext/source -funroll-loops -fmove-all-movables -frerun-loop-opt -finline-functions -fno-rtti -fno-exceptions -DFLEXT_THREADS +CFLAGS=${UFLAGS} -O3 -I/home/tim/pd/externals/grill/flext/source -funroll-loops -fmove-all-movables -frerun-loop-opt -finline-functions -fno-rtti -fno-exceptions LIBS=m ifdef FLEXT_SHARED -CFLAGS+=-DFLEXT_SHARED +CFLAGS+=-DFLEXT_SHARED -DFLEXT_THREADS LDFLAGS+=-Bdynamic LINKFLEXT=-lflext #-L/usr/lib/flext/libflext.so else 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 -/*inline*/ void fftbuf::clear(T* buf) +inline void fftbuf::clear(T* buf) { if (buf) { @@ -207,6 +216,8 @@ template 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 Date: Sun, 29 Feb 2004 13:57:19 +0000 Subject: *** empty log message *** svn path=/trunk/externals/tb/; revision=1364 --- tbext/config-pd-linux.txt | 4 ++ tbext/make-files.txt | 5 +- tbext/makefile.pd-linux | 8 ++- tbext/source/main.cpp | 15 +++-- tbext/source/rfftw~.cpp | 138 +++++++++++++++++++++++++++++++++++++++ tbext/source/rifftw~.cpp | 161 ++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 324 insertions(+), 7 deletions(-) create mode 100644 tbext/source/rfftw~.cpp create mode 100644 tbext/source/rifftw~.cpp (limited to 'tbext') diff --git a/tbext/config-pd-linux.txt b/tbext/config-pd-linux.txt index b1479f8..b1acfa1 100755 --- a/tbext/config-pd-linux.txt +++ b/tbext/config-pd-linux.txt @@ -32,6 +32,10 @@ HELPDIR=${PD}/doc/5.reference UFLAGS=-g -xW -tpp7 -ip -ipo_obj # icc # UFLAGS=-mcpu=pentium4 -mmmx -msse2 -msse -mfpmath=sse # gcc 3.2 +#compile support for the fftw3 library +#make sure that you compiled fftw3 for single precision floats!!! +FFTW=1 + # define to link against shared flext library (flext version >= 0.5.0) FLEXT_SHARED=1 diff --git a/tbext/make-files.txt b/tbext/make-files.txt index 559a851..cf7bc8e 100755 --- a/tbext/make-files.txt +++ b/tbext/make-files.txt @@ -4,7 +4,10 @@ SRCS= \ main.cpp tbroute.cpp tbsig~.cpp tbsroute~.cpp \ tbpow~.cpp tbfft1.cpp tbfft2.cpp fftbuf.cpp fftgrsort.cpp \ fftgrshuf.cpp fftgrrev.cpp - + +ifdef FFTW +SRCS+=fftw~.cpp ifftw~.cpp rfftw~.cpp rifftw~.cpp +endif #HDRS= \ main.h diff --git a/tbext/makefile.pd-linux b/tbext/makefile.pd-linux index 7948a19..3546d99 100644 --- a/tbext/makefile.pd-linux +++ b/tbext/makefile.pd-linux @@ -1,5 +1,4 @@ -# xsample - extended sample objects for Max/MSP and pd (pure data) -# Copyright (c) 2001-2003 Thomas Grill (xovo@gmx.net) +# makefile adapted from thomas grill's xsample makefile # # Makefile for gcc @ linux # @@ -28,6 +27,11 @@ else LINKFLEXT=$(FLEXTLIB) endif +ifdef FFTW +LDFLAGS+=-lfftw3f +CFLAGS+=-DFFTW +endif + # ---------------------------------------------- # the rest can stay untouched # ---------------------------------------------- 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 -#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 + +#include "fftw3.h" +#include + +#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 + +#include "fftw3.h" +#include + +#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 Date: Tue, 30 Mar 2004 18:49:02 +0000 Subject: added him~ object svn path=/trunk/externals/tb/; revision=1525 --- tbext/config-pd-linux.txt | 8 +- tbext/him.pd | 42 +++++ tbext/make-files.txt | 6 +- tbext/source/him.cpp | 389 ++++++++++++++++++++++++++++++++++++++++++++++ tbext/source/main.cpp | 11 +- 5 files changed, 437 insertions(+), 19 deletions(-) create mode 100644 tbext/him.pd create mode 100644 tbext/source/him.cpp (limited to 'tbext') diff --git a/tbext/config-pd-linux.txt b/tbext/config-pd-linux.txt index b1acfa1..a3697ef 100755 --- a/tbext/config-pd-linux.txt +++ b/tbext/config-pd-linux.txt @@ -10,7 +10,7 @@ PD=/usr/lib/pd # where are the PD header files? # leave it blank if it is a system directory (like /usr/local/include), # since gcc 3.2 complains about it -PDINC=/home/tim/pd/pd/src +PDINC=/home/tim/pd/pd-0.37-1test3/src #PDINC=/home/tim/pd/devel_0_36/pd/src # where do the flext libraries reside? @@ -29,13 +29,9 @@ HELPDIR=${PD}/doc/5.reference # additional compiler flags # (check whether they fit to your system!) -UFLAGS=-g -xW -tpp7 -ip -ipo_obj # icc +UFLAGS=-xN -tpp7 -ip -ipo_obj # icc # UFLAGS=-mcpu=pentium4 -mmmx -msse2 -msse -mfpmath=sse # gcc 3.2 -#compile support for the fftw3 library -#make sure that you compiled fftw3 for single precision floats!!! -FFTW=1 - # define to link against shared flext library (flext version >= 0.5.0) FLEXT_SHARED=1 diff --git a/tbext/him.pd b/tbext/him.pd new file mode 100644 index 0000000..847f8ad --- /dev/null +++ b/tbext/him.pd @@ -0,0 +1,42 @@ +#N canvas 0 0 680 378 10; +#X obj 48 338 dac~; +#X msg 117 142 output \$1; +#X obj 117 120 hradio 15 1 0 6 empty empty empty 0 -6 0 8 -262144 -1 +-1 0; +#X msg 125 191 regtime \$1; +#X obj 125 169 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 51 15 hsl 128 15 1e-04 1 1 0 empty empty dt -2 -6 0 8 -262144 +-1 -1 0 0; +#X msg 48 37 dt \$1; +#X msg 80 84 e \$1; +#X obj 83 65 hsl 128 15 -1 0 0 0 empty empty etilde -2 -6 0 8 -262144 +-1 -1 0 0; +#X floatatom 122 85 5 0 0 0 - - -; +#X floatatom 106 40 5 0 0 0 - - -; +#X msg 158 224 reset; +#X msg 179 258 state; +#X obj 48 309 him~ -0.3; +#X text 216 123 switch beween mu \, muv \, nu \, nuv \, x and y; +#X text 224 66 set the etilde of the system if it's positive \, the +electron will leave the atom; +#X text 194 13 set the timesteps for the 4th order runge-kutta approximation +; +#X text 215 190 use the real or the regulated time; +#X text 218 223 randomize new values (warning! this may click!!!); +#X text 231 257 returns the state of the system; +#X text 128 308 the optional argument is the etilde of the system; +#X connect 1 0 13 0; +#X connect 2 0 1 0; +#X connect 3 0 13 0; +#X connect 4 0 3 0; +#X connect 5 0 6 0; +#X connect 5 0 10 0; +#X connect 6 0 13 0; +#X connect 7 0 13 0; +#X connect 8 0 7 0; +#X connect 8 0 9 0; +#X connect 11 0 13 0; +#X connect 12 0 13 0; +#X connect 13 0 0 0; +#X connect 13 0 0 1; diff --git a/tbext/make-files.txt b/tbext/make-files.txt index cf7bc8e..6140f01 100755 --- a/tbext/make-files.txt +++ b/tbext/make-files.txt @@ -3,11 +3,7 @@ SRCDIR = source SRCS= \ main.cpp tbroute.cpp tbsig~.cpp tbsroute~.cpp \ tbpow~.cpp tbfft1.cpp tbfft2.cpp fftbuf.cpp fftgrsort.cpp \ - fftgrshuf.cpp fftgrrev.cpp + fftgrshuf.cpp fftgrrev.cpp him.cpp -ifdef FFTW -SRCS+=fftw~.cpp ifftw~.cpp rfftw~.cpp rifftw~.cpp -endif - #HDRS= \ main.h 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 +#include +#include + +#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 -#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 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') 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 Date: Fri, 9 Apr 2004 13:42:58 +0000 Subject: some updates svn path=/trunk/externals/tb/; revision=1589 --- tbext/him.pd | 73 ++++++++++++++---------- tbext/source/him.cpp | 153 ++++++++++++--------------------------------------- 2 files changed, 80 insertions(+), 146 deletions(-) (limited to 'tbext') diff --git a/tbext/him.pd b/tbext/him.pd index 847f8ad..7e15881 100644 --- a/tbext/him.pd +++ b/tbext/him.pd @@ -1,42 +1,57 @@ #N canvas 0 0 680 378 10; #X obj 48 338 dac~; -#X msg 117 142 output \$1; -#X obj 117 120 hradio 15 1 0 6 empty empty empty 0 -6 0 8 -262144 -1 --1 0; -#X msg 125 191 regtime \$1; -#X obj 125 169 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +#X msg 125 144 regtime \$1; +#X obj 125 122 tgl 15 1 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1; #X obj 51 15 hsl 128 15 1e-04 1 1 0 empty empty dt -2 -6 0 8 -262144 --1 -1 0 0; +-1 -1 10400 0; #X msg 48 37 dt \$1; #X msg 80 84 e \$1; #X obj 83 65 hsl 128 15 -1 0 0 0 empty empty etilde -2 -6 0 8 -262144 --1 -1 0 0; +-1 -1 6000 0; #X floatatom 122 85 5 0 0 0 - - -; #X floatatom 106 40 5 0 0 0 - - -; -#X msg 158 224 reset; -#X msg 179 258 state; +#X msg 158 177 reset; +#X msg 179 211 state; #X obj 48 309 him~ -0.3; -#X text 216 123 switch beween mu \, muv \, nu \, nuv \, x and y; -#X text 224 66 set the etilde of the system if it's positive \, the -electron will leave the atom; #X text 194 13 set the timesteps for the 4th order runge-kutta approximation ; -#X text 215 190 use the real or the regulated time; -#X text 218 223 randomize new values (warning! this may click!!!); -#X text 231 257 returns the state of the system; -#X text 128 308 the optional argument is the etilde of the system; -#X connect 1 0 13 0; +#X text 215 143 use the real or the regulated time; +#X text 218 176 randomize new values (warning! this may click!!!); +#X text 231 210 returns the state of the system; +#X text 224 66 set the etilde of the system if it's positive \, the +electron will leave the atom (if you change it during dsp computation +\, it will click); +#X text 128 308 the optional argument is the etilde of the system returns +mu \, mu velocity \, nu \, nu velocity \, x and y. Based on physical +models of an atom in a magnetic field...; +#X obj 608 207 loadbang; +#X msg 608 271 muv 1.22293; +#X msg 608 292 nu -0.065661 \;; +#X msg 607 252 mu -1.43572 \;; +#X obj 608 228 t b b; +#X msg 608 318 \; pd dsp 1; +#X connect 1 0 11 0; #X connect 2 0 1 0; -#X connect 3 0 13 0; -#X connect 4 0 3 0; -#X connect 5 0 6 0; -#X connect 5 0 10 0; -#X connect 6 0 13 0; -#X connect 7 0 13 0; -#X connect 8 0 7 0; -#X connect 8 0 9 0; -#X connect 11 0 13 0; -#X connect 12 0 13 0; -#X connect 13 0 0 0; -#X connect 13 0 0 1; +#X connect 3 0 4 0; +#X connect 3 0 8 0; +#X connect 4 0 11 0; +#X connect 5 0 11 0; +#X connect 6 0 5 0; +#X connect 6 0 7 0; +#X connect 9 0 11 0; +#X connect 10 0 11 0; +#X connect 11 0 0 0; +#X connect 11 1 0 1; +#X connect 11 2 0 0; +#X connect 11 3 0 1; +#X connect 11 4 0 0; +#X connect 11 5 0 1; +#X connect 18 0 22 0; +#X connect 19 0 11 0; +#X connect 20 0 11 0; +#X connect 21 0 11 0; +#X connect 22 0 23 0; +#X connect 22 1 21 0; +#X connect 22 1 19 0; +#X connect 22 1 20 0; 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 b02a1e9aee38e588e6d4430d0e84a9e736c2b0f0 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Tue, 13 Jul 2004 20:00:39 +0000 Subject: minor changes svn path=/trunk/externals/tb/; revision=1852 --- tbext/config-pd-linux.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tbext') diff --git a/tbext/config-pd-linux.txt b/tbext/config-pd-linux.txt index a3697ef..48f327a 100755 --- a/tbext/config-pd-linux.txt +++ b/tbext/config-pd-linux.txt @@ -16,14 +16,14 @@ PDINC=/home/tim/pd/pd-0.37-1test3/src # where do the flext libraries reside? FLEXTPATH=/usr/lib/flext -# where should xsample objects be built? +# where should tbext objects be built? TARGDIR=./pd-linux -# where should xsample be installed? +# where should tbext be installed? # (leave blank to omit installation) INSTDIR=${PD}/externs -# where should the xsample help be installed? +# where should the tbext help be installed? # (leave blank to omit installation) HELPDIR=${PD}/doc/5.reference -- cgit v1.2.1 From 5e7742116ef3b268823d43d26dab3239e4472dcf Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Tue, 13 Jul 2004 20:01:49 +0000 Subject: adapted thomas' build system svn path=/trunk/externals/tb/; revision=1853 --- tbext/build-max-msvc.bat | 4 +++ tbext/build-pd-bcc.bat | 3 ++ tbext/build-pd-cygwin.sh | 15 ++++++++ tbext/build-pd-darwin.sh | 17 +++++++++ tbext/build-pd-linux.sh | 17 +++++++++ tbext/build-pd-mingw.bat | 3 ++ tbext/build-pd-msvc.bat | 4 +++ tbext/config-max-msvc.txt | 27 +++++++++++++++ tbext/config-pd-bcc.txt | 23 +++++++++++++ tbext/config-pd-cygwin.txt | 35 +++++++++++++++++++ tbext/config-pd-darwin.txt | 35 +++++++++++++++++++ tbext/config-pd-mingw.txt | 35 +++++++++++++++++++ tbext/config-pd-msvc.txt | 19 ++++++++++ tbext/makefile.pd-cygwin | 86 ++++++++++++++++++++++++++++++++++++++++++++++ tbext/makefile.pd-darwin | 77 +++++++++++++++++++++++++++++++++++++++++ tbext/makefile.pd-mingw | 85 +++++++++++++++++++++++++++++++++++++++++++++ tbext/makefile.pd-msvc | 53 ++++++++++++++++++++++++++++ 17 files changed, 538 insertions(+) create mode 100644 tbext/build-max-msvc.bat create mode 100644 tbext/build-pd-bcc.bat create mode 100644 tbext/build-pd-cygwin.sh create mode 100755 tbext/build-pd-darwin.sh create mode 100755 tbext/build-pd-linux.sh create mode 100644 tbext/build-pd-mingw.bat create mode 100644 tbext/build-pd-msvc.bat create mode 100644 tbext/config-max-msvc.txt create mode 100644 tbext/config-pd-bcc.txt create mode 100644 tbext/config-pd-cygwin.txt create mode 100755 tbext/config-pd-darwin.txt create mode 100644 tbext/config-pd-mingw.txt create mode 100644 tbext/config-pd-msvc.txt create mode 100644 tbext/makefile.pd-cygwin create mode 100755 tbext/makefile.pd-darwin create mode 100644 tbext/makefile.pd-mingw create mode 100644 tbext/makefile.pd-msvc (limited to 'tbext') diff --git a/tbext/build-max-msvc.bat b/tbext/build-max-msvc.bat new file mode 100644 index 0000000..130a3bc --- /dev/null +++ b/tbext/build-max-msvc.bat @@ -0,0 +1,4 @@ +@echo --- Building with MS Visual C++ --- + +nmake -f makefile.max-msvc clean +nmake -f makefile.max-msvc diff --git a/tbext/build-pd-bcc.bat b/tbext/build-pd-bcc.bat new file mode 100644 index 0000000..3dd2132 --- /dev/null +++ b/tbext/build-pd-bcc.bat @@ -0,0 +1,3 @@ +@echo --- Building with BorlandC++ --- + +make -f makefile.pd-bcc diff --git a/tbext/build-pd-cygwin.sh b/tbext/build-pd-cygwin.sh new file mode 100644 index 0000000..9477844 --- /dev/null +++ b/tbext/build-pd-cygwin.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +SYS=pd-cygwin + +. config-${SYS}.txt + +make -f makefile.${SYS} && +{ + if [ $INSTDIR != "" ]; then + make -f makefile.${SYS} install + fi + if [ $HELPDIR != "" ]; then + make -f makefile.${SYS} install-help + fi +} diff --git a/tbext/build-pd-darwin.sh b/tbext/build-pd-darwin.sh new file mode 100755 index 0000000..38814a9 --- /dev/null +++ b/tbext/build-pd-darwin.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +SYS=pd-darwin + +. config-${SYS}.txt + +make -f makefile.${SYS} && +{ + if [ $INSTDIR != "" ]; then + echo Now install as root + sudo make -f makefile.${SYS} install + fi + if [ $HELPDIR != "" ]; then + echo Now install help as root + sudo make -f makefile.${SYS} install-help + fi +} diff --git a/tbext/build-pd-linux.sh b/tbext/build-pd-linux.sh new file mode 100755 index 0000000..77c6e3f --- /dev/null +++ b/tbext/build-pd-linux.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +SYS=pd-linux + +. config-${SYS}.txt + +make -f makefile.${SYS} && +{ + if [ $INSTDIR != "" ]; then + echo Now install as root + su -c "make -f makefile.${SYS} install" + fi + if [ $HELPDIR != "" ]; then + echo Now install help as root + su -c "make -f makefile.${SYS} install-help" + fi +} diff --git a/tbext/build-pd-mingw.bat b/tbext/build-pd-mingw.bat new file mode 100644 index 0000000..fa8919a --- /dev/null +++ b/tbext/build-pd-mingw.bat @@ -0,0 +1,3 @@ +mingw32-make -f makefile.pd-mingw +mingw32-make -f makefile.pd-mingw install +mingw32-make -f makefile.pd-mingw install-help diff --git a/tbext/build-pd-msvc.bat b/tbext/build-pd-msvc.bat new file mode 100644 index 0000000..d6187f0 --- /dev/null +++ b/tbext/build-pd-msvc.bat @@ -0,0 +1,4 @@ +@echo --- Building with MS Visual C++ --- + +nmake -f makefile.pd-msvc clean +nmake -f makefile.pd-msvc diff --git a/tbext/config-max-msvc.txt b/tbext/config-max-msvc.txt new file mode 100644 index 0000000..e2a0477 --- /dev/null +++ b/tbext/config-max-msvc.txt @@ -0,0 +1,27 @@ +# config file for tbext, adapted from Thomas Grill's xsample makefile +# + +# where is the Max SDK? +# you should have the latest version! +MAXSDKPATH="F:\prog\audio\MaxWinSDK\c74support" + +# where do the flext libraries reside? +FLEXTPATH="%CommonProgramFiles%\Cycling '74\flext" + +# where is MS VC++? +# (need not be defined if the build is started with the compiler environment set) +# MSVCPATH="c:\programme\prog\microsoft visual studio\VC98" + + +# where should the external be built? +# (path for temporary files) +OUTPATH=max-msvc + +# where should the external be installed? +# (leave blank to omit installation) +INSTPATH="%CommonProgramFiles%\Cycling '74\externals\flext" + + +# some user-definable flags +# (check if they match your system!) +UFLAGS=/G6 /arch:SSE diff --git a/tbext/config-pd-bcc.txt b/tbext/config-pd-bcc.txt new file mode 100644 index 0000000..3b9eb52 --- /dev/null +++ b/tbext/config-pd-bcc.txt @@ -0,0 +1,23 @@ +# config file for tbext, adapted from Thomas Grill's xsample makefile +# + +# where is PD? +PDPATH=c:\programme\audio\pd + +# where do the flext libraries reside? +FLEXTPATH=$(PDPATH)\flext + +# where is BorlandC++? +BCCPATH=c:\programme\prog\bcc55 + +# where should the external(s) be built? +OUTPATH=.\pd-bcc + +# should the external be installed? (yes/no) +INSTALL=yes + +# where should the external be installed? +INSTDIR=$(PDPATH)\extra + +# additional compiler flags +UFLAGS=-6 -O2 -OS -ff diff --git a/tbext/config-pd-cygwin.txt b/tbext/config-pd-cygwin.txt new file mode 100644 index 0000000..17af1b9 --- /dev/null +++ b/tbext/config-pd-cygwin.txt @@ -0,0 +1,35 @@ +# config file for tbext, adapted from Thomas Grill's xsample makefile +# + +# your c++ compiler (define only if it's different than g++) +# CXX=g++ + +# where does the PD installation reside? +PD=/cygdrive/c/programme/audio/pd + +# where are the PD header files? +# leave it blank if it is a system directory (like /usr/local/include), +# since gcc 3.2 complains about it +PDINC=${PD}/src + +# where do the flext libraries reside? +FLEXTPATH=${PD}/flext + +# where should tbext objects be built? +TARGDIR=./pd-cygwin + +# where should tbext be installed? +# (leave blank to omit installation) +INSTDIR=${PD}/extra + +# where should the tbext help be installed? +# (leave blank to omit installation) +HELPDIR=${PD}/doc/5.reference + +# additional compiler flags +# (check whether they fit to your system!) +UFLAGS=-mcpu=pentium4 -msse -mfpmath=sse # gcc 3.2 +# UFLAGS=-mcpu=pentiumpro # gcc 2.95 + +# define to build with shared flext library +#FLEXT_SHARED=1 diff --git a/tbext/config-pd-darwin.txt b/tbext/config-pd-darwin.txt new file mode 100755 index 0000000..2a5441f --- /dev/null +++ b/tbext/config-pd-darwin.txt @@ -0,0 +1,35 @@ +# config file for tbext, adapted from Thomas Grill's xsample makefile +# + +# your c++ compiler (if not g++) +#CXX=g++-3.3 + +# where does the PD installation reside? +PD=/usr/local/lib/pd + +# where are the PD header files? +# leave it blank if it is a system directory (like /usr/local/include), +# since gcc 3.2 complains about it +PDINC=${PD}/src + +# where is the PD executable? +PDBIN=/usr/local/bin/pd + +# where do the flext libraries reside? +FLEXTPATH=${PD}/flext + +# where should the tbext objects be built? +TARGDIR=./pd-darwin + +# where should tbext be installed? +# (leave blank to omit installation) +INSTDIR=${PD}/extra + +# where should the tbext help be installed? +# (leave blank to omit installation) +HELPDIR=${PD}/doc/5.reference + +# additional compiler flags +# (check whether they fit your system!) +UFLAGS=-malign-power -maltivec -faltivec + diff --git a/tbext/config-pd-mingw.txt b/tbext/config-pd-mingw.txt new file mode 100644 index 0000000..cbe445c --- /dev/null +++ b/tbext/config-pd-mingw.txt @@ -0,0 +1,35 @@ +# config file for tbext, adapted from Thomas Grill's xsample makefile +# + +# your c++ compiler (define only if it's different than g++) +# CXX=g++ + +# where does the PD installation reside? +PD=c:/programme/audio/pd + +# where are the PD header files? +# leave it blank if it is a system directory (like /usr/local/include), +# since gcc 3.2 complains about it +PDINC=${PD}/src + +# where do the flext libraries reside? +FLEXTPATH=${PD}/flext + +# where should tbext objects be built? +TARGDIR=./pd-mingw + +# where should tbext be installed? +# (leave blank to omit installation) +INSTDIR=${PD}/extra + +# where should the tbext help be installed? +# (leave blank to omit installation) +HELPDIR=${PD}/doc/5.reference + +# additional compiler flags +# (check whether they fit to your system!) +UFLAGS=-mcpu=pentium4 -msse -mfpmath=sse # gcc 3.2 +# UFLAGS=-mcpu=pentiumpro # gcc 2.95 + +# define to build with shared flext library +# FLEXT_SHARED=1 \ No newline at end of file diff --git a/tbext/config-pd-msvc.txt b/tbext/config-pd-msvc.txt new file mode 100644 index 0000000..fb48585 --- /dev/null +++ b/tbext/config-pd-msvc.txt @@ -0,0 +1,19 @@ +# config file for tbext, adapted from Thomas Grill's xsample makefile +# + +# where is PD? +PDPATH=c:\programme\audio\pd + +# where do the flext libraries reside? +FLEXTPATH=$(PDPATH)\flext + +# where is MS VC++? +# (not necessary if the build started with the compiler environment) +# MSVCPATH=c:\programme\prog\microsoft visual studio\VC98 + +# where should the external be built? +OUTPATH=pd-msvc + +# where should the external be installed? +# (leave blank to omit installation) +INSTDIR=$(PDPATH)\extra diff --git a/tbext/makefile.pd-cygwin b/tbext/makefile.pd-cygwin new file mode 100644 index 0000000..9b8a9f8 --- /dev/null +++ b/tbext/makefile.pd-cygwin @@ -0,0 +1,86 @@ +# makefile adapted from thomas grill's xsample makefile +# +# Makefile for gcc @ cygwin +# +# usage: +# to build run "make -f makefile.pd-cygwin" +# to install (as root), do "make -f makefile.pd-cygwin install" +# + +CONFIG=config-pd-cygwin.txt +MAKEFILE=makefile.pd-cygwin + +include ${CONFIG} + + +# compiler stuff +# /usr/include holds the cygwin pthread headers and must be first! +INCLUDES=/usr/include $(PDINC) ./headers/plugin_interface ./headers/common ./headers/server ./headers/app ./headers/lang + +FLAGS=-DFLEXT_SYS=2 +CFLAGS=-O2 -funroll-loops -fmove-all-movables -frerun-loop-opt -finline-functions -fno-rtti -fno-exceptions ${UFLAGS} + +PDLIBS=$(PD)/bin/pd.dll $(PD)/bin/pthreadVC.dll + + +ifdef FLEXT_SHARED + +CFLAGS+=-DFLEXT_SHARED +FLEXTLIB=$(FLEXTPATH)/flext.dll + +else + +FLEXTLIB=$(FLEXTPATH)/flext-pdwin.lib + +endif + + +# ---------------------------------------------- +# the rest can stay untouched +# ---------------------------------------------- + +NAME=tbext + +include make-files.txt + +TARGET=$(TARGDIR)/$(NAME).dll + +# default target +all: $(TARGDIR) $(TARGET) + +$(patsubst %,$(SRCDIR)/%,$(SRCS)): $(patsubst %,$(SRCDIR)/%,$(HDRS)) $(MAKEFILE) $(CONFIG) + touch $(patsubst %,$(SRCDIR)/%,$(SRCS)) + +$(TARGDIR): + -mkdir $(TARGDIR) + +$(TARGDIR)/%.o : $(SRCDIR)/%.cpp + $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(FLEXTPATH)) $< -o $@ + +$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS)) $(FLEXTLIB) + $(CXX) -shared $(LDFLAGS) $^ ${PDLIBS} $(patsubst %,-l%,$(LIBS)) -o $@ + strip --strip-unneeded $@ + chmod 755 $@ + +$(INSTDIR): + -mkdir $(INSTDIR) + +install:: $(INSTDIR) + +install:: $(TARGET) + cp $^ $(INSTDIR) +# chown root.root $(patsubst %,$(INSTDIR)/%,$(notdir $^)) + +$(HELPDIR): + -mkdir $(HELPDIR) + +install-help:: $(HELPDIR) + +install-help:: ./pd + chmod 644 $^/*.* + cp $^/*.* $(HELPDIR) + + +.PHONY: clean +clean: + rm -f $(TARGDIR)/*.o $(TARGET) diff --git a/tbext/makefile.pd-darwin b/tbext/makefile.pd-darwin new file mode 100755 index 0000000..9b6af4e --- /dev/null +++ b/tbext/makefile.pd-darwin @@ -0,0 +1,77 @@ +# makefile adapted from thomas grill's xsample makefile +# +# Makefile for gcc @ OSX (darwin) +# +# usage: +# to build run "make -f makefile.pd-darwin" +# to install (as root), do "make -f makefile.pd-darwin install" +# to install help, do "make -f makefile.pd-darwin install-help" +# + +CONFIG=config-pd-darwin.txt + +include ${CONFIG} + +FLEXTLIB=$(FLEXTPATH)/libflext.a + +# compiler stuff +INCLUDES=$(PDINC) ./headers/plugin_interface ./headers/common ./headers/server ./headers/app ./headers/lang +FLAGS=-DFLEXT_SYS=2 +CFLAGS=${UFLAGS} -dynamic -O2 -Wno-unused -Wno-parentheses -Wno-switch -Wstrict-prototypes -funroll-loops -fmove-all-movables -frerun-loop-opt -fno-rtti -fno-exceptions +LIBS=m gcc +LDFLAGS=$(FLEXTLIB) -bundle -bundle_loader $(PDBIN) +FRAMEWORKS=Carbon veclib + +# ---------------------------------------------- +# the rest can stay untouched +# ---------------------------------------------- + +NAME=tbext + +include make-files.txt + +MAKEFILE=makefile.pd-darwin +TARGET=$(TARGDIR)/$(NAME).pd_darwin + + +# default target +all: $(TARGDIR) $(TARGET) + +$(patsubst %,$(SRCDIR)/%,$(SRCS)): $(patsubst %,$(SRCDIR)/%,$(HDRS)) $(MAKEFILE) $(CONFIG) + touch $(patsubst %,$(SRCDIR)/%,$(SRCS)) + +$(TARGDIR): + -mkdir $(TARGDIR) + +$(TARGDIR)/%.o : $(SRCDIR)/%.cpp + $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(FLEXTPATH)) $< -o $@ + +$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS)) + $(CXX) $(LDFLAGS) $^ $(patsubst %,-framework %,$(FRAMEWORKS)) $(patsubst %,-L%,$(LIBPATH)) $(patsubst %,-l%,$(LIBS)) -o $@ + chmod 755 $@ + + +$(INSTDIR): + -mkdir $(INSTDIR) + +install:: $(INSTDIR) + +install:: $(TARGET) + cp -R $^ $(INSTDIR) +# chown -R root.root $(INSTDIR) + + +$(HELPDIR): + -mkdir $(HELPDIR) + +install-help:: $(HELPDIR) + +install-help:: ./pd + cp $^/*.* $(HELPDIR) +# chown -R root.root $(HELPDIR) + + +.PHONY: clean +clean: + rm -f $(TARGDIR)/*.o $(TARGET) + diff --git a/tbext/makefile.pd-mingw b/tbext/makefile.pd-mingw new file mode 100644 index 0000000..065930e --- /dev/null +++ b/tbext/makefile.pd-mingw @@ -0,0 +1,85 @@ +# makefile adapted from thomas grill's xsample makefile +# +# Makefile for gcc @ minGW +# +# usage: +# to build run "make -f makefile.pd-mingw" +# to install (as root), do "make -f makefile.pd-mingw install" +# + +CONFIG=config-pd-mingw.txt +MAKEFILE=makefile.pd-mingw + +include ${CONFIG} + + +# compiler stuff +INCLUDES=$(PDINC) ./headers/plugin_interface ./headers/common ./headers/server ./headers/app ./headers/lang + +FLAGS=-DFLEXT_SYS=2 +CFLAGS=-O2 -funroll-loops -fmove-all-movables -frerun-loop-opt -finline-functions -fno-rtti -fno-exceptions ${UFLAGS} + +PDLIBS=$(PD)/bin/pd.dll $(PD)/bin/pthreadVC.dll + + +ifdef FLEXT_SHARED + +CFLAGS+=-DFLEXT_SHARED +FLEXTLIB=$(FLEXTPATH)/flext.dll + +else + +FLEXTLIB=$(FLEXTPATH)/flext-pdwin.lib + +endif + + +# ---------------------------------------------- +# the rest can stay untouched +# ---------------------------------------------- + +NAME=tbext + +include make-files.txt + +TARGET=$(TARGDIR)/$(NAME).dll + +# default target +all: $(TARGDIR) $(TARGET) + +$(patsubst %,$(SRCDIR)/%,$(SRCS)): $(patsubst %,$(SRCDIR)/%,$(HDRS)) $(MAKEFILE) $(CONFIG) +# echo touch $(patsubst %,$(SRCDIR)/%,$(SRCS)) # minGW has no touch + +$(TARGDIR): + -mkdir $(TARGDIR) + +$(TARGDIR)/%.o : $(SRCDIR)/%.cpp + $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(FLEXTPATH)) $< -o $@ + +$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS)) $(FLEXTLIB) + $(CXX) -shared $(LDFLAGS) $^ ${PDLIBS} $(patsubst %,-l%,$(LIBS)) -o $@ + strip --strip-unneeded $@ + chmod 755 $@ + +$(INSTDIR): + -mkdir $(INSTDIR) + +install:: $(INSTDIR) + +install:: $(TARGET) + cp $^ $(INSTDIR) +# chown root.root $(patsubst %,$(INSTDIR)/%,$(notdir $^)) + +$(HELPDIR): + -mkdir $(HELPDIR) + +install-help:: $(HELPDIR) + +install-help:: ./pd + chmod 644 $^/*.* + cp $^/*.* $(HELPDIR) + + +.PHONY: clean +clean: + rm -f $(TARGDIR)/*.o $(TARGET) diff --git a/tbext/makefile.pd-msvc b/tbext/makefile.pd-msvc new file mode 100644 index 0000000..776ab09 --- /dev/null +++ b/tbext/makefile.pd-msvc @@ -0,0 +1,53 @@ +# makefile adapted from thomas grill's xsample makefile +# +# Makefile for MSVC++ 6 +# +# usage: +# to build run "make -f makefile.pd-msvc" +# + +!include config-pd-msvc.txt + +# includes +INCPATH=/I"$(MSVCPATH)\include" /I"$(PDPATH)\src" /I"$(FLEXTPATH)" /I"./headers/plugin_interface" /I"./headers/common" /I"/headers/server" /I"./headers/app" /I"./headers/lang +LIBPATH=/LIBPATH:"$(MSVCPATH)\lib" /LIBPATH:"$(PDPATH)\bin" /LIBPATH:"$(FLEXTPATH)" +LIBS=pd.lib pthreadVC.lib flext-pdwin.lib + +# compiler definitions and flags +DEFS=/DFLEXT_SYS=2 + +CFLAGS=/GR- /GX- /GD /G6 /Ox /EHsc /ML + +# the rest can stay untouched +# ---------------------------------------------- + +NAME=tbext + +!include make-files.txt + + +all: $(OUTPATH) $(OUTPATH)\$(NAME).dll + +# remove build +clean: + -del /q $(OUTPATH) > nul + -rmdir $(OUTPATH) > nul + +OBJS= $(SRCS:.cpp=.obj) + +$(OUTPATH): + -mkdir $(OUTPATH) > nul + +{$(SRCDIR)}.cpp{}.obj: + cl /c /LD $(CFLAGS) $(DEFS) $(INCPATH) $** /Fo$(OUTPATH)\$@ + +$(OUTPATH)\$(NAME).dll: $(OBJS) + cd $(OUTPATH) + link /DLL /out:$(NAME).dll /INCREMENTAL:NO $** $(LIBS) $(LIBPATH) + @-del *.exp + @-del *.lib + cd .. +!ifdef INSTPATH + @-if not exist $(INSTPATH) mkdir $(INSTPATH) + copy $@ $(INSTPATH) > nul +!endif -- cgit v1.2.1 From d25a145c5e18d32a43e60ea7be9c621bac83badf Mon Sep 17 00:00:00 2001 From: Tim Blechmann 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') 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 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') 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 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') 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 - -#include "fftw3.h" -#include - -#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 - -#include "fftw3.h" -#include - -#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 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') 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 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') 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 - -#include - -#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 - -#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 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') 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 Date: Tue, 7 Sep 2004 09:13:52 +0000 Subject: *** empty log message *** svn path=/trunk/externals/tb/; revision=2015 --- tbext/him.pd | 13 +++++++++++-- tbext/source/fftgrrev.cpp | 13 ++++--------- tbext/source/fftgrshuf.cpp | 16 ++++------------ tbext/source/fftgrsort.cpp | 15 ++++++--------- 4 files changed, 25 insertions(+), 32 deletions(-) (limited to 'tbext') diff --git a/tbext/him.pd b/tbext/him.pd index 7e15881..f287cdd 100644 --- a/tbext/him.pd +++ b/tbext/him.pd @@ -4,11 +4,11 @@ #X obj 125 122 tgl 15 1 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1; #X obj 51 15 hsl 128 15 1e-04 1 1 0 empty empty dt -2 -6 0 8 -262144 --1 -1 10400 0; +-1 -1 5100 0; #X msg 48 37 dt \$1; #X msg 80 84 e \$1; #X obj 83 65 hsl 128 15 -1 0 0 0 empty empty etilde -2 -6 0 8 -262144 --1 -1 6000 0; +-1 -1 7800 0; #X floatatom 122 85 5 0 0 0 - - -; #X floatatom 106 40 5 0 0 0 - - -; #X msg 158 177 reset; @@ -31,6 +31,11 @@ models of an atom in a magnetic field...; #X msg 607 252 mu -1.43572 \;; #X obj 608 228 t b b; #X msg 608 318 \; pd dsp 1; +#X obj 14 347 print~; +#X obj 14 292 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 262 236 fiddle~; +#X floatatom 263 273 5 0 0 0 - - -; #X connect 1 0 11 0; #X connect 2 0 1 0; #X connect 3 0 4 0; @@ -42,6 +47,8 @@ models of an atom in a magnetic field...; #X connect 9 0 11 0; #X connect 10 0 11 0; #X connect 11 0 0 0; +#X connect 11 0 24 0; +#X connect 11 0 26 0; #X connect 11 1 0 1; #X connect 11 2 0 0; #X connect 11 3 0 1; @@ -55,3 +62,5 @@ models of an atom in a magnetic field...; #X connect 22 1 21 0; #X connect 22 1 19 0; #X connect 22 1 20 0; +#X connect 25 0 24 0; +#X connect 26 3 27 0; 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 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') 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 + +#include +#include + + +#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 From 6c03ffeef182c00462a6d0375ed81dc0d9983124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Thu, 19 Jun 2008 13:50:58 +0000 Subject: removed the svn:executable bit for code, patches and text svn path=/trunk/externals/tb/; revision=10048 --- tbext/config-pd-darwin.txt | 0 tbext/config-pd-linux.txt | 0 tbext/make-files.txt | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 tbext/config-pd-darwin.txt mode change 100755 => 100644 tbext/config-pd-linux.txt mode change 100755 => 100644 tbext/make-files.txt (limited to 'tbext') diff --git a/tbext/config-pd-darwin.txt b/tbext/config-pd-darwin.txt old mode 100755 new mode 100644 diff --git a/tbext/config-pd-linux.txt b/tbext/config-pd-linux.txt old mode 100755 new mode 100644 diff --git a/tbext/make-files.txt b/tbext/make-files.txt old mode 100755 new mode 100644 -- cgit v1.2.1