From 0f1258611b064b215d1dd877f69e694fedf0d109 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Thu, 15 Jul 2004 19:03:22 +0000 Subject: further checkins svn path=/trunk/externals/tb/; revision=1866 --- sc4pd/source/support.cpp | 102 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 sc4pd/source/support.cpp (limited to 'sc4pd/source/support.cpp') diff --git a/sc4pd/source/support.cpp b/sc4pd/source/support.cpp new file mode 100644 index 0000000..2e06e9e --- /dev/null +++ b/sc4pd/source/support.cpp @@ -0,0 +1,102 @@ +/* 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: Nmperign & Guenter Mueller: More Gloom, More Light + +*/ + +#include +#include "SC_PlugIn.h" + +#include + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +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; +} + +float sc_getfloatarg (flext::AtomList a,int i) +{ + if (a.Count() > 0 && a.Count() > i) + return flext::GetAFloat(a[i]); + else + return 0; +} + +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 \ + uint32 s1 = rgen.s1; \ + uint32 s2 = rgen.s2; \ + uint32 s3 = rgen.s3; + +#define RPUT \ + rgen.s1 = s1; \ + rgen.s2 = s2; \ + rgen.s3 = s3; + +int32 timeseed() +{ + static int32 count = 0; + struct timeval tv; + gettimeofday(&tv, 0); + return (int32)tv.tv_sec ^ (int32)tv.tv_usec ^ count--; +} -- cgit v1.2.1 From 2bc701fec065db8d399498a8c2f4f4145acf3369 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Thu, 15 Jul 2004 21:34:12 +0000 Subject: the work of this evening ... svn path=/trunk/externals/tb/; revision=1868 --- sc4pd/source/support.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'sc4pd/source/support.cpp') diff --git a/sc4pd/source/support.cpp b/sc4pd/source/support.cpp index 2e06e9e..8d80bbe 100644 --- a/sc4pd/source/support.cpp +++ b/sc4pd/source/support.cpp @@ -35,15 +35,14 @@ */ #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 - bool sc_add (flext::AtomList a) { for (int i = 0; i!=a.Count();++i) @@ -96,7 +95,16 @@ bool sc_ar(flext::AtomList a) int32 timeseed() { static int32 count = 0; - struct timeval tv; - gettimeofday(&tv, 0); - return (int32)tv.tv_sec ^ (int32)tv.tv_usec ^ count--; + + double time = flext::GetOSTime(); + + double sec = trunc(time); + double usec = (time-sec)*1e6; + + time_t tsec = sec; + suseconds_t tusec =usec; /* not exacty the way, it's calculated + in SuperCollider, but it's only + the seed */ + + return (int32)tsec ^ (int32)tusec ^ count--; } -- cgit v1.2.1 From 5a8caf3981072a2184a17bd9a23c4b7b6f07feb7 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Fri, 30 Jul 2004 08:43:43 +0000 Subject: 0001's fixes svn path=/trunk/externals/tb/; revision=1898 --- sc4pd/source/support.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sc4pd/source/support.cpp') diff --git a/sc4pd/source/support.cpp b/sc4pd/source/support.cpp index 8d80bbe..5211b71 100644 --- a/sc4pd/source/support.cpp +++ b/sc4pd/source/support.cpp @@ -102,7 +102,7 @@ int32 timeseed() double usec = (time-sec)*1e6; time_t tsec = sec; - suseconds_t tusec =usec; /* not exacty the way, it's calculated + useconds_t tusec =usec; /* not exacty the way, it's calculated in SuperCollider, but it's only the seed */ -- 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.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'sc4pd/source/support.cpp') diff --git a/sc4pd/source/support.cpp b/sc4pd/source/support.cpp index 5211b71..fd87c86 100644 --- a/sc4pd/source/support.cpp +++ b/sc4pd/source/support.cpp @@ -34,14 +34,10 @@ */ -#include -#include -#include "SC_PlugIn.h" +#include "sc4pd.hpp" +#include -#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) -#error You need at least FLEXT version 0.4.6 -#endif bool sc_add (flext::AtomList a) { -- 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.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'sc4pd/source/support.cpp') diff --git a/sc4pd/source/support.cpp b/sc4pd/source/support.cpp index fd87c86..077ea45 100644 --- a/sc4pd/source/support.cpp +++ b/sc4pd/source/support.cpp @@ -77,16 +77,20 @@ bool sc_ar(flext::AtomList a) return false; } -// macros to put rgen state in registers -#define RGET \ - uint32 s1 = rgen.s1; \ - uint32 s2 = rgen.s2; \ - uint32 s3 = rgen.s3; - -#define RPUT \ - rgen.s1 = s1; \ - rgen.s2 = s2; \ - rgen.s3 = s3; +bool sc_inv(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,"inv"))==0) + return true; + } + } + return false; +} int32 timeseed() { -- 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.cpp | 74 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) (limited to 'sc4pd/source/support.cpp') diff --git a/sc4pd/source/support.cpp b/sc4pd/source/support.cpp index 077ea45..69aaf2b 100644 --- a/sc4pd/source/support.cpp +++ b/sc4pd/source/support.cpp @@ -108,3 +108,77 @@ int32 timeseed() return (int32)tsec ^ (int32)tusec ^ count--; } + +/* from Convolution.cpp */ +extern "C" +{ + float *cosTable[32]; + float *fftWindow[32]; +} + + +float* create_cosTable(int log2n) +{ + int size = 1 << log2n; + int size2 = size / 4 + 1; + float *win = (float*)malloc(size2 * sizeof(float)); + double winc = twopi / size; + for (int i=0; i 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.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sc4pd/source/support.cpp') diff --git a/sc4pd/source/support.cpp b/sc4pd/source/support.cpp index 69aaf2b..e753056 100644 --- a/sc4pd/source/support.cpp +++ b/sc4pd/source/support.cpp @@ -39,7 +39,7 @@ #include -bool sc_add (flext::AtomList a) +bool sc_add (flext::AtomList& a) { for (int i = 0; i!=a.Count();++i) { @@ -54,7 +54,7 @@ bool sc_add (flext::AtomList a) return false; } -float sc_getfloatarg (flext::AtomList a,int i) +float sc_getfloatarg (flext::AtomList& a,int i) { if (a.Count() > 0 && a.Count() > i) return flext::GetAFloat(a[i]); @@ -62,7 +62,7 @@ float sc_getfloatarg (flext::AtomList a,int i) return 0; } -bool sc_ar(flext::AtomList a) +bool sc_ar(flext::AtomList& a) { for (int i = 0; i!=a.Count();++i) { @@ -77,7 +77,7 @@ bool sc_ar(flext::AtomList a) return false; } -bool sc_inv(flext::AtomList a) +bool sc_inv(flext::AtomList& a) { for (int i = 0; i!=a.Count();++i) { -- cgit v1.2.1