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