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/BrownNoise.cpp | 150 ++++++++++++++++++++++++++++ sc4pd/source/ClipNoise.cpp | 130 +++++++++++++++++++++++++ sc4pd/source/Crackle.cpp | 161 +++++++++++++++++++++++++++++++ sc4pd/source/Dust.cpp | 179 ++++++++++++++++++++++++++++++++++ sc4pd/source/Dust2.cpp | 180 ++++++++++++++++++++++++++++++++++ sc4pd/source/GrayNoise.cpp | 137 ++++++++++++++++++++++++++ sc4pd/source/Hasher.cpp | 122 +++++++++++++++++++++++ sc4pd/source/MantissaMask.cpp | 160 ++++++++++++++++++++++++++++++ sc4pd/source/Median.cpp | 220 ++++++++++++++++++++++++++++++++++++++++++ sc4pd/source/PinkNoise.cpp | 168 ++++++++++++++++++++++++++++++++ sc4pd/source/WhiteNoise.cpp | 130 +++++++++++++++++++++++++ sc4pd/source/main.cpp | 91 +++++++++++++++++ sc4pd/source/support.hpp | 80 +++++++++++++++ sc4pd/source/template.cpp | 43 +++++++++ 14 files changed, 1951 insertions(+) create mode 100644 sc4pd/source/BrownNoise.cpp create mode 100644 sc4pd/source/ClipNoise.cpp create mode 100644 sc4pd/source/Crackle.cpp create mode 100644 sc4pd/source/Dust.cpp create mode 100644 sc4pd/source/Dust2.cpp create mode 100644 sc4pd/source/GrayNoise.cpp create mode 100644 sc4pd/source/Hasher.cpp create mode 100644 sc4pd/source/MantissaMask.cpp create mode 100644 sc4pd/source/Median.cpp create mode 100644 sc4pd/source/PinkNoise.cpp create mode 100644 sc4pd/source/WhiteNoise.cpp create mode 100644 sc4pd/source/main.cpp create mode 100644 sc4pd/source/support.hpp create mode 100644 sc4pd/source/template.cpp (limited to 'sc4pd/source') diff --git a/sc4pd/source/BrownNoise.cpp b/sc4pd/source/BrownNoise.cpp new file mode 100644 index 0000000..39cbc26 --- /dev/null +++ b/sc4pd/source/BrownNoise.cpp @@ -0,0 +1,150 @@ +/* sc4pd + BrownNoise, BrownNoise~ + + 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: AMM: Laminal + +*/ + +#include +#include "SC_PlugIn.h" +#include "support.hpp" + + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +/* ------------------------ BrownNoise~ -------------------------------*/ + +class BrownNoise_ar: + public flext_dsp +{ + FLEXT_HEADER(BrownNoise_ar,flext_dsp); + +public: + BrownNoise_ar(int argc, t_atom *argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + +private: + float m_level; + RGen rgen; +}; + +FLEXT_LIB_DSP_V("BrownNoise~",BrownNoise_ar); + +BrownNoise_ar::BrownNoise_ar(int argc, t_atom *argv) +{ + + //parse arguments + AtomList Args(argc,argv); + + rgen.init(0); //set seed to 0 + m_level=rgen.frand2(); + + AddOutSignal(); +} + + +void BrownNoise_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + + RGET; + + float z = m_level; + + for (int i = 0; i!= n;++i) + { + z += frand8(s1, s2, s3); + if (z > 1.f) + z = 2.f - z; + else + if (z < -1.f) + z = -2.f - z; + (*(nout)++) = z; + } + m_level = z; + + RPUT; +} + + +/* ------------------------ BrownNoise ---------------------------------*/ + +class BrownNoise_kr: + public flext_base +{ + FLEXT_HEADER(BrownNoise_kr,flext_base); + +public: + BrownNoise_kr(int argc, t_atom *argv); + +protected: + void m_perform(); + +private: + float m_level; + RGen rgen; + FLEXT_CALLBACK(m_perform); +}; + +FLEXT_LIB_V("BrownNoise",BrownNoise_kr); + +BrownNoise_kr::BrownNoise_kr(int argc, t_atom *argv) +{ + FLEXT_ADDBANG(0,m_perform); + + //parse arguments + AtomList Args(argc,argv); + + rgen.init(0); //set seed to 0 + m_level=rgen.frand2(); + + AddOutFloat(); +} + +void BrownNoise_kr::m_perform() +{ + float z = m_level + rgen.frand8(); + if (z > 1.f) + z = 2.f - z; + else + if (z < -1.f) + z = -2.f - z; + ToOutFloat(0,z); + m_level = z; +} diff --git a/sc4pd/source/ClipNoise.cpp b/sc4pd/source/ClipNoise.cpp new file mode 100644 index 0000000..14b5101 --- /dev/null +++ b/sc4pd/source/ClipNoise.cpp @@ -0,0 +1,130 @@ +/* sc4pd + ClipNoise, ClipNoise~ + + 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: Henry Threadgill: Everybodys Mouth's A Book + +*/ + +#include +#include "SC_PlugIn.h" +#include "support.hpp" + + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +/* ------------------------ ClipNoise~ -------------------------------*/ + +class ClipNoise_ar: + public flext_dsp +{ + FLEXT_HEADER(ClipNoise_ar,flext_dsp); + +public: + ClipNoise_ar(int argc, t_atom *argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + +private: + RGen rgen; +}; + +FLEXT_LIB_DSP_V("ClipNoise~",ClipNoise_ar); + +ClipNoise_ar::ClipNoise_ar(int argc, t_atom *argv) +{ + + //parse arguments + AtomList Args(argc,argv); + + rgen.init(0); //set seed to 0 + + AddOutSignal(); +} + + +void ClipNoise_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + + RGET; + + for (int i = 0; i!= n;++i) + { + (*(nout)++) = fcoin(s1, s2, s3); + } + + RPUT; +} + + +/* ------------------------ ClipNoise ---------------------------------*/ + +class ClipNoise_kr: + public flext_base +{ + FLEXT_HEADER(ClipNoise_kr,flext_base); + +public: + ClipNoise_kr(int argc, t_atom *argv); + +protected: + void m_perform(); + +private: + RGen rgen; + FLEXT_CALLBACK(m_perform); +}; + +FLEXT_LIB_V("ClipNoise",ClipNoise_kr); + +ClipNoise_kr::ClipNoise_kr(int argc, t_atom *argv) +{ + FLEXT_ADDBANG(0,m_perform); + + //parse arguments + AtomList Args(argc,argv); + + rgen.init(0); //set seed to 0 + + AddOutFloat(); +} + +void ClipNoise_kr::m_perform() +{ + ToOutFloat(0,rgen.fcoin()); +} diff --git a/sc4pd/source/Crackle.cpp b/sc4pd/source/Crackle.cpp new file mode 100644 index 0000000..a86ea18 --- /dev/null +++ b/sc4pd/source/Crackle.cpp @@ -0,0 +1,161 @@ +/* sc4pd + Crackle, Crackle~ + + 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: David S. Ware: Threads + +*/ + +#include +#include "SC_PlugIn.h" +#include "support.hpp" + + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +/* ------------------------ Crackle~ -------------------------------*/ + +class Crackle_ar: + public flext_dsp +{ + FLEXT_HEADER(Crackle_ar,flext_dsp); + +public: + Crackle_ar(int argc, t_atom *argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + + void m_set(float f) + { + m_paramf = f; + } + +private: + FLEXT_CALLBACK_F(m_set); + float m_paramf; + float m_y1, m_y2; +}; + +FLEXT_LIB_DSP_V("Crackle~",Crackle_ar); + +Crackle_ar::Crackle_ar(int argc, t_atom *argv) + : m_y1(0.3f),m_y2(0.f) +{ + FLEXT_ADDMETHOD_(0,"set",m_set); + //parse arguments + AtomList Args(argc,argv); + m_paramf=sc_getfloatarg(Args,0); + + if (m_paramf == 0) + m_paramf = 1; + + AddOutSignal(); +} + + +void Crackle_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + + float paramf = m_paramf; + float y1 = m_y1; + float y2 = m_y2; + float y0; + + for (int i = 0; i!= n;++i) + { + (*(nout)++) = y0 = fabs(y1 * paramf - y2 - 0.05f); + y2 = y1; + y1 = y0; + } + + m_y1=y1; + m_y2=y2; +} + + +/* ------------------------ Crackle ---------------------------------*/ + +class Crackle_kr: + public flext_base +{ + FLEXT_HEADER(Crackle_kr,flext_base); + +public: + Crackle_kr(int argc, t_atom *argv); + +protected: + void m_perform(); + + void m_set(float f) + { + m_paramf = f; + } + +private: + float m_paramf; + float m_y1, m_y2; + FLEXT_CALLBACK(m_perform); + FLEXT_CALLBACK_F(m_set); +}; + +FLEXT_LIB_V("Crackle",Crackle_kr); + +Crackle_kr::Crackle_kr(int argc, t_atom *argv) + : m_y1(0.3f),m_y2(0.f) +{ + FLEXT_ADDBANG(0,m_perform); + FLEXT_ADDMETHOD_(0,"set",m_set); + + //parse arguments + AtomList Args(argc,argv); + m_paramf=sc_getfloatarg(Args,0); + + if (m_paramf == 0) + m_paramf = 1; + + AddOutFloat(); +} + +void Crackle_kr::m_perform() +{ + float y0 = fabs(m_y1 * m_paramf - m_y2 - 0.05f); + m_y2 = m_y1; + m_y1 = y0; + + ToOutFloat(0,y0); +} diff --git a/sc4pd/source/Dust.cpp b/sc4pd/source/Dust.cpp new file mode 100644 index 0000000..19b6312 --- /dev/null +++ b/sc4pd/source/Dust.cpp @@ -0,0 +1,179 @@ +/* sc4pd: + Dust, Dust~ + + 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: Assif Tsahar & Tatsuya Nakatani: Come Sunday +*/ + +#include +#include "SC_PlugIn.h" +#include "support.hpp" + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + +/* ------------------------ Dust~ -------------------------------------*/ + +class Dust_ar: + public flext_dsp +{ + FLEXT_HEADER(Dust_ar,flext_dsp); + +public: + Dust_ar(int argc, t_atom *argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + virtual void m_dsp (int n,t_signalvec const * insigs, + t_signalvec const * outsigs); + + void m_set(float f) + { + m_density = f; + m_thresh = m_density/Samplerate(); + m_scale = m_thresh > 0.f ? 1.f / m_thresh : 0.f; + } + +private: + FLEXT_CALLBACK_F(m_set); + float m_density, m_thresh, m_scale; + RGen rgen; + +}; + +FLEXT_LIB_DSP_V("Dust~",Dust_ar); + +Dust_ar::Dust_ar(int argc, t_atom *argv) +{ + FLEXT_ADDMETHOD_(0,"set",m_set); + + //parse arguments + AtomList Args(argc,argv); + m_density=sc_getfloatarg(Args,0); + + rgen.init(0); //set seed to 0 + + AddOutSignal(); +} + +void Dust_ar::m_dsp(int n,t_signalvec const * insigs, + t_signalvec const * outsigs) +{ + m_thresh = m_density/Samplerate(); + m_scale = m_thresh > 0.f ? 1.f / m_thresh : 0.f; +} + +void Dust_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + + RGET; + float thresh = m_thresh; + float scale = m_scale; + + for (int i = 0; i!= n;++i) + { + float z = frand(s1,s2,s3); + if (z < thresh) + (*(nout)++) = z * scale; + else + (*(nout)++) = 0.f; + } + + RPUT; +} + + +/* ------------------------ Dust ---------------------------------------*/ + +class Dust_kr: + public flext_base +{ + FLEXT_HEADER(Dust_kr,flext_base); + +public: + Dust_kr(int argc, t_atom *argv); + +protected: + void m_set(float f); + Timer Dust_timer; + void m_doit(); + +private: + float m_density, m_scale; + float mtbt; //medium time between trigger + RGen rgen; + FLEXT_CALLBACK_1(m_set,float); + FLEXT_CALLBACK_T(m_doit); +}; + +FLEXT_LIB_V("Dust",Dust_kr); + +Dust_kr::Dust_kr(int argc, t_atom *argv) + : Dust_timer(false) +{ + FLEXT_ADDMETHOD(0,m_set); + + //parse arguments + AtomList Args(argc,argv); + m_density=sc_getfloatarg(Args,0); + + rgen.init(0); //set seed to 0 + AddOutFloat(); + + FLEXT_ADDTIMER(Dust_timer,m_doit); + + m_set(m_density); +} + +void Dust_kr::m_set(float f) +{ + Dust_timer.Reset(); + + if(f==0) + { + return; + } + m_density = f; + mtbt = 1/f*1000; + + Dust_timer.Delay(mtbt * 0.002 * rgen.frand()); +} + +void Dust_kr::m_doit() +{ + ToOutFloat(0,rgen.frand()); + + Dust_timer.Delay(mtbt * 0.002 * rgen.frand()); +} diff --git a/sc4pd/source/Dust2.cpp b/sc4pd/source/Dust2.cpp new file mode 100644 index 0000000..a8cbbc3 --- /dev/null +++ b/sc4pd/source/Dust2.cpp @@ -0,0 +1,180 @@ +/* sc4pd: + Dust2, Dust2~ + + 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: Herbert Eimert: Epitaph für Aikichi Kuboyama + +*/ + +#include +#include "SC_PlugIn.h" +#include "support.hpp" + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + +/* ------------------------ Dust2~ -------------------------------------*/ + +class Dust2_ar: + public flext_dsp +{ + FLEXT_HEADER(Dust2_ar,flext_dsp); + +public: + Dust2_ar(int argc, t_atom *argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + virtual void m_dsp (int n,t_signalvec const * insigs, + t_signalvec const * outsigs); + + void m_set(float f) + { + m_density = f; + m_thresh = m_density/Samplerate(); + m_scale = m_thresh > 0.f ? 1.f / m_thresh : 0.f; + } + +private: + FLEXT_CALLBACK_F(m_set); + float m_density, m_thresh, m_scale; + RGen rgen; + +}; + +FLEXT_LIB_DSP_V("Dust2~",Dust2_ar); + +Dust2_ar::Dust2_ar(int argc, t_atom *argv) +{ + FLEXT_ADDMETHOD_(0,"set",m_set); + + //parse arguments + AtomList Args(argc,argv); + m_density=sc_getfloatarg(Args,0); + + rgen.init(0); //set seed to 0 + + AddOutSignal(); +} + +void Dust2_ar::m_dsp(int n,t_signalvec const * insigs, + t_signalvec const * outsigs) +{ + m_thresh = m_density/Samplerate(); + m_scale = m_thresh > 0.f ? 2.f / m_thresh : 0.f; +} + +void Dust2_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + + RGET; + float thresh = m_thresh; + float scale = m_scale; + + for (int i = 0; i!= n;++i) + { + float z = frand(s1,s2,s3); + if (z < thresh) + (*(nout)++) = z * scale - 1.f; + else + (*(nout)++) = 0.f; + } + + RPUT; +} + + +/* ------------------------ Dust2 ---------------------------------------*/ + +class Dust2_kr: + public flext_base +{ + FLEXT_HEADER(Dust2_kr,flext_base); + +public: + Dust2_kr(int argc, t_atom *argv); + +protected: + void m_set(float f); + Timer Dust2_timer; + void m_doit(); + +private: + float m_density, m_scale; + float mtbt; //medium time between trigger + RGen rgen; + FLEXT_CALLBACK_1(m_set,float); + FLEXT_CALLBACK_T(m_doit); +}; + +FLEXT_LIB_V("Dust2",Dust2_kr); + +Dust2_kr::Dust2_kr(int argc, t_atom *argv) + : Dust2_timer(false) +{ + FLEXT_ADDMETHOD(0,m_set); + + //parse arguments + AtomList Args(argc,argv); + m_density=sc_getfloatarg(Args,0); + + rgen.init(0); //set seed to 0 + AddOutFloat(); + + FLEXT_ADDTIMER(Dust2_timer,m_doit); + + m_set(m_density); +} + +void Dust2_kr::m_set(float f) +{ + Dust2_timer.Reset(); + + if(f==0) + { + return; + } + m_density = f; + mtbt = 1/f*1000; + + Dust2_timer.Delay(mtbt * 0.002 * rgen.frand()); +} + +void Dust2_kr::m_doit() +{ + ToOutFloat(0,2*rgen.frand() - 1 ); + + Dust2_timer.Delay(mtbt * 0.002 * rgen.frand()); +} diff --git a/sc4pd/source/GrayNoise.cpp b/sc4pd/source/GrayNoise.cpp new file mode 100644 index 0000000..8628bca --- /dev/null +++ b/sc4pd/source/GrayNoise.cpp @@ -0,0 +1,137 @@ +/* sc4pd + GrayNoise, GrayNoise~ + + 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: Keith Rowe: Harsh + +*/ + +#include +#include "SC_PlugIn.h" +#include "support.hpp" + + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +/* ------------------------ GrayNoise~ -------------------------------*/ + +class GrayNoise_ar: + public flext_dsp +{ + FLEXT_HEADER(GrayNoise_ar,flext_dsp); + +public: + GrayNoise_ar(int argc, t_atom *argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + +private: + int m_counter; + RGen rgen; +}; + +FLEXT_LIB_DSP_V("GrayNoise~",GrayNoise_ar); + +GrayNoise_ar::GrayNoise_ar(int argc, t_atom *argv) +{ + + //parse arguments + AtomList Args(argc,argv); + + rgen.init(0); //set seed to 0 + + AddOutSignal(); +} + + +void GrayNoise_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + + RGET; + int counter = m_counter; + + for (int i = 0; i!= n;++i) + { + counter ^= 1L << (trand(s1,s2,s3) & 31); + (*(nout)++) = counter * 4.65661287308e-10f; + } + + m_counter=counter; + RPUT; +} + + +/* ------------------------ GrayNoise ---------------------------------*/ + +class GrayNoise_kr: + public flext_base +{ + FLEXT_HEADER(GrayNoise_kr,flext_base); + +public: + GrayNoise_kr(int argc, t_atom *argv); + +protected: + void m_perform(); + +private: + int m_counter; + RGen rgen; + FLEXT_CALLBACK(m_perform); +}; + +FLEXT_LIB_V("GrayNoise",GrayNoise_kr); + +GrayNoise_kr::GrayNoise_kr(int argc, t_atom *argv) +{ + FLEXT_ADDBANG(0,m_perform); + + //parse arguments + AtomList Args(argc,argv); + + rgen.init(0); //set seed to 0 + + AddOutFloat(); +} + +void GrayNoise_kr::m_perform() +{ + m_counter ^= 1L << (rgen.trand() & 31); + m_counter * 4.65661287308e-10f; + ToOutFloat(0,m_counter * 4.65661287308e-10f); +} diff --git a/sc4pd/source/Hasher.cpp b/sc4pd/source/Hasher.cpp new file mode 100644 index 0000000..9fc2f48 --- /dev/null +++ b/sc4pd/source/Hasher.cpp @@ -0,0 +1,122 @@ +/* sc4pd + Hasher~, Hasher + + 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: Philip Jeck: Stoke + +*/ + +#include +#include "support.hpp" +#include "SC_PlugIn.h" + + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + +/* ------------------------ Hasher~ -----------------------------------*/ + +class Hasher_ar + :public flext_dsp +{ + FLEXT_HEADER(Hasher_ar,flext_dsp); + +public: + Hasher_ar(); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); +private: + +}; + +FLEXT_LIB_DSP("Hasher~",Hasher_ar); + +Hasher_ar::Hasher_ar() +{ + AddOutSignal(); +} + +void Hasher_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + int32 *nin = (int32*)*in; + t_sample *nout = *out; + + for (int i = 0; i!= n;++i) + { + union { float f; int i; } u; + int z = (*(nin)++); + u.i = 0x40000000 | ((uint32)Hash(z) >> 9); + (*(nout)++) = u.f -3.f; + } +} + + +/* ------------------------ Hasher ------------------------------------*/ + +class Hasher_kr + :public flext_base +{ + FLEXT_HEADER(Hasher_kr,flext_base); + +public: + Hasher_kr(); + +protected: + void m_perform(float f); + +private: + FLEXT_CALLBACK_F(m_perform); +}; + +FLEXT_LIB("Hasher",Hasher_kr); + +Hasher_kr::Hasher_kr() +{ + AddInFloat(); + AddOutFloat(); + + FLEXT_ADDMETHOD(0,m_perform); +} + +void Hasher_kr::m_perform(float f) +{ + int32 * fi = (int32*) &f; + + union { float f; int i; } u; + int z = *fi; + u.i = 0x40000000 | ((uint32)Hash(z) >> 9); + + ToOutFloat(0,u.f -3.f); +} diff --git a/sc4pd/source/MantissaMask.cpp b/sc4pd/source/MantissaMask.cpp new file mode 100644 index 0000000..d3a867d --- /dev/null +++ b/sc4pd/source/MantissaMask.cpp @@ -0,0 +1,160 @@ +/* sc4pd + MantissaMask~, MantissaMask + + 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: Wolfgang Mitterer: Amusie + +*/ + +#include +#include "support.hpp" +#include "SC_PlugIn.h" + + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + +/* ------------------------ MantissaMask~ -----------------------------*/ + +class MantissaMask_ar + :public flext_dsp +{ + FLEXT_HEADER(MantissaMask_ar,flext_dsp); + +public: + MantissaMask_ar(int argc,t_atom * argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + void m_set(float f); + +private: + FLEXT_CALLBACK_F(m_set); + int32 mask; + +}; + +FLEXT_LIB_DSP_V("MantissaMask~",MantissaMask_ar); + +MantissaMask_ar::MantissaMask_ar(int argc,t_atom * argv) +{ + FLEXT_ADDMETHOD_(0,"set",m_set); + + AtomList Args(argc,argv); + int bits = sc_getfloatarg(Args,0); + + AddOutSignal(); + + mask = -1 << (23 - bits); + +} + +void MantissaMask_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + int32 *nout = (int32*)*out; + int32 *nin = (int32*)*in; + + for (int i = 0; i!= n;++i) + { + (*(nout)++) = mask & (*(nin)++); + } +} + +void MantissaMask_ar::m_set(float f) +{ + int bits = (int) f; + if ( bits < 0 || bits > 23) + { + post("value doesn't make sense"); + return; + } + mask = -1 << (23 - bits); +} + +/* ------------------------ MantissaMask ------------------------------*/ + +class MantissaMask_kr + :public flext_base +{ + FLEXT_HEADER(MantissaMask_kr,flext_base); + +public: + MantissaMask_kr(int argc,t_atom * argv); + +protected: + void m_set(float f); + void m_perform(float f); + +private: + FLEXT_CALLBACK_F(m_set); + FLEXT_CALLBACK_F(m_perform); + int32 mask; +}; + +FLEXT_LIB_V("MantissaMask",MantissaMask_kr); + +MantissaMask_kr::MantissaMask_kr(int argc,t_atom * argv) +{ + + AtomList Args(argc,argv); + int bits = sc_getfloatarg(Args,0); + + AddInFloat(); + AddOutFloat(); + + FLEXT_ADDMETHOD(0,m_perform); + FLEXT_ADDMETHOD_(0,"set",m_set); + mask = -1 << (23 - bits); +} + +void MantissaMask_kr::m_perform(float f) +{ + float g; + int32 *gp = (int32*) &g; + + *(gp) = mask & *((int32*) &f); + + ToOutFloat(0,g); +} + +void MantissaMask_kr::m_set(float f) +{ + int bits = (int) f; + if ( bits < 0 || bits > 23) + { + post("value doesn't make sense"); + return; + } + mask = -1 << (23 - bits); +} diff --git a/sc4pd/source/Median.cpp b/sc4pd/source/Median.cpp new file mode 100644 index 0000000..77b0a5d --- /dev/null +++ b/sc4pd/source/Median.cpp @@ -0,0 +1,220 @@ +/* sc4pd + Median, Median~ + + 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 +#include "SC_PlugIn.h" +#include "support.hpp" + + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + +/* ------------------------ Median(~) ---------------------------------*/ + + +const int kMAXMEDIANSIZE = 32; + +class median_shared +{ +public: + + inline void Init(long size, float value); + inline float Insert(float value); + +private: + float m_medianValue[kMAXMEDIANSIZE]; + long m_medianAge[kMAXMEDIANSIZE]; + long m_medianSize, m_medianIndex; +}; + +void median_shared::Init(long size, float value) +{ + // initialize the arrays with the first value + m_medianSize = size; + for (int i=0; i>1] + + last = m_medianSize - 1; + // find oldest bin and age the other bins. + for (i=0; i m_medianValue[pos+1]) { + m_medianValue[pos] = m_medianValue[pos+1]; + m_medianAge[pos] = m_medianAge[pos+1]; + pos++; + } + m_medianValue[pos] = value; + m_medianAge[pos] = 0; // this is the newest bin, age = 0 + return m_medianValue[m_medianSize>>1]; +} + + +/* ------------------------ Median~ -----------------------------------*/ + +class Median_ar + :public flext_dsp +{ + FLEXT_HEADER(Median_ar,flext_dsp); + +public: + Median_ar(int argc, t_atom * argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + virtual void m_dsp (int n,t_signalvec const * insigs, + t_signalvec const * outsigs); + + void m_set(float f) + { + m_size=(int)f; + Median.Init(m_size,Median.Insert(0)); /* this is not beautiful, but i'm not + aware of a nicer way */ + } + +private: + FLEXT_CALLBACK_F(m_set); + + median_shared Median; //median + int m_size; //median size +}; + +FLEXT_LIB_DSP_V("Median~",Median_ar); + +Median_ar::Median_ar(int argc,t_atom * argv) +{ + FLEXT_ADDMETHOD_(0,"set",m_set); + + AtomList Args(argc,argv); + m_size=sc_getfloatarg(Args,0); + + AddOutSignal(); +} + +void Median_ar::m_dsp(int n,t_signalvec const * insigs, + t_signalvec const * outsigs) +{ + Median.Init(m_size,0); //how is this done in SuperCollider? +} + +void Median_ar::m_signal(int n, t_sample *const *in, t_sample *const *out) +{ + t_sample *nout = *out; + t_sample *nin = *in; + + for (int i = 0; i!= n;++i) + { + (*(nout)++) = Median.Insert(*(nin)++); + } +} + + +/* ------------------------ Median ------------------------------------*/ + +class Median_kr + :public flext_dsp +{ + FLEXT_HEADER(Median_kr,flext_dsp); + +public: + Median_kr(int argc, t_atom * argv); + +protected: + void m_set(float f) + { + m_size=(int)f; + Median.Init(m_size,Median.Insert(0)); /* this is not beautiful, but i'm not + aware of a nicer way */ + } + void m_perform(float f); + +private: + FLEXT_CALLBACK_F(m_set); + FLEXT_CALLBACK_F(m_perform); + + median_shared Median; //median + int m_size; //median size +}; + +FLEXT_LIB_V("Median",Median_kr); + +Median_kr::Median_kr(int argc,t_atom * argv) +{ + FLEXT_ADDMETHOD_(0,"set",m_set); + FLEXT_ADDMETHOD(0,m_perform); + + + AtomList Args(argc,argv); + m_size=sc_getfloatarg(Args,0); + + float m_set=sc_getfloatarg(Args,1); + + Median.Init(m_size,m_set); + AddOutSignal(); +} + +void Median_kr::m_perform(float f) +{ + ToOutFloat(0,Median.Insert(f)); +} diff --git a/sc4pd/source/PinkNoise.cpp b/sc4pd/source/PinkNoise.cpp new file mode 100644 index 0000000..bf6db62 --- /dev/null +++ b/sc4pd/source/PinkNoise.cpp @@ -0,0 +1,168 @@ +/* sc4pd + PinkNoise, PinkNoise~ + + 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: Gottfried Michael Koenig: Klangfiguren II + +*/ + +#include +#include "SC_PlugIn.h" +#include "support.hpp" + + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +/* ------------------------ PinkNoise~ -------------------------------*/ + +class PinkNoise_ar: + public flext_dsp +{ + FLEXT_HEADER(PinkNoise_ar,flext_dsp); + +public: + PinkNoise_ar(int argc, t_atom *argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + +private: + uint32 m_dice[16]; + int32 m_total; + RGen rgen; +}; + +FLEXT_LIB_DSP_V("PinkNoise~",PinkNoise_ar); + +PinkNoise_ar::PinkNoise_ar(int argc, t_atom *argv) + : m_total(0) +{ + + //parse arguments + AtomList Args(argc,argv); + + rgen.init(0); //set seed to 0 + + for (int i=0; i<16; ++i) + { + uint32 newrand = rgen.trand() >> 13; + m_total += newrand; + m_dice[i] = newrand; + } + + AddOutSignal(); +} + + +void PinkNoise_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + + RGET; + uint32 total = m_total; + uint32 *dice = m_dice; + + for (int i = 0; i!= n;++i) + { + uint32 counter = trand(s1,s2,s3); // Magnus Jonsson's suggestion. + uint32 newrand = counter >> 13; + int k = (CTZ(counter)) & 15; + uint32 prevrand = dice[k]; + dice[k] = newrand; + total += (newrand - prevrand); + newrand = trand(s1,s2,s3) >> 13; + uint32 ifval = (total + newrand) | 0x40000000; + (*(nout)++) = ((*(float*)&ifval) - 3.0f); + } + RPUT; +} + + +/* ------------------------ PinkNoise ---------------------------------*/ + +class PinkNoise_kr: + public flext_base +{ + FLEXT_HEADER(PinkNoise_kr,flext_base); + +public: + PinkNoise_kr(int argc, t_atom *argv); + +protected: + void m_perform(); + +private: + uint32 m_dice[16]; + int32 m_total; + RGen rgen; + FLEXT_CALLBACK(m_perform); +}; + +FLEXT_LIB_V("PinkNoise",PinkNoise_kr); + +PinkNoise_kr::PinkNoise_kr(int argc, t_atom *argv) + : m_total(0) +{ + FLEXT_ADDBANG(0,m_perform); + + //parse arguments + AtomList Args(argc,argv); + + rgen.init(0); //set seed to 0 + + for (int i=0; i<16; ++i) + { + uint32 newrand = rgen.trand() >> 13; + m_total += newrand; + m_dice[i] = newrand; + } + + AddOutFloat(); +} + +void PinkNoise_kr::m_perform() +{ + uint32 counter = rgen.trand(); // Magnus Jonsson's suggestion. + uint32 newrand = counter >> 13; + int k = (CTZ(counter)) & 15; + uint32 prevrand = m_dice[k]; + m_dice[k] = newrand; + m_total += (newrand - prevrand); + newrand = rgen.trand() >> 13; + uint32 ifval = (m_total + newrand) | 0x40000000; + + ToOutFloat(0,((*(float*)&ifval) - 3.0f)); +} diff --git a/sc4pd/source/WhiteNoise.cpp b/sc4pd/source/WhiteNoise.cpp new file mode 100644 index 0000000..ecedf3d --- /dev/null +++ b/sc4pd/source/WhiteNoise.cpp @@ -0,0 +1,130 @@ +/* sc4pd + WhiteNoise, WhiteNoise~ + + 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: Otomo Yoshihide: Ensemble Cathode + +*/ + +#include +#include "SC_PlugIn.h" +#include "support.hpp" + + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +/* ------------------------ WhiteNoise~ -------------------------------*/ + +class WhiteNoise_ar: + public flext_dsp +{ + FLEXT_HEADER(WhiteNoise_ar,flext_dsp); + +public: + WhiteNoise_ar(int argc, t_atom *argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + +private: + RGen rgen; +}; + +FLEXT_LIB_DSP_V("WhiteNoise~",WhiteNoise_ar); + +WhiteNoise_ar::WhiteNoise_ar(int argc, t_atom *argv) +{ + + //parse arguments + AtomList Args(argc,argv); + + rgen.init(0); //set seed to 0 + + AddOutSignal(); +} + + +void WhiteNoise_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + + RGET; + + for (int i = 0; i!= n;++i) + { + (*(nout)++) = frand2(s1, s2, s3); + } + + RPUT +} + + +/* ------------------------ WhiteNoise ---------------------------------*/ + +class WhiteNoise_kr: + public flext_base +{ + FLEXT_HEADER(WhiteNoise_kr,flext_base); + +public: + WhiteNoise_kr(int argc, t_atom *argv); + +protected: + void m_perform(); + +private: + RGen rgen; + FLEXT_CALLBACK(m_perform); +}; + +FLEXT_LIB_V("WhiteNoise",WhiteNoise_kr); + +WhiteNoise_kr::WhiteNoise_kr(int argc, t_atom *argv) +{ + FLEXT_ADDBANG(0,m_perform); + + //parse arguments + AtomList Args(argc,argv); + + rgen.init(0); //set seed to 0 + + AddOutFloat(); +} + +void WhiteNoise_kr::m_perform() +{ + ToOutFloat(0,rgen.frand2()); +} diff --git a/sc4pd/source/main.cpp b/sc4pd/source/main.cpp new file mode 100644 index 0000000..d7b187b --- /dev/null +++ b/sc4pd/source/main.cpp @@ -0,0 +1,91 @@ +/* sc4pd library initialization + + 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 + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + +#define SC4PD_VERSION "0.01" + +void sc4pd_library_setup() +{ + post("\nsc4pd: by tim blechmann"); + post("based on SuperCollider by James McCartney"); + post("version "SC4PD_VERSION); + post("compiled on "__DATE__); + post("contains: Dust(~), MantissaMask(~), Hasher(~), Median(~), " + "BrownNoise(~),"); + post(" ClipNoise(~), GrayNoise(~), Dust2(~), WhiteNoise(~), " + "PinkNoise(~)\n"); + + //initialize objects + FLEXT_DSP_SETUP(Dust_ar); + FLEXT_SETUP(Dust_kr); + + FLEXT_DSP_SETUP(MantissaMask_ar); + FLEXT_SETUP(MantissaMask_kr); + + FLEXT_DSP_SETUP(Hasher_ar); + FLEXT_SETUP(Hasher_kr); + + FLEXT_DSP_SETUP(Median_ar); + FLEXT_SETUP(Median_kr); + + FLEXT_DSP_SETUP(BrownNoise_ar); + FLEXT_SETUP(BrownNoise_kr); + + FLEXT_DSP_SETUP(ClipNoise_ar); + FLEXT_SETUP(ClipNoise_kr); + + FLEXT_DSP_SETUP(GrayNoise_ar); + FLEXT_SETUP(GrayNoise_kr); + + FLEXT_DSP_SETUP(WhiteNoise_ar); + FLEXT_SETUP(WhiteNoise_kr); + + FLEXT_DSP_SETUP(PinkNoise_ar); + FLEXT_SETUP(PinkNoise_kr); + + FLEXT_DSP_SETUP(Dust2_ar); + FLEXT_SETUP(Dust2_kr); + + FLEXT_DSP_SETUP(Crackle_ar); + FLEXT_SETUP(Crackle_kr); +} + +FLEXT_LIB_SETUP(sc4pd,sc4pd_library_setup); 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() + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + -- cgit v1.2.1