From d0ae3caca5828675335d3b19ab5dd987e7369b23 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Wed, 14 Jul 2004 16:21:44 +0000 Subject: This commit was generated by cvs2svn to compensate for changes in r1857, which included commits to RCS files with non-trunk default branches. svn path=/trunk/externals/tb/; revision=1858 --- sc4pd/source/support.hpp | 80 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 sc4pd/source/support.hpp (limited to 'sc4pd/source/support.hpp') diff --git a/sc4pd/source/support.hpp b/sc4pd/source/support.hpp new file mode 100644 index 0000000..8456f4d --- /dev/null +++ b/sc4pd/source/support.hpp @@ -0,0 +1,80 @@ +/* sc4pd: + support functions + + Copyright (c) 2004 Tim Blechmann. + + This code is derived from: + SuperCollider real time audio synthesis system + Copyright (c) 2002 James McCartney. All rights reserved. + http://www.audiosynth.com + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; 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. + http://www.crca.ucsd.edu/~msp/software.html + FLEXT by Thomas Grill + http://www.parasitaere-kapazitaeten.net/ext + SuperCollider by James McCartney + http://www.audiosynth.com + + Coded while listening to: Phosphor + +*/ + +#include +#include + +#include +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +inline bool sc_add (flext::AtomList a) +{ + for (int i = 0; i!=a.Count();++i) + { + if ( flext::IsSymbol(a[i]) ) + { + const char * teststring; + teststring = flext::GetString(a[i]); + if((strcmp(teststring,"add"))==0) + return true; + } + } + return false; +} + +inline float sc_getfloatarg (flext::AtomList a,int i) +{ + if (a.Count() >0 || a.Count() Date: Wed, 14 Jul 2004 18:29:52 +0000 Subject: update & bugfix svn path=/trunk/externals/tb/; revision=1859 --- sc4pd/source/support.hpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'sc4pd/source/support.hpp') diff --git a/sc4pd/source/support.hpp b/sc4pd/source/support.hpp index 8456f4d..b6d67a8 100644 --- a/sc4pd/source/support.hpp +++ b/sc4pd/source/support.hpp @@ -60,12 +60,26 @@ inline bool sc_add (flext::AtomList a) inline float sc_getfloatarg (flext::AtomList a,int i) { - if (a.Count() >0 || a.Count() 0 && a.Count() > i) return flext::GetAFloat(a[i]); else return 0; } +inline bool sc_ar(flext::AtomList a) +{ + for (int i = 0; i!=a.Count();++i) + { + if ( flext::IsSymbol(a[i]) ) + { + const char * teststring; + teststring = flext::GetString(a[i]); + if((strcmp(teststring,"ar"))==0) + return true; + } + } + return false; +} // macros to put rgen state in registers #define RGET \ -- cgit v1.2.1 From 9ecfff90135ec05498f9f55a39cd386c855a8571 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Thu, 15 Jul 2004 19:05:05 +0000 Subject: rng have setable seed and other changes svn path=/trunk/externals/tb/; revision=1867 --- sc4pd/source/support.hpp | 48 ++++++++++-------------------------------------- 1 file changed, 10 insertions(+), 38 deletions(-) (limited to 'sc4pd/source/support.hpp') diff --git a/sc4pd/source/support.hpp b/sc4pd/source/support.hpp index b6d67a8..79faff5 100644 --- a/sc4pd/source/support.hpp +++ b/sc4pd/source/support.hpp @@ -35,51 +35,22 @@ */ #include -#include +//#include +#include "SC_PlugIn.h" -#include + +//#include #if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) #error You need at least FLEXT version 0.4.6 #endif +/* for argument parsing */ +bool sc_add (flext::AtomList a); +float sc_getfloatarg (flext::AtomList a,int i); +bool sc_ar(flext::AtomList a); -inline bool sc_add (flext::AtomList a) -{ - for (int i = 0; i!=a.Count();++i) - { - if ( flext::IsSymbol(a[i]) ) - { - const char * teststring; - teststring = flext::GetString(a[i]); - if((strcmp(teststring,"add"))==0) - return true; - } - } - return false; -} - -inline float sc_getfloatarg (flext::AtomList a,int i) -{ - if (a.Count() > 0 && a.Count() > i) - return flext::GetAFloat(a[i]); - else - return 0; -} -inline bool sc_ar(flext::AtomList a) -{ - for (int i = 0; i!=a.Count();++i) - { - if ( flext::IsSymbol(a[i]) ) - { - const char * teststring; - teststring = flext::GetString(a[i]); - if((strcmp(teststring,"ar"))==0) - return true; - } - } - return false; -} +/* for rngs */ // macros to put rgen state in registers #define RGET \ @@ -92,3 +63,4 @@ inline bool sc_ar(flext::AtomList a) rgen.s2 = s2; \ rgen.s3 = s3; +int32 timeseed(); -- cgit v1.2.1 From 732d85194f69cc1d6b72d67e48211799cd5583e3 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sun, 1 Aug 2004 19:00:30 +0000 Subject: checkin: lfpulse, lfsaw svn path=/trunk/externals/tb/; revision=1901 --- sc4pd/source/support.hpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'sc4pd/source/support.hpp') diff --git a/sc4pd/source/support.hpp b/sc4pd/source/support.hpp index 79faff5..d05497e 100644 --- a/sc4pd/source/support.hpp +++ b/sc4pd/source/support.hpp @@ -64,3 +64,32 @@ bool sc_ar(flext::AtomList a); rgen.s3 = s3; int32 timeseed(); + + +/* this is copied from thomas grill's xsample: +xsample - extended sample objects for Max/MSP and pd (pure data) + +Copyright (c) 2001-2004 Thomas Grill (xovo@gmx.net) +For information on usage and redistribution, and for a DISCLAIMER OF ALL +WARRANTIES, see the file, "license.txt," in this distribution. +*/ + +#define F float +#define D double +#define I int +#define L long +#define C char +#define V void +#define BL bool +#define S t_sample + +#define SETSIGFUN(VAR,FUN) v_##VAR = FUN + +#define DEFSIGFUN(NAME) V NAME(I n,S *const *in,S *const *out) + +#define DEFSIGCALL(NAME) \ + inline V NAME(I n,S *const *in,S *const *out) \ + { (this->*v_##NAME)(n,in,out); } \ + V (thisType::*v_##NAME)(I n,S *const *invecs,S *const *outvecs) + +#define SIGFUN(FUN) &thisType::FUN -- cgit v1.2.1 From 0d2a4d810fdc7ecbe67de784d4eb901cd5699c38 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sun, 1 Aug 2004 20:51:11 +0000 Subject: some more ugens svn path=/trunk/externals/tb/; revision=1902 --- sc4pd/source/support.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sc4pd/source/support.hpp') diff --git a/sc4pd/source/support.hpp b/sc4pd/source/support.hpp index d05497e..bb5537a 100644 --- a/sc4pd/source/support.hpp +++ b/sc4pd/source/support.hpp @@ -93,3 +93,11 @@ WARRANTIES, see the file, "license.txt," in this distribution. V (thisType::*v_##NAME)(I n,S *const *invecs,S *const *outvecs) #define SIGFUN(FUN) &thisType::FUN + + +/* this macro has to be redefined to work with flext */ + +// calculate a slope for control rate interpolation to audio rate. +//#define CALCSLOPE(next,prev) ((next - prev) * unit->mRate->mSlopeFactor) +#undef CALCSLOPE +#define CALCSLOPE(next,prev) ((next - prev) * 1/Blocksize()) -- cgit v1.2.1 From 5e1268fb9920b248ee377797b130605f669c6dee Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Mon, 2 Aug 2004 19:18:22 +0000 Subject: main header file svn path=/trunk/externals/tb/; revision=1903 --- sc4pd/source/support.hpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'sc4pd/source/support.hpp') diff --git a/sc4pd/source/support.hpp b/sc4pd/source/support.hpp index bb5537a..34e260a 100644 --- a/sc4pd/source/support.hpp +++ b/sc4pd/source/support.hpp @@ -95,9 +95,3 @@ WARRANTIES, see the file, "license.txt," in this distribution. #define SIGFUN(FUN) &thisType::FUN -/* this macro has to be redefined to work with flext */ - -// calculate a slope for control rate interpolation to audio rate. -//#define CALCSLOPE(next,prev) ((next - prev) * unit->mRate->mSlopeFactor) -#undef CALCSLOPE -#define CALCSLOPE(next,prev) ((next - prev) * 1/Blocksize()) -- cgit v1.2.1 From f91b27f71b88c45202afe0baf9776e30c4177e19 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Tue, 3 Aug 2004 17:51:51 +0000 Subject: small changes svn path=/trunk/externals/tb/; revision=1907 --- sc4pd/source/support.hpp | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'sc4pd/source/support.hpp') diff --git a/sc4pd/source/support.hpp b/sc4pd/source/support.hpp index 34e260a..6b51f2b 100644 --- a/sc4pd/source/support.hpp +++ b/sc4pd/source/support.hpp @@ -34,16 +34,18 @@ */ +#ifndef _SUPPORT_HPP +#define _SUPPORT_HPP + #include -//#include #include "SC_PlugIn.h" -//#include #if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) #error You need at least FLEXT version 0.4.6 #endif + /* for argument parsing */ bool sc_add (flext::AtomList a); float sc_getfloatarg (flext::AtomList a,int i); @@ -65,6 +67,32 @@ bool sc_ar(flext::AtomList a); int32 timeseed(); +/* cubic interpolation from DelayUGens.cpp */ +inline float cubicinterp(float x, float y0, float y1, float y2, float y3) +{ + // 4-point, 3rd-order Hermite (x-form) + float c0 = y1; + float c1 = 0.5f * (y2 - y0); + float c2 = y0 - 2.5f * y1 + 2.f * y2 - 0.5f * y3; + float c3 = 0.5f * (y3 - y0) + 1.5f * (y1 - y2); + + return ((c3 * x + c2) * x + c1) * x + c0; +} + +/* feedback calculation from DelayUGens.cpp */ +inline float CalcFeedback(float delaytime, float decaytime) +{ + if (delaytime == 0.f) { + return 0.f; + } else if (decaytime > 0.f) { + return exp(log001 * delaytime / decaytime); + } else if (decaytime < 0.f) { + return -exp(log001 * delaytime / -decaytime); + } else { + return 0.f; + } +} + /* this is copied from thomas grill's xsample: xsample - extended sample objects for Max/MSP and pd (pure data) @@ -95,3 +123,4 @@ WARRANTIES, see the file, "license.txt," in this distribution. #define SIGFUN(FUN) &thisType::FUN +#endif -- cgit v1.2.1 From db776d8e3f345623f03c3cc7703b30719304498f Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sun, 8 Aug 2004 11:10:30 +0000 Subject: some filters svn path=/trunk/externals/tb/; revision=1917 --- sc4pd/source/support.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'sc4pd/source/support.hpp') diff --git a/sc4pd/source/support.hpp b/sc4pd/source/support.hpp index 6b51f2b..3972c83 100644 --- a/sc4pd/source/support.hpp +++ b/sc4pd/source/support.hpp @@ -122,5 +122,14 @@ WARRANTIES, see the file, "license.txt," in this distribution. #define SIGFUN(FUN) &thisType::FUN +#undef F +#undef D +#undef I +#undef L +#undef C +#undef V +#undef BL +#undef S + #endif -- cgit v1.2.1 From 8e34dec617b67c4b8d8928188d175f850d6a69c4 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Thu, 9 Sep 2004 08:45:18 +0000 Subject: lfdnoises and interpolating vector/scalar operations svn path=/trunk/externals/tb/; revision=2021 --- sc4pd/source/support.hpp | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) (limited to 'sc4pd/source/support.hpp') diff --git a/sc4pd/source/support.hpp b/sc4pd/source/support.hpp index 3972c83..a9258e8 100644 --- a/sc4pd/source/support.hpp +++ b/sc4pd/source/support.hpp @@ -50,6 +50,7 @@ bool sc_add (flext::AtomList a); float sc_getfloatarg (flext::AtomList a,int i); bool sc_ar(flext::AtomList a); +bool sc_inv(flext::AtomList a); /* for rngs */ @@ -94,7 +95,7 @@ inline float CalcFeedback(float delaytime, float decaytime) } -/* this is copied from thomas grill's xsample: +/* this is adapted from thomas grill's xsample: xsample - extended sample objects for Max/MSP and pd (pure data) Copyright (c) 2001-2004 Thomas Grill (xovo@gmx.net) @@ -102,34 +103,17 @@ For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. */ -#define F float -#define D double -#define I int -#define L long -#define C char -#define V void -#define BL bool -#define S t_sample - #define SETSIGFUN(VAR,FUN) v_##VAR = FUN -#define DEFSIGFUN(NAME) V NAME(I n,S *const *in,S *const *out) +#define DEFSIGFUN(NAME) void NAME(int n,t_sample *const *in,t_sample *const *out) #define DEFSIGCALL(NAME) \ - inline V NAME(I n,S *const *in,S *const *out) \ + inline void NAME(int n,t_sample *const *in,t_sample *const *out) \ { (this->*v_##NAME)(n,in,out); } \ - V (thisType::*v_##NAME)(I n,S *const *invecs,S *const *outvecs) + void (thisType::*v_##NAME)(int n,t_sample *const *invecs,t_sample *const *outvecs) #define SIGFUN(FUN) &thisType::FUN -#undef F -#undef D -#undef I -#undef L -#undef C -#undef V -#undef BL -#undef S #endif -- cgit v1.2.1 From ba1866d2b465633b6d4b3ebbba2c6dc6c0e25d6b Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sat, 11 Sep 2004 08:10:45 +0000 Subject: ... svn path=/trunk/externals/tb/; revision=2024 --- sc4pd/source/support.hpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sc4pd/source/support.hpp') diff --git a/sc4pd/source/support.hpp b/sc4pd/source/support.hpp index a9258e8..c9cedae 100644 --- a/sc4pd/source/support.hpp +++ b/sc4pd/source/support.hpp @@ -115,5 +115,10 @@ WARRANTIES, see the file, "license.txt," in this distribution. #define SIGFUN(FUN) &thisType::FUN +/* from Convolution.cpp */ +void init_ffts(); +float* create_fftwindow(int log2n); +float* create_cosTable(int log2n); +void DoWindowing(int log2n, float * fftbuf, int bufsize); #endif -- cgit v1.2.1 From e50bf5fa3c18516c4bbebb0149cdee83d2c8ae57 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Mon, 2 May 2005 14:48:25 +0000 Subject: fixed compiling failure ... added support for flext build system ... thnx thomas svn path=/trunk/externals/tb/; revision=2881 --- sc4pd/source/support.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sc4pd/source/support.hpp') diff --git a/sc4pd/source/support.hpp b/sc4pd/source/support.hpp index c9cedae..12885cb 100644 --- a/sc4pd/source/support.hpp +++ b/sc4pd/source/support.hpp @@ -47,10 +47,10 @@ /* for argument parsing */ -bool sc_add (flext::AtomList a); -float sc_getfloatarg (flext::AtomList a,int i); -bool sc_ar(flext::AtomList a); -bool sc_inv(flext::AtomList a); +bool sc_add (flext::AtomList& a); +float sc_getfloatarg (flext::AtomList& a,int i); +bool sc_ar(flext::AtomList& a); +bool sc_inv(flext::AtomList& a); /* for rngs */ -- cgit v1.2.1