diff options
Diffstat (limited to 'sc4pd')
-rwxr-xr-x | sc4pd/make-files.txt | 4 | ||||
-rw-r--r-- | sc4pd/pd/amclip.pd | 16 | ||||
-rw-r--r-- | sc4pd/pd/excess.pd | 16 | ||||
-rw-r--r-- | sc4pd/pd/scaleneg.pd | 16 | ||||
-rw-r--r-- | sc4pd/source/absdif.cpp | 137 | ||||
-rw-r--r-- | sc4pd/source/amclip.cpp | 133 | ||||
-rw-r--r-- | sc4pd/source/difsqr.cpp | 136 | ||||
-rw-r--r-- | sc4pd/source/excess.cpp | 130 | ||||
-rw-r--r-- | sc4pd/source/hypot.cpp | 130 | ||||
-rw-r--r-- | sc4pd/source/main.cpp | 46 | ||||
-rw-r--r-- | sc4pd/source/ring1.cpp | 136 | ||||
-rw-r--r-- | sc4pd/source/ring1.cpp~ | 130 | ||||
-rw-r--r-- | sc4pd/source/ring2.cpp | 136 | ||||
-rw-r--r-- | sc4pd/source/ring2.cpp~ | 136 | ||||
-rw-r--r-- | sc4pd/source/ring3.cpp | 136 | ||||
-rw-r--r-- | sc4pd/source/ring3.cpp~ | 136 | ||||
-rw-r--r-- | sc4pd/source/ring4.cpp | 136 | ||||
-rw-r--r-- | sc4pd/source/ring4.cpp~ | 136 | ||||
-rw-r--r-- | sc4pd/source/scaleneg.cpp | 130 | ||||
-rw-r--r-- | sc4pd/source/sqrdif.cpp | 137 | ||||
-rw-r--r-- | sc4pd/source/sqrdif.cpp~ | 136 | ||||
-rw-r--r-- | sc4pd/source/sqrsum.cpp | 137 | ||||
-rw-r--r-- | sc4pd/source/sqrsum.cpp~ | 137 | ||||
-rw-r--r-- | sc4pd/source/sumsqr.cpp | 136 |
24 files changed, 2657 insertions, 2 deletions
diff --git a/sc4pd/make-files.txt b/sc4pd/make-files.txt index b662391..c5a874b 100755 --- a/sc4pd/make-files.txt +++ b/sc4pd/make-files.txt @@ -6,4 +6,6 @@ SRCS= \ PinkNoise.cpp Dust2.cpp Crackle.cpp Rand.cpp TRand.cpp TExpRand.cpp \ IRand.cpp TIRand.cpp CoinGate.cpp support.cpp LinRand.cpp NRand.cpp\ ExpRand.cpp LFClipNoise.cpp LFNoise0.cpp LFNoise1.cpp LFNoise2.cpp \ - Logistic.cpp Latoocarfian.cpp LinCong.cpp
\ No newline at end of file + Logistic.cpp Latoocarfian.cpp LinCong.cpp amclip.cpp scaleneg.cpp \ + excess.cpp hypot.cpp ring1.cpp ring2.cpp ring3.cpp ring4.cpp \ + difsqr.cpp sumsqr.cpp sqrdif.cpp sqrsum.cpp absdif.cpp
\ No newline at end of file diff --git a/sc4pd/pd/amclip.pd b/sc4pd/pd/amclip.pd new file mode 100644 index 0000000..21cfb91 --- /dev/null +++ b/sc4pd/pd/amclip.pd @@ -0,0 +1,16 @@ +#N canvas 0 0 450 300 10; +#X obj 33 137 amclip~; +#X obj 26 88 osc~ 440; +#X obj 22 176 dac~; +#X floatatom 327 136 5 0 0 0 - - -; +#X obj 96 113 osc~ 40; +#X floatatom 222 99 5 0 0 0 - - -; +#X floatatom 263 228 5 0 0 0 - - -; +#X obj 263 181 amclip; +#X connect 0 0 2 0; +#X connect 0 0 2 1; +#X connect 1 0 0 0; +#X connect 3 0 7 1; +#X connect 4 0 0 1; +#X connect 5 0 7 0; +#X connect 7 0 6 0; diff --git a/sc4pd/pd/excess.pd b/sc4pd/pd/excess.pd new file mode 100644 index 0000000..3edde5e --- /dev/null +++ b/sc4pd/pd/excess.pd @@ -0,0 +1,16 @@ +#N canvas 0 0 450 300 10; +#X obj 26 88 osc~ 440; +#X obj 22 176 dac~; +#X floatatom 327 136 5 0 0 0 - - -; +#X floatatom 222 99 5 0 0 0 - - -; +#X floatatom 263 228 5 0 0 0 - - -; +#X obj 33 137 excess~; +#X obj 96 113 osc~ 45; +#X obj 263 181 excess; +#X connect 0 0 5 0; +#X connect 2 0 7 1; +#X connect 3 0 7 0; +#X connect 5 0 1 0; +#X connect 5 0 1 1; +#X connect 6 0 5 1; +#X connect 7 0 4 0; diff --git a/sc4pd/pd/scaleneg.pd b/sc4pd/pd/scaleneg.pd new file mode 100644 index 0000000..70e6f14 --- /dev/null +++ b/sc4pd/pd/scaleneg.pd @@ -0,0 +1,16 @@ +#N canvas 0 0 450 300 10; +#X obj 26 88 osc~ 440; +#X obj 22 176 dac~; +#X floatatom 327 136 5 0 0 0 - - -; +#X floatatom 222 99 5 0 0 0 - - -; +#X floatatom 263 228 5 0 0 0 - - -; +#X obj 33 137 scaleneg~; +#X obj 263 181 scaleneg; +#X obj 96 113 osc~ 230; +#X connect 0 0 5 0; +#X connect 2 0 6 1; +#X connect 3 0 6 0; +#X connect 5 0 1 0; +#X connect 5 0 1 1; +#X connect 6 0 4 0; +#X connect 7 0 5 1; diff --git a/sc4pd/source/absdif.cpp b/sc4pd/source/absdif.cpp new file mode 100644 index 0000000..34f41db --- /dev/null +++ b/sc4pd/source/absdif.cpp @@ -0,0 +1,137 @@ +/* sc4pd + absdif, absdif~ + + 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: Evan Parker & Keith Rowe: Dark Rags + +*/ + +#include <flext.h> +#include "SC_PlugIn.h" + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +inline float sc_absdif (float a, float b) +{ + float f=a-b; + return fabsf(f); +} + + +/* ------------------------ absdif~ -----------------------------*/ + +class absdif_ar + :public flext_dsp +{ + FLEXT_HEADER(absdif_ar,flext_dsp); + +public: + absdif_ar(int argc,t_atom * argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + +private: + +}; + +FLEXT_LIB_DSP_V("absdif~",absdif_ar); + +absdif_ar::absdif_ar(int argc,t_atom * argv) +{ + AddInSignal(); + AddInSignal(); + AddOutSignal(); +} + +void absdif_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + t_sample *nin1 = *in; + t_sample *nin2 = *(in+1); + + for (int i = 0; i!= n;++i) + { + if( *nin2 > 0) + (*(nout)++) = sc_absdif( (*(nin1)++), (*(nin2)++) ); + } +} + + + +/* ------------------------ absdif ------------------------------*/ + +class absdif_kr + :public flext_base +{ + FLEXT_HEADER(absdif_kr,flext_base); + +public: + absdif_kr(int argc,t_atom * argv); + +protected: + void m_perform(float f); + void m_set(float f); + +private: + float b; + FLEXT_CALLBACK_F(m_perform); + FLEXT_CALLBACK_F(m_set); +}; + +FLEXT_LIB_V("absdif",absdif_kr); + +absdif_kr::absdif_kr(int argc,t_atom * argv) + :b(0) +{ + + AddInFloat(); + AddInFloat(); + AddOutFloat(); + + FLEXT_ADDMETHOD(0,m_perform); + FLEXT_ADDMETHOD(1,m_set); +} + +void absdif_kr::m_perform(float f) +{ + ToOutFloat(0,sc_absdif(f,b)); +} + +void absdif_kr::m_set(float f) +{ + b=f; +} diff --git a/sc4pd/source/amclip.cpp b/sc4pd/source/amclip.cpp new file mode 100644 index 0000000..9d4a936 --- /dev/null +++ b/sc4pd/source/amclip.cpp @@ -0,0 +1,133 @@ +/* sc4pd + amclip, amclip(~) + + 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 & Toshimaru Nakamura: Weather Sky + +*/ + +#include <flext.h> +#include "SC_PlugIn.h" + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +/* ------------------------ amclip~ -----------------------------*/ + +class amclip_ar + :public flext_dsp +{ + FLEXT_HEADER(amclip_ar,flext_dsp); + +public: + amclip_ar(int argc,t_atom * argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + +private: + +}; + +FLEXT_LIB_DSP_V("amclip~",amclip_ar); + +amclip_ar::amclip_ar(int argc,t_atom * argv) +{ + AddInSignal(); + AddInSignal(); + AddOutSignal(); +} + +void amclip_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + t_sample *nin1 = *in; + t_sample *nin2 = *(in+1); + + for (int i = 0; i!= n;++i) + { + if( *nin2 > 0) + (*(nout)++) = sc_amclip( (*(nin1)++), (*(nin2)++) ); + } +} + + + +/* ------------------------ amclip ------------------------------*/ + +class amclip_kr + :public flext_base +{ + FLEXT_HEADER(amclip_kr,flext_base); + +public: + amclip_kr(int argc,t_atom * argv); + +protected: + void m_perform(float f); + void m_set(float f); + +private: + float b; + FLEXT_CALLBACK_F(m_perform); + FLEXT_CALLBACK_F(m_set); +}; + +FLEXT_LIB_V("amclip",amclip_kr); + +amclip_kr::amclip_kr(int argc,t_atom * argv) + :b(0) +{ + + AddInFloat(); + AddInFloat(); + AddOutFloat(); + + FLEXT_ADDMETHOD(0,m_perform); + FLEXT_ADDMETHOD(1,m_set); +} + +void amclip_kr::m_perform(float f) +{ + ToOutFloat(0,f*b); +} + +void amclip_kr::m_set(float f) +{ + if (f>0) + b=f; + else + b=0; +} diff --git a/sc4pd/source/difsqr.cpp b/sc4pd/source/difsqr.cpp new file mode 100644 index 0000000..823f266 --- /dev/null +++ b/sc4pd/source/difsqr.cpp @@ -0,0 +1,136 @@ +/* sc4pd + difsqr, difsqr~ + + 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: Evan Parker & Keith Rowe: Dark Rags + +*/ + +#include <flext.h> +#include "SC_PlugIn.h" + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +inline float sc_difsqr (float a, float b) +{ + return a*a-b*b; +} + + +/* ------------------------ difsqr~ -----------------------------*/ + +class difsqr_ar + :public flext_dsp +{ + FLEXT_HEADER(difsqr_ar,flext_dsp); + +public: + difsqr_ar(int argc,t_atom * argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + +private: + +}; + +FLEXT_LIB_DSP_V("difsqr~",difsqr_ar); + +difsqr_ar::difsqr_ar(int argc,t_atom * argv) +{ + AddInSignal(); + AddInSignal(); + AddOutSignal(); +} + +void difsqr_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + t_sample *nin1 = *in; + t_sample *nin2 = *(in+1); + + for (int i = 0; i!= n;++i) + { + if( *nin2 > 0) + (*(nout)++) = sc_difsqr( (*(nin1)++), (*(nin2)++) ); + } +} + + + +/* ------------------------ difsqr ------------------------------*/ + +class difsqr_kr + :public flext_base +{ + FLEXT_HEADER(difsqr_kr,flext_base); + +public: + difsqr_kr(int argc,t_atom * argv); + +protected: + void m_perform(float f); + void m_set(float f); + +private: + float b; + FLEXT_CALLBACK_F(m_perform); + FLEXT_CALLBACK_F(m_set); +}; + +FLEXT_LIB_V("difsqr",difsqr_kr); + +difsqr_kr::difsqr_kr(int argc,t_atom * argv) + :b(0) +{ + + AddInFloat(); + AddInFloat(); + AddOutFloat(); + + FLEXT_ADDMETHOD(0,m_perform); + FLEXT_ADDMETHOD(1,m_set); +} + +void difsqr_kr::m_perform(float f) +{ + ToOutFloat(0,sc_difsqr(f,b)); +} + +void difsqr_kr::m_set(float f) +{ + b=f; +} diff --git a/sc4pd/source/excess.cpp b/sc4pd/source/excess.cpp new file mode 100644 index 0000000..00f8666 --- /dev/null +++ b/sc4pd/source/excess.cpp @@ -0,0 +1,130 @@ +/* sc4pd + excess, excess~ + + 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 & Toshimaru Nakamura: Weather Sky + +*/ + +#include <flext.h> +#include "SC_PlugIn.h" + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +/* ------------------------ excess~ -----------------------------*/ + +class excess_ar + :public flext_dsp +{ + FLEXT_HEADER(excess_ar,flext_dsp); + +public: + excess_ar(int argc,t_atom * argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + +private: + +}; + +FLEXT_LIB_DSP_V("excess~",excess_ar); + +excess_ar::excess_ar(int argc,t_atom * argv) +{ + AddInSignal(); + AddInSignal(); + AddOutSignal(); +} + +void excess_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + t_sample *nin1 = *in; + t_sample *nin2 = *(in+1); + + for (int i = 0; i!= n;++i) + { + if( *nin2 > 0) + (*(nout)++) = sc_excess( (*(nin1)++), (*(nin2)++) ); + } +} + + + +/* ------------------------ excess ------------------------------*/ + +class excess_kr + :public flext_base +{ + FLEXT_HEADER(excess_kr,flext_base); + +public: + excess_kr(int argc,t_atom * argv); + +protected: + void m_perform(float f); + void m_set(float f); + +private: + float b; + FLEXT_CALLBACK_F(m_perform); + FLEXT_CALLBACK_F(m_set); +}; + +FLEXT_LIB_V("excess",excess_kr); + +excess_kr::excess_kr(int argc,t_atom * argv) + :b(0) +{ + + AddInFloat(); + AddInFloat(); + AddOutFloat(); + + FLEXT_ADDMETHOD(0,m_perform); + FLEXT_ADDMETHOD(1,m_set); +} + +void excess_kr::m_perform(float f) +{ + ToOutFloat(0,sc_excess(f,b)); +} + +void excess_kr::m_set(float f) +{ + b=f; +} diff --git a/sc4pd/source/hypot.cpp b/sc4pd/source/hypot.cpp new file mode 100644 index 0000000..b096e48 --- /dev/null +++ b/sc4pd/source/hypot.cpp @@ -0,0 +1,130 @@ +/* sc4pd + hypot, hypot~ + + 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 & Toshimaru Nakamura: Weather Sky + +*/ + +#include <flext.h> +#include "SC_PlugIn.h" + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +/* ------------------------ hypot~ -----------------------------*/ + +class hypot_ar + :public flext_dsp +{ + FLEXT_HEADER(hypot_ar,flext_dsp); + +public: + hypot_ar(int argc,t_atom * argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + +private: + +}; + +FLEXT_LIB_DSP_V("hypot~",hypot_ar); + +hypot_ar::hypot_ar(int argc,t_atom * argv) +{ + AddInSignal(); + AddInSignal(); + AddOutSignal(); +} + +void hypot_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + t_sample *nin1 = *in; + t_sample *nin2 = *(in+1); + + for (int i = 0; i!= n;++i) + { + if( *nin2 > 0) + (*(nout)++) = hypot( (*(nin1)++), (*(nin2)++) ); + } +} + + + +/* ------------------------ hypot ------------------------------*/ + +class hypot_kr + :public flext_base +{ + FLEXT_HEADER(hypot_kr,flext_base); + +public: + hypot_kr(int argc,t_atom * argv); + +protected: + void m_perform(float f); + void m_set(float f); + +private: + float b; + FLEXT_CALLBACK_F(m_perform); + FLEXT_CALLBACK_F(m_set); +}; + +FLEXT_LIB_V("hypot",hypot_kr); + +hypot_kr::hypot_kr(int argc,t_atom * argv) + :b(0) +{ + + AddInFloat(); + AddInFloat(); + AddOutFloat(); + + FLEXT_ADDMETHOD(0,m_perform); + FLEXT_ADDMETHOD(1,m_set); +} + +void hypot_kr::m_perform(float f) +{ + ToOutFloat(0,hypot(f,b)); +} + +void hypot_kr::m_set(float f) +{ + b=f; +} diff --git a/sc4pd/source/main.cpp b/sc4pd/source/main.cpp index 9f2287a..df430f9 100644 --- a/sc4pd/source/main.cpp +++ b/sc4pd/source/main.cpp @@ -58,7 +58,12 @@ void sc4pd_library_setup() "TExpRand(~), IRand(~), TIRand(~),\n CoinGate, " "LinRand(~), NRand(~), ExpRand(~), LFClipNoise(~),\n" " LFNoise0(~), LFNoise1(~), LFNoise2(~), Logistic(~), " - "Latoocarfian(~), LinCong(~)\n"); + "Latoocarfian(~),\n" + " LinCong(~), amclip(~), scaleneg(~), excess(~), hypot(~), " + "ring1(~),\n" + " ring2(~), ring3(~), ring4(~), difsqr(~), sumsqr(~)\n" + "sqrdif(~), sqrsum(~),\n" + " absdif(~)"); //initialize objects FLEXT_DSP_SETUP(Dust_ar); @@ -140,6 +145,45 @@ void sc4pd_library_setup() FLEXT_DSP_SETUP(LinCong_ar); FLEXT_SETUP(LinCong_kr); + + FLEXT_DSP_SETUP(amclip_ar); + FLEXT_SETUP(amclip_kr); + + FLEXT_DSP_SETUP(scaleneg_ar); + FLEXT_SETUP(scaleneg_kr); + + FLEXT_DSP_SETUP(excess_ar); + FLEXT_SETUP(excess_kr); + + FLEXT_DSP_SETUP(hypot_ar); + FLEXT_SETUP(hypot_kr); + + FLEXT_DSP_SETUP(ring1_ar); + FLEXT_SETUP(ring1_kr); + + FLEXT_DSP_SETUP(ring2_ar); + FLEXT_SETUP(ring2_kr); + + FLEXT_DSP_SETUP(ring3_ar); + FLEXT_SETUP(ring3_kr); + + FLEXT_DSP_SETUP(ring4_ar); + FLEXT_SETUP(ring4_kr); + + FLEXT_DSP_SETUP(difsqr_ar); + FLEXT_SETUP(difsqr_kr); + + FLEXT_DSP_SETUP(sumsqr_ar); + FLEXT_SETUP(sumsqr_kr); + + FLEXT_DSP_SETUP(sqrsum_ar); + FLEXT_SETUP(sqrsum_kr); + + FLEXT_DSP_SETUP(sqrdif_ar); + FLEXT_SETUP(sqrdif_kr); + + FLEXT_DSP_SETUP(absdif_ar); + FLEXT_SETUP(absdif_kr); } FLEXT_LIB_SETUP(sc4pd,sc4pd_library_setup); diff --git a/sc4pd/source/ring1.cpp b/sc4pd/source/ring1.cpp new file mode 100644 index 0000000..b9aee15 --- /dev/null +++ b/sc4pd/source/ring1.cpp @@ -0,0 +1,136 @@ +/* sc4pd + ring1, ring1~ + + 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: Evan Parker & Keith Rowe: Dark Rags + +*/ + +#include <flext.h> +#include "SC_PlugIn.h" + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +inline float sc_ring1 (float a, float b) +{ + return a*b+a; +} + + +/* ------------------------ ring1~ -----------------------------*/ + +class ring1_ar + :public flext_dsp +{ + FLEXT_HEADER(ring1_ar,flext_dsp); + +public: + ring1_ar(int argc,t_atom * argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + +private: + +}; + +FLEXT_LIB_DSP_V("ring1~",ring1_ar); + +ring1_ar::ring1_ar(int argc,t_atom * argv) +{ + AddInSignal(); + AddInSignal(); + AddOutSignal(); +} + +void ring1_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + t_sample *nin1 = *in; + t_sample *nin2 = *(in+1); + + for (int i = 0; i!= n;++i) + { + if( *nin2 > 0) + (*(nout)++) = sc_ring1( (*(nin1)++), (*(nin2)++) ); + } +} + + + +/* ------------------------ ring1 ------------------------------*/ + +class ring1_kr + :public flext_base +{ + FLEXT_HEADER(ring1_kr,flext_base); + +public: + ring1_kr(int argc,t_atom * argv); + +protected: + void m_perform(float f); + void m_set(float f); + +private: + float b; + FLEXT_CALLBACK_F(m_perform); + FLEXT_CALLBACK_F(m_set); +}; + +FLEXT_LIB_V("ring1",ring1_kr); + +ring1_kr::ring1_kr(int argc,t_atom * argv) + :b(0) +{ + + AddInFloat(); + AddInFloat(); + AddOutFloat(); + + FLEXT_ADDMETHOD(0,m_perform); + FLEXT_ADDMETHOD(1,m_set); +} + +void ring1_kr::m_perform(float f) +{ + ToOutFloat(0,sc_ring1(f,b)); +} + +void ring1_kr::m_set(float f) +{ + b=f; +} diff --git a/sc4pd/source/ring1.cpp~ b/sc4pd/source/ring1.cpp~ new file mode 100644 index 0000000..00f8666 --- /dev/null +++ b/sc4pd/source/ring1.cpp~ @@ -0,0 +1,130 @@ +/* sc4pd + excess, excess~ + + 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 & Toshimaru Nakamura: Weather Sky + +*/ + +#include <flext.h> +#include "SC_PlugIn.h" + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +/* ------------------------ excess~ -----------------------------*/ + +class excess_ar + :public flext_dsp +{ + FLEXT_HEADER(excess_ar,flext_dsp); + +public: + excess_ar(int argc,t_atom * argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + +private: + +}; + +FLEXT_LIB_DSP_V("excess~",excess_ar); + +excess_ar::excess_ar(int argc,t_atom * argv) +{ + AddInSignal(); + AddInSignal(); + AddOutSignal(); +} + +void excess_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + t_sample *nin1 = *in; + t_sample *nin2 = *(in+1); + + for (int i = 0; i!= n;++i) + { + if( *nin2 > 0) + (*(nout)++) = sc_excess( (*(nin1)++), (*(nin2)++) ); + } +} + + + +/* ------------------------ excess ------------------------------*/ + +class excess_kr + :public flext_base +{ + FLEXT_HEADER(excess_kr,flext_base); + +public: + excess_kr(int argc,t_atom * argv); + +protected: + void m_perform(float f); + void m_set(float f); + +private: + float b; + FLEXT_CALLBACK_F(m_perform); + FLEXT_CALLBACK_F(m_set); +}; + +FLEXT_LIB_V("excess",excess_kr); + +excess_kr::excess_kr(int argc,t_atom * argv) + :b(0) +{ + + AddInFloat(); + AddInFloat(); + AddOutFloat(); + + FLEXT_ADDMETHOD(0,m_perform); + FLEXT_ADDMETHOD(1,m_set); +} + +void excess_kr::m_perform(float f) +{ + ToOutFloat(0,sc_excess(f,b)); +} + +void excess_kr::m_set(float f) +{ + b=f; +} diff --git a/sc4pd/source/ring2.cpp b/sc4pd/source/ring2.cpp new file mode 100644 index 0000000..02e9a18 --- /dev/null +++ b/sc4pd/source/ring2.cpp @@ -0,0 +1,136 @@ +/* sc4pd + ring2, ring2~ + + 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: Evan Parker & Keith Rowe: Dark Rags + +*/ + +#include <flext.h> +#include "SC_PlugIn.h" + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +inline float sc_ring2 (float a, float b) +{ + return a*b+a+b; +} + + +/* ------------------------ ring2~ -----------------------------*/ + +class ring2_ar + :public flext_dsp +{ + FLEXT_HEADER(ring2_ar,flext_dsp); + +public: + ring2_ar(int argc,t_atom * argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + +private: + +}; + +FLEXT_LIB_DSP_V("ring2~",ring2_ar); + +ring2_ar::ring2_ar(int argc,t_atom * argv) +{ + AddInSignal(); + AddInSignal(); + AddOutSignal(); +} + +void ring2_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + t_sample *nin1 = *in; + t_sample *nin2 = *(in+1); + + for (int i = 0; i!= n;++i) + { + if( *nin2 > 0) + (*(nout)++) = sc_ring2( (*(nin1)++), (*(nin2)++) ); + } +} + + + +/* ------------------------ ring2 ------------------------------*/ + +class ring2_kr + :public flext_base +{ + FLEXT_HEADER(ring2_kr,flext_base); + +public: + ring2_kr(int argc,t_atom * argv); + +protected: + void m_perform(float f); + void m_set(float f); + +private: + float b; + FLEXT_CALLBACK_F(m_perform); + FLEXT_CALLBACK_F(m_set); +}; + +FLEXT_LIB_V("ring2",ring2_kr); + +ring2_kr::ring2_kr(int argc,t_atom * argv) + :b(0) +{ + + AddInFloat(); + AddInFloat(); + AddOutFloat(); + + FLEXT_ADDMETHOD(0,m_perform); + FLEXT_ADDMETHOD(1,m_set); +} + +void ring2_kr::m_perform(float f) +{ + ToOutFloat(0,sc_ring2(f,b)); +} + +void ring2_kr::m_set(float f) +{ + b=f; +} diff --git a/sc4pd/source/ring2.cpp~ b/sc4pd/source/ring2.cpp~ new file mode 100644 index 0000000..b9aee15 --- /dev/null +++ b/sc4pd/source/ring2.cpp~ @@ -0,0 +1,136 @@ +/* sc4pd + ring1, ring1~ + + 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: Evan Parker & Keith Rowe: Dark Rags + +*/ + +#include <flext.h> +#include "SC_PlugIn.h" + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +inline float sc_ring1 (float a, float b) +{ + return a*b+a; +} + + +/* ------------------------ ring1~ -----------------------------*/ + +class ring1_ar + :public flext_dsp +{ + FLEXT_HEADER(ring1_ar,flext_dsp); + +public: + ring1_ar(int argc,t_atom * argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + +private: + +}; + +FLEXT_LIB_DSP_V("ring1~",ring1_ar); + +ring1_ar::ring1_ar(int argc,t_atom * argv) +{ + AddInSignal(); + AddInSignal(); + AddOutSignal(); +} + +void ring1_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + t_sample *nin1 = *in; + t_sample *nin2 = *(in+1); + + for (int i = 0; i!= n;++i) + { + if( *nin2 > 0) + (*(nout)++) = sc_ring1( (*(nin1)++), (*(nin2)++) ); + } +} + + + +/* ------------------------ ring1 ------------------------------*/ + +class ring1_kr + :public flext_base +{ + FLEXT_HEADER(ring1_kr,flext_base); + +public: + ring1_kr(int argc,t_atom * argv); + +protected: + void m_perform(float f); + void m_set(float f); + +private: + float b; + FLEXT_CALLBACK_F(m_perform); + FLEXT_CALLBACK_F(m_set); +}; + +FLEXT_LIB_V("ring1",ring1_kr); + +ring1_kr::ring1_kr(int argc,t_atom * argv) + :b(0) +{ + + AddInFloat(); + AddInFloat(); + AddOutFloat(); + + FLEXT_ADDMETHOD(0,m_perform); + FLEXT_ADDMETHOD(1,m_set); +} + +void ring1_kr::m_perform(float f) +{ + ToOutFloat(0,sc_ring1(f,b)); +} + +void ring1_kr::m_set(float f) +{ + b=f; +} diff --git a/sc4pd/source/ring3.cpp b/sc4pd/source/ring3.cpp new file mode 100644 index 0000000..1887066 --- /dev/null +++ b/sc4pd/source/ring3.cpp @@ -0,0 +1,136 @@ +/* sc4pd + ring3, ring3~ + + 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: Evan Parker & Keith Rowe: Dark Rags + +*/ + +#include <flext.h> +#include "SC_PlugIn.h" + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +inline float sc_ring3 (float a, float b) +{ + return a*a*b; +} + + +/* ------------------------ ring3~ -----------------------------*/ + +class ring3_ar + :public flext_dsp +{ + FLEXT_HEADER(ring3_ar,flext_dsp); + +public: + ring3_ar(int argc,t_atom * argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + +private: + +}; + +FLEXT_LIB_DSP_V("ring3~",ring3_ar); + +ring3_ar::ring3_ar(int argc,t_atom * argv) +{ + AddInSignal(); + AddInSignal(); + AddOutSignal(); +} + +void ring3_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + t_sample *nin1 = *in; + t_sample *nin2 = *(in+1); + + for (int i = 0; i!= n;++i) + { + if( *nin2 > 0) + (*(nout)++) = sc_ring3( (*(nin1)++), (*(nin2)++) ); + } +} + + + +/* ------------------------ ring3 ------------------------------*/ + +class ring3_kr + :public flext_base +{ + FLEXT_HEADER(ring3_kr,flext_base); + +public: + ring3_kr(int argc,t_atom * argv); + +protected: + void m_perform(float f); + void m_set(float f); + +private: + float b; + FLEXT_CALLBACK_F(m_perform); + FLEXT_CALLBACK_F(m_set); +}; + +FLEXT_LIB_V("ring3",ring3_kr); + +ring3_kr::ring3_kr(int argc,t_atom * argv) + :b(0) +{ + + AddInFloat(); + AddInFloat(); + AddOutFloat(); + + FLEXT_ADDMETHOD(0,m_perform); + FLEXT_ADDMETHOD(1,m_set); +} + +void ring3_kr::m_perform(float f) +{ + ToOutFloat(0,sc_ring3(f,b)); +} + +void ring3_kr::m_set(float f) +{ + b=f; +} diff --git a/sc4pd/source/ring3.cpp~ b/sc4pd/source/ring3.cpp~ new file mode 100644 index 0000000..02e9a18 --- /dev/null +++ b/sc4pd/source/ring3.cpp~ @@ -0,0 +1,136 @@ +/* sc4pd + ring2, ring2~ + + 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: Evan Parker & Keith Rowe: Dark Rags + +*/ + +#include <flext.h> +#include "SC_PlugIn.h" + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +inline float sc_ring2 (float a, float b) +{ + return a*b+a+b; +} + + +/* ------------------------ ring2~ -----------------------------*/ + +class ring2_ar + :public flext_dsp +{ + FLEXT_HEADER(ring2_ar,flext_dsp); + +public: + ring2_ar(int argc,t_atom * argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + +private: + +}; + +FLEXT_LIB_DSP_V("ring2~",ring2_ar); + +ring2_ar::ring2_ar(int argc,t_atom * argv) +{ + AddInSignal(); + AddInSignal(); + AddOutSignal(); +} + +void ring2_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + t_sample *nin1 = *in; + t_sample *nin2 = *(in+1); + + for (int i = 0; i!= n;++i) + { + if( *nin2 > 0) + (*(nout)++) = sc_ring2( (*(nin1)++), (*(nin2)++) ); + } +} + + + +/* ------------------------ ring2 ------------------------------*/ + +class ring2_kr + :public flext_base +{ + FLEXT_HEADER(ring2_kr,flext_base); + +public: + ring2_kr(int argc,t_atom * argv); + +protected: + void m_perform(float f); + void m_set(float f); + +private: + float b; + FLEXT_CALLBACK_F(m_perform); + FLEXT_CALLBACK_F(m_set); +}; + +FLEXT_LIB_V("ring2",ring2_kr); + +ring2_kr::ring2_kr(int argc,t_atom * argv) + :b(0) +{ + + AddInFloat(); + AddInFloat(); + AddOutFloat(); + + FLEXT_ADDMETHOD(0,m_perform); + FLEXT_ADDMETHOD(1,m_set); +} + +void ring2_kr::m_perform(float f) +{ + ToOutFloat(0,sc_ring2(f,b)); +} + +void ring2_kr::m_set(float f) +{ + b=f; +} diff --git a/sc4pd/source/ring4.cpp b/sc4pd/source/ring4.cpp new file mode 100644 index 0000000..b343f67 --- /dev/null +++ b/sc4pd/source/ring4.cpp @@ -0,0 +1,136 @@ +/* sc4pd + ring4, ring4~ + + 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: Evan Parker & Keith Rowe: Dark Rags + +*/ + +#include <flext.h> +#include "SC_PlugIn.h" + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +inline float sc_ring4 (float a, float b) +{ + return (a*a*b)-(a*b*b); +} + + +/* ------------------------ ring4~ -----------------------------*/ + +class ring4_ar + :public flext_dsp +{ + FLEXT_HEADER(ring4_ar,flext_dsp); + +public: + ring4_ar(int argc,t_atom * argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + +private: + +}; + +FLEXT_LIB_DSP_V("ring4~",ring4_ar); + +ring4_ar::ring4_ar(int argc,t_atom * argv) +{ + AddInSignal(); + AddInSignal(); + AddOutSignal(); +} + +void ring4_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + t_sample *nin1 = *in; + t_sample *nin2 = *(in+1); + + for (int i = 0; i!= n;++i) + { + if( *nin2 > 0) + (*(nout)++) = sc_ring4( (*(nin1)++), (*(nin2)++) ); + } +} + + + +/* ------------------------ ring4 ------------------------------*/ + +class ring4_kr + :public flext_base +{ + FLEXT_HEADER(ring4_kr,flext_base); + +public: + ring4_kr(int argc,t_atom * argv); + +protected: + void m_perform(float f); + void m_set(float f); + +private: + float b; + FLEXT_CALLBACK_F(m_perform); + FLEXT_CALLBACK_F(m_set); +}; + +FLEXT_LIB_V("ring4",ring4_kr); + +ring4_kr::ring4_kr(int argc,t_atom * argv) + :b(0) +{ + + AddInFloat(); + AddInFloat(); + AddOutFloat(); + + FLEXT_ADDMETHOD(0,m_perform); + FLEXT_ADDMETHOD(1,m_set); +} + +void ring4_kr::m_perform(float f) +{ + ToOutFloat(0,sc_ring4(f,b)); +} + +void ring4_kr::m_set(float f) +{ + b=f; +} diff --git a/sc4pd/source/ring4.cpp~ b/sc4pd/source/ring4.cpp~ new file mode 100644 index 0000000..1887066 --- /dev/null +++ b/sc4pd/source/ring4.cpp~ @@ -0,0 +1,136 @@ +/* sc4pd + ring3, ring3~ + + 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: Evan Parker & Keith Rowe: Dark Rags + +*/ + +#include <flext.h> +#include "SC_PlugIn.h" + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +inline float sc_ring3 (float a, float b) +{ + return a*a*b; +} + + +/* ------------------------ ring3~ -----------------------------*/ + +class ring3_ar + :public flext_dsp +{ + FLEXT_HEADER(ring3_ar,flext_dsp); + +public: + ring3_ar(int argc,t_atom * argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + +private: + +}; + +FLEXT_LIB_DSP_V("ring3~",ring3_ar); + +ring3_ar::ring3_ar(int argc,t_atom * argv) +{ + AddInSignal(); + AddInSignal(); + AddOutSignal(); +} + +void ring3_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + t_sample *nin1 = *in; + t_sample *nin2 = *(in+1); + + for (int i = 0; i!= n;++i) + { + if( *nin2 > 0) + (*(nout)++) = sc_ring3( (*(nin1)++), (*(nin2)++) ); + } +} + + + +/* ------------------------ ring3 ------------------------------*/ + +class ring3_kr + :public flext_base +{ + FLEXT_HEADER(ring3_kr,flext_base); + +public: + ring3_kr(int argc,t_atom * argv); + +protected: + void m_perform(float f); + void m_set(float f); + +private: + float b; + FLEXT_CALLBACK_F(m_perform); + FLEXT_CALLBACK_F(m_set); +}; + +FLEXT_LIB_V("ring3",ring3_kr); + +ring3_kr::ring3_kr(int argc,t_atom * argv) + :b(0) +{ + + AddInFloat(); + AddInFloat(); + AddOutFloat(); + + FLEXT_ADDMETHOD(0,m_perform); + FLEXT_ADDMETHOD(1,m_set); +} + +void ring3_kr::m_perform(float f) +{ + ToOutFloat(0,sc_ring3(f,b)); +} + +void ring3_kr::m_set(float f) +{ + b=f; +} diff --git a/sc4pd/source/scaleneg.cpp b/sc4pd/source/scaleneg.cpp new file mode 100644 index 0000000..f6e69db --- /dev/null +++ b/sc4pd/source/scaleneg.cpp @@ -0,0 +1,130 @@ +/* sc4pd + scaleneg, scaleneg(~) + + 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 & Toshimaru Nakamura: Weather Sky + +*/ + +#include <flext.h> +#include "SC_PlugIn.h" + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +/* ------------------------ scaleneg~ -----------------------------*/ + +class scaleneg_ar + :public flext_dsp +{ + FLEXT_HEADER(scaleneg_ar,flext_dsp); + +public: + scaleneg_ar(int argc,t_atom * argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + +private: + +}; + +FLEXT_LIB_DSP_V("scaleneg~",scaleneg_ar); + +scaleneg_ar::scaleneg_ar(int argc,t_atom * argv) +{ + AddInSignal(); + AddInSignal(); + AddOutSignal(); +} + +void scaleneg_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + t_sample *nin1 = *in; + t_sample *nin2 = *(in+1); + + for (int i = 0; i!= n;++i) + { + if( *nin2 > 0) + (*(nout)++) = sc_scaleneg( (*(nin1)++), (*(nin2)++) ); + } +} + + + +/* ------------------------ scaleneg ------------------------------*/ + +class scaleneg_kr + :public flext_base +{ + FLEXT_HEADER(scaleneg_kr,flext_base); + +public: + scaleneg_kr(int argc,t_atom * argv); + +protected: + void m_perform(float f); + void m_set(float f); + +private: + float b; + FLEXT_CALLBACK_F(m_perform); + FLEXT_CALLBACK_F(m_set); +}; + +FLEXT_LIB_V("scaleneg",scaleneg_kr); + +scaleneg_kr::scaleneg_kr(int argc,t_atom * argv) + :b(0) +{ + + AddInFloat(); + AddInFloat(); + AddOutFloat(); + + FLEXT_ADDMETHOD(0,m_perform); + FLEXT_ADDMETHOD(1,m_set); +} + +void scaleneg_kr::m_perform(float f) +{ + ToOutFloat(0,sc_scaleneg(f,b)); +} + +void scaleneg_kr::m_set(float f) +{ + b=f; +} diff --git a/sc4pd/source/sqrdif.cpp b/sc4pd/source/sqrdif.cpp new file mode 100644 index 0000000..617f987 --- /dev/null +++ b/sc4pd/source/sqrdif.cpp @@ -0,0 +1,137 @@ +/* sc4pd + sqrdif, sqrdif~ + + 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: Evan Parker & Keith Rowe: Dark Rags + +*/ + +#include <flext.h> +#include "SC_PlugIn.h" + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +inline float sc_sqrdif (float a, float b) +{ + float f=a-b; + return f*f; +} + + +/* ------------------------ sqrdif~ -----------------------------*/ + +class sqrdif_ar + :public flext_dsp +{ + FLEXT_HEADER(sqrdif_ar,flext_dsp); + +public: + sqrdif_ar(int argc,t_atom * argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + +private: + +}; + +FLEXT_LIB_DSP_V("sqrdif~",sqrdif_ar); + +sqrdif_ar::sqrdif_ar(int argc,t_atom * argv) +{ + AddInSignal(); + AddInSignal(); + AddOutSignal(); +} + +void sqrdif_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + t_sample *nin1 = *in; + t_sample *nin2 = *(in+1); + + for (int i = 0; i!= n;++i) + { + if( *nin2 > 0) + (*(nout)++) = sc_sqrdif( (*(nin1)++), (*(nin2)++) ); + } +} + + + +/* ------------------------ sqrdif ------------------------------*/ + +class sqrdif_kr + :public flext_base +{ + FLEXT_HEADER(sqrdif_kr,flext_base); + +public: + sqrdif_kr(int argc,t_atom * argv); + +protected: + void m_perform(float f); + void m_set(float f); + +private: + float b; + FLEXT_CALLBACK_F(m_perform); + FLEXT_CALLBACK_F(m_set); +}; + +FLEXT_LIB_V("sqrdif",sqrdif_kr); + +sqrdif_kr::sqrdif_kr(int argc,t_atom * argv) + :b(0) +{ + + AddInFloat(); + AddInFloat(); + AddOutFloat(); + + FLEXT_ADDMETHOD(0,m_perform); + FLEXT_ADDMETHOD(1,m_set); +} + +void sqrdif_kr::m_perform(float f) +{ + ToOutFloat(0,sc_sqrdif(f,b)); +} + +void sqrdif_kr::m_set(float f) +{ + b=f; +} diff --git a/sc4pd/source/sqrdif.cpp~ b/sc4pd/source/sqrdif.cpp~ new file mode 100644 index 0000000..7e5d431 --- /dev/null +++ b/sc4pd/source/sqrdif.cpp~ @@ -0,0 +1,136 @@ +/* sc4pd + sqrdif, sqrdif~ + + 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: Evan Parker & Keith Rowe: Dark Rags + +*/ + +#include <flext.h> +#include "SC_PlugIn.h" + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +inline float sc_sqrdif (float a, float b) +{ + return a*a+b*b; +} + + +/* ------------------------ sqrdif~ -----------------------------*/ + +class sqrdif_ar + :public flext_dsp +{ + FLEXT_HEADER(sqrdif_ar,flext_dsp); + +public: + sqrdif_ar(int argc,t_atom * argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + +private: + +}; + +FLEXT_LIB_DSP_V("sqrdif~",sqrdif_ar); + +sqrdif_ar::sqrdif_ar(int argc,t_atom * argv) +{ + AddInSignal(); + AddInSignal(); + AddOutSignal(); +} + +void sqrdif_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + t_sample *nin1 = *in; + t_sample *nin2 = *(in+1); + + for (int i = 0; i!= n;++i) + { + if( *nin2 > 0) + (*(nout)++) = sc_sqrdif( (*(nin1)++), (*(nin2)++) ); + } +} + + + +/* ------------------------ sqrdif ------------------------------*/ + +class sqrdif_kr + :public flext_base +{ + FLEXT_HEADER(sqrdif_kr,flext_base); + +public: + sqrdif_kr(int argc,t_atom * argv); + +protected: + void m_perform(float f); + void m_set(float f); + +private: + float b; + FLEXT_CALLBACK_F(m_perform); + FLEXT_CALLBACK_F(m_set); +}; + +FLEXT_LIB_V("sqrdif",sqrdif_kr); + +sqrdif_kr::sqrdif_kr(int argc,t_atom * argv) + :b(0) +{ + + AddInFloat(); + AddInFloat(); + AddOutFloat(); + + FLEXT_ADDMETHOD(0,m_perform); + FLEXT_ADDMETHOD(1,m_set); +} + +void sqrdif_kr::m_perform(float f) +{ + ToOutFloat(0,sc_sqrdif(f,b)); +} + +void sqrdif_kr::m_set(float f) +{ + b=f; +} diff --git a/sc4pd/source/sqrsum.cpp b/sc4pd/source/sqrsum.cpp new file mode 100644 index 0000000..8a39b68 --- /dev/null +++ b/sc4pd/source/sqrsum.cpp @@ -0,0 +1,137 @@ +/* sc4pd + sqrsum, sqrsum~ + + 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: Evan Parker & Keith Rowe: Dark Rags + +*/ + +#include <flext.h> +#include "SC_PlugIn.h" + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +inline float sc_sqrsum (float a, float b) +{ + float f=a+b; + return f*f; +} + + +/* ------------------------ sqrsum~ -----------------------------*/ + +class sqrsum_ar + :public flext_dsp +{ + FLEXT_HEADER(sqrsum_ar,flext_dsp); + +public: + sqrsum_ar(int argc,t_atom * argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + +private: + +}; + +FLEXT_LIB_DSP_V("sqrsum~",sqrsum_ar); + +sqrsum_ar::sqrsum_ar(int argc,t_atom * argv) +{ + AddInSignal(); + AddInSignal(); + AddOutSignal(); +} + +void sqrsum_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + t_sample *nin1 = *in; + t_sample *nin2 = *(in+1); + + for (int i = 0; i!= n;++i) + { + if( *nin2 > 0) + (*(nout)++) = sc_sqrsum( (*(nin1)++), (*(nin2)++) ); + } +} + + + +/* ------------------------ sqrsum ------------------------------*/ + +class sqrsum_kr + :public flext_base +{ + FLEXT_HEADER(sqrsum_kr,flext_base); + +public: + sqrsum_kr(int argc,t_atom * argv); + +protected: + void m_perform(float f); + void m_set(float f); + +private: + float b; + FLEXT_CALLBACK_F(m_perform); + FLEXT_CALLBACK_F(m_set); +}; + +FLEXT_LIB_V("sqrsum",sqrsum_kr); + +sqrsum_kr::sqrsum_kr(int argc,t_atom * argv) + :b(0) +{ + + AddInFloat(); + AddInFloat(); + AddOutFloat(); + + FLEXT_ADDMETHOD(0,m_perform); + FLEXT_ADDMETHOD(1,m_set); +} + +void sqrsum_kr::m_perform(float f) +{ + ToOutFloat(0,sc_sqrsum(f,b)); +} + +void sqrsum_kr::m_set(float f) +{ + b=f; +} diff --git a/sc4pd/source/sqrsum.cpp~ b/sc4pd/source/sqrsum.cpp~ new file mode 100644 index 0000000..617f987 --- /dev/null +++ b/sc4pd/source/sqrsum.cpp~ @@ -0,0 +1,137 @@ +/* sc4pd + sqrdif, sqrdif~ + + 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: Evan Parker & Keith Rowe: Dark Rags + +*/ + +#include <flext.h> +#include "SC_PlugIn.h" + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +inline float sc_sqrdif (float a, float b) +{ + float f=a-b; + return f*f; +} + + +/* ------------------------ sqrdif~ -----------------------------*/ + +class sqrdif_ar + :public flext_dsp +{ + FLEXT_HEADER(sqrdif_ar,flext_dsp); + +public: + sqrdif_ar(int argc,t_atom * argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + +private: + +}; + +FLEXT_LIB_DSP_V("sqrdif~",sqrdif_ar); + +sqrdif_ar::sqrdif_ar(int argc,t_atom * argv) +{ + AddInSignal(); + AddInSignal(); + AddOutSignal(); +} + +void sqrdif_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + t_sample *nin1 = *in; + t_sample *nin2 = *(in+1); + + for (int i = 0; i!= n;++i) + { + if( *nin2 > 0) + (*(nout)++) = sc_sqrdif( (*(nin1)++), (*(nin2)++) ); + } +} + + + +/* ------------------------ sqrdif ------------------------------*/ + +class sqrdif_kr + :public flext_base +{ + FLEXT_HEADER(sqrdif_kr,flext_base); + +public: + sqrdif_kr(int argc,t_atom * argv); + +protected: + void m_perform(float f); + void m_set(float f); + +private: + float b; + FLEXT_CALLBACK_F(m_perform); + FLEXT_CALLBACK_F(m_set); +}; + +FLEXT_LIB_V("sqrdif",sqrdif_kr); + +sqrdif_kr::sqrdif_kr(int argc,t_atom * argv) + :b(0) +{ + + AddInFloat(); + AddInFloat(); + AddOutFloat(); + + FLEXT_ADDMETHOD(0,m_perform); + FLEXT_ADDMETHOD(1,m_set); +} + +void sqrdif_kr::m_perform(float f) +{ + ToOutFloat(0,sc_sqrdif(f,b)); +} + +void sqrdif_kr::m_set(float f) +{ + b=f; +} diff --git a/sc4pd/source/sumsqr.cpp b/sc4pd/source/sumsqr.cpp new file mode 100644 index 0000000..5eb5726 --- /dev/null +++ b/sc4pd/source/sumsqr.cpp @@ -0,0 +1,136 @@ +/* sc4pd + sumsqr, sumsqr~ + + 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: Evan Parker & Keith Rowe: Dark Rags + +*/ + +#include <flext.h> +#include "SC_PlugIn.h" + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) +#error You need at least FLEXT version 0.4.6 +#endif + + +inline float sc_sumsqr (float a, float b) +{ + return a*a+b*b; +} + + +/* ------------------------ sumsqr~ -----------------------------*/ + +class sumsqr_ar + :public flext_dsp +{ + FLEXT_HEADER(sumsqr_ar,flext_dsp); + +public: + sumsqr_ar(int argc,t_atom * argv); + +protected: + virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + +private: + +}; + +FLEXT_LIB_DSP_V("sumsqr~",sumsqr_ar); + +sumsqr_ar::sumsqr_ar(int argc,t_atom * argv) +{ + AddInSignal(); + AddInSignal(); + AddOutSignal(); +} + +void sumsqr_ar::m_signal(int n, t_sample *const *in, + t_sample *const *out) +{ + t_sample *nout = *out; + t_sample *nin1 = *in; + t_sample *nin2 = *(in+1); + + for (int i = 0; i!= n;++i) + { + if( *nin2 > 0) + (*(nout)++) = sc_sumsqr( (*(nin1)++), (*(nin2)++) ); + } +} + + + +/* ------------------------ sumsqr ------------------------------*/ + +class sumsqr_kr + :public flext_base +{ + FLEXT_HEADER(sumsqr_kr,flext_base); + +public: + sumsqr_kr(int argc,t_atom * argv); + +protected: + void m_perform(float f); + void m_set(float f); + +private: + float b; + FLEXT_CALLBACK_F(m_perform); + FLEXT_CALLBACK_F(m_set); +}; + +FLEXT_LIB_V("sumsqr",sumsqr_kr); + +sumsqr_kr::sumsqr_kr(int argc,t_atom * argv) + :b(0) +{ + + AddInFloat(); + AddInFloat(); + AddOutFloat(); + + FLEXT_ADDMETHOD(0,m_perform); + FLEXT_ADDMETHOD(1,m_set); +} + +void sumsqr_kr::m_perform(float f) +{ + ToOutFloat(0,sc_sumsqr(f,b)); +} + +void sumsqr_kr::m_set(float f) +{ + b=f; +} |