From 1bf32780fe1281eda6deb51f661f2f234a16fd1f Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Mon, 2 Aug 2004 20:13:59 +0000 Subject: *** empty log message *** svn path=/trunk/externals/tb/; revision=1904 --- sc4pd/source/sc4pd.hpp | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 sc4pd/source/sc4pd.hpp (limited to 'sc4pd/source/sc4pd.hpp') diff --git a/sc4pd/source/sc4pd.hpp b/sc4pd/source/sc4pd.hpp new file mode 100644 index 0000000..214b80c --- /dev/null +++ b/sc4pd/source/sc4pd.hpp @@ -0,0 +1,60 @@ +/* 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: Morton Feldman: For John Cage + +*/ + +#include + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + +#include "SC_PlugIn.h" +#include "support.hpp" + +/* 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()) + + + + +/* to make sure the behaviour is consistent: */ + +#undef ZXP +#define ZXP(z) (*(z)++) + -- cgit v1.2.1 From 78431322cc77b9654fa4a2e2b1b42a9310cb9141 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Mon, 2 Aug 2004 21:13:50 +0000 Subject: lag svn path=/trunk/externals/tb/; revision=1905 --- sc4pd/source/sc4pd.hpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'sc4pd/source/sc4pd.hpp') diff --git a/sc4pd/source/sc4pd.hpp b/sc4pd/source/sc4pd.hpp index 214b80c..d26e09e 100644 --- a/sc4pd/source/sc4pd.hpp +++ b/sc4pd/source/sc4pd.hpp @@ -48,9 +48,7 @@ // 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()) - - +#define CALCSLOPE(next,prev) ((next - prev) * 1/ Blocksize()) /* to make sure the behaviour is consistent: */ -- cgit v1.2.1 From b85f8bc7af3fda0f31af1c79a9f25145b8004705 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Tue, 3 Aug 2004 09:56:19 +0000 Subject: works of one morning svn path=/trunk/externals/tb/; revision=1906 --- sc4pd/source/sc4pd.hpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'sc4pd/source/sc4pd.hpp') diff --git a/sc4pd/source/sc4pd.hpp b/sc4pd/source/sc4pd.hpp index d26e09e..f1f90e2 100644 --- a/sc4pd/source/sc4pd.hpp +++ b/sc4pd/source/sc4pd.hpp @@ -34,6 +34,9 @@ */ +#ifndef _SC4PD_HPP +#define _SC$PD_HPP + #include #if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) @@ -51,8 +54,24 @@ #define CALCSLOPE(next,prev) ((next - prev) * 1/ Blocksize()) + +//#define SAMPLERATE (unit->mRate->mSampleRate) +#undef SAMPLERATE +#define SAMPLERATE Samplerate() + +//#define BUFLENGTH (unit->mBufLength) +#undef BUFLENGTH +#define BUFLENGTH Blocksize() + + + /* to make sure the behaviour is consistent: */ #undef ZXP #define ZXP(z) (*(z)++) + + + + +#endif -- cgit v1.2.1 From 89f570e5ebeab979202acf679974bafd05072692 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sat, 7 Aug 2004 14:01:31 +0000 Subject: sc4pd_dsp class and other changes svn path=/trunk/externals/tb/; revision=1912 --- sc4pd/source/sc4pd.hpp | 61 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 56 insertions(+), 5 deletions(-) (limited to 'sc4pd/source/sc4pd.hpp') diff --git a/sc4pd/source/sc4pd.hpp b/sc4pd/source/sc4pd.hpp index f1f90e2..eacbfff 100644 --- a/sc4pd/source/sc4pd.hpp +++ b/sc4pd/source/sc4pd.hpp @@ -35,7 +35,6 @@ */ #ifndef _SC4PD_HPP -#define _SC$PD_HPP #include @@ -63,8 +62,6 @@ #undef BUFLENGTH #define BUFLENGTH Blocksize() - - /* to make sure the behaviour is consistent: */ #undef ZXP @@ -72,6 +69,60 @@ - - +class sc4pd_dsp + : public flext_dsp +{ + FLEXT_HEADER(sc4pd_dsp,flext_dsp); + + +/* some initialisation functions, adapted from SC_Rate.cpp*/ + + inline float sc_sampledur() + { + return 1 / Samplerate(); + } + + inline float sc_radianspersample() + { + return twopi / Samplerate(); + } + + inline float sc_bufduration() + { + return Blocksize() / Samplerate(); + } + + inline float sc_bufrate() + { + return 1 / sc_bufduration(); + } + + inline float sc_slopefactor() + { + return 1 / Blocksize(); + } + + inline float sc_filterloops() + { + return Blocksize() / 3; + } + + inline float sc_filterremain() + { + return Blocksize() % 3; + } + + inline float sc_filterslope() + { + float f = sc_filterloops(); + if (f == 0) + return 0; + else + return 1. / f; + } + +}; + + +#define _SC$PD_HPP #endif -- cgit v1.2.1 From 13803d97db1f5f234cb2358d255b86571f93cdb9 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sat, 7 Aug 2004 20:45:34 +0000 Subject: *** empty log message *** svn path=/trunk/externals/tb/; revision=1914 --- sc4pd/source/sc4pd.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sc4pd/source/sc4pd.hpp') diff --git a/sc4pd/source/sc4pd.hpp b/sc4pd/source/sc4pd.hpp index eacbfff..f80b177 100644 --- a/sc4pd/source/sc4pd.hpp +++ b/sc4pd/source/sc4pd.hpp @@ -102,12 +102,12 @@ class sc4pd_dsp return 1 / Blocksize(); } - inline float sc_filterloops() + inline int sc_filterloops() { return Blocksize() / 3; } - inline float sc_filterremain() + inline int sc_filterremain() { return Blocksize() % 3; } -- 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/sc4pd.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sc4pd/source/sc4pd.hpp') diff --git a/sc4pd/source/sc4pd.hpp b/sc4pd/source/sc4pd.hpp index f80b177..13d82c0 100644 --- a/sc4pd/source/sc4pd.hpp +++ b/sc4pd/source/sc4pd.hpp @@ -124,5 +124,5 @@ class sc4pd_dsp }; -#define _SC$PD_HPP +#define _SC4PD_HPP #endif -- cgit v1.2.1