Update of /cvsroot/pure-data/externals/sc4pd/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1574/source
Modified Files: BrownNoise.cpp ClipNoise.cpp Dust.cpp Dust2.cpp GrayNoise.cpp IRand.cpp PinkNoise.cpp Rand.cpp TExpRand.cpp TIRand.cpp TRand.cpp WhiteNoise.cpp main.cpp support.hpp Added Files: ExpRand.cpp Log Message: rng have setable seed and other changes
Index: support.hpp =================================================================== RCS file: /cvsroot/pure-data/externals/sc4pd/source/support.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** support.hpp 14 Jul 2004 18:29:52 -0000 1.2 --- support.hpp 15 Jul 2004 19:05:05 -0000 1.3 *************** *** 36,84 ****
#include <flext.h> ! #include <flsupport.h>
! #include <strings.h> #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() > i) - return flext::GetAFloat(a[i]); - else - return 0; - }
! inline bool sc_ar(flext::AtomList a) ! { ! for (int i = 0; i!=a.Count();++i) ! { ! if ( flext::IsSymbol(a[i]) ) ! { ! const char * teststring; ! teststring = flext::GetString(a[i]); ! if((strcmp(teststring,"ar"))==0) ! return true; ! } ! } ! return false; ! }
// macros to put rgen state in registers --- 36,55 ----
#include <flext.h> ! //#include <flsupport.h> ! #include "SC_PlugIn.h"
! ! //#include <strings.h> #if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) #error You need at least FLEXT version 0.4.6 #endif
+ /* for argument parsing */ + bool sc_add (flext::AtomList a); + float sc_getfloatarg (flext::AtomList a,int i); + bool sc_ar(flext::AtomList a);
! /* for rngs */
// macros to put rgen state in registers *************** *** 93,94 **** --- 64,66 ---- rgen.s3 = s3;
+ int32 timeseed();
Index: TExpRand.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/sc4pd/source/TExpRand.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TExpRand.cpp 14 Jul 2004 22:07:27 -0000 1.1 --- TExpRand.cpp 15 Jul 2004 19:05:05 -0000 1.2 *************** *** 73,76 **** --- 73,81 ---- ratio = hi / lo; } + + void m_seed(int i) + { + rgen.init(i); + }
private: *************** *** 84,87 **** --- 89,93 ---- FLEXT_CALLBACK_F(m_setlo); FLEXT_CALLBACK_F(m_sethi); + FLEXT_CALLBACK_I(m_seed); };
*************** *** 101,105 **** ratio = hi / lo;
! rgen.init(0); //this should be changed
AddOutSignal(); --- 107,111 ---- ratio = hi / lo;
! rgen.init(timeseed());
AddOutSignal(); *************** *** 108,111 **** --- 114,118 ---- FLEXT_ADDMETHOD_(0,"setlo",m_setlo); FLEXT_ADDMETHOD_(0,"sethi",m_sethi); + FLEXT_ADDMETHOD_(0,"seed",m_seed); }
*************** *** 160,163 **** --- 167,175 ---- }
+ void m_seed(int i) + { + rgen.init(i); + } + private: float lo; *************** *** 168,171 **** --- 180,184 ---- FLEXT_CALLBACK_F(m_setlo); FLEXT_CALLBACK_F(m_sethi); + FLEXT_CALLBACK_I(m_seed); };
*************** *** 184,188 **** ratio = hi / lo;
! rgen.init(0);
AddOutFloat(); --- 197,201 ---- ratio = hi / lo;
! rgen.init(timeseed());
AddOutFloat(); *************** *** 191,194 **** --- 204,208 ---- FLEXT_ADDMETHOD_(0,"setlo",m_setlo); FLEXT_ADDMETHOD_(0,"sethi",m_sethi); + FLEXT_ADDMETHOD_(0,"seed",m_seed); }
Index: main.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/sc4pd/source/main.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** main.cpp 14 Jul 2004 22:09:37 -0000 1.3 --- main.cpp 15 Jul 2004 19:05:05 -0000 1.4 *************** *** 37,40 **** --- 37,41 ----
#include <flext.h> + #include "SC_PlugIn.h"
#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) *************** *** 44,47 **** --- 45,49 ---- #define SC4PD_VERSION "0.01"
+ void sc4pd_library_setup() { *************** *** 54,58 **** " ClipNoise(~), GrayNoise(~), Dust2(~), WhiteNoise(~), " "PinkNoise(~), \n Crackle(~), Rand(~), TRand(~), " ! "TExpRand(~), IRand(~), TIRand(~)\n");
//initialize objects --- 56,61 ---- " ClipNoise(~), GrayNoise(~), Dust2(~), WhiteNoise(~), " "PinkNoise(~), \n Crackle(~), Rand(~), TRand(~), " ! "TExpRand(~), IRand(~), TIRand(~),\n CoinGate, " ! "LinRand(~), NRand(~), ExpRand(~)\n");
//initialize objects *************** *** 104,107 **** --- 107,121 ---- FLEXT_DSP_SETUP(TIRand_ar); FLEXT_SETUP(TIRand_kr); + + FLEXT_SETUP(CoinGate_kr); + + FLEXT_DSP_SETUP(LinRand_ar); + FLEXT_SETUP(LinRand_kr); + + FLEXT_DSP_SETUP(NRand_ar); + FLEXT_SETUP(NRand_kr); + + FLEXT_DSP_SETUP(ExpRand_ar); + FLEXT_SETUP(ExpRand_kr); }
Index: IRand.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/sc4pd/source/IRand.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IRand.cpp 14 Jul 2004 22:07:27 -0000 1.1 --- IRand.cpp 15 Jul 2004 19:05:05 -0000 1.2 *************** *** 59,62 **** --- 59,67 ---- virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); virtual void m_dsp(int n, t_sample *const *in, t_sample *const *out); + + void m_seed(int i) + { + rgen.init(i); + }
private: *************** *** 65,68 **** --- 70,74 ---- int hi; RGen rgen; + FLEXT_CALLBACK_I(m_seed); };
*************** *** 71,74 **** --- 77,82 ---- IRand_ar::IRand_ar(int argc, t_atom *argv) { + FLEXT_ADDMETHOD_(0,"seed",m_seed); + AtomList Args(argc,argv);
*************** *** 81,85 **** hi=int(sc_getfloatarg(Args,1));
! rgen.init(0); //this should be changed
AddOutSignal(); --- 89,93 ---- hi=int(sc_getfloatarg(Args,1));
! rgen.init(timeseed());
AddOutSignal(); *************** *** 120,127 **** --- 128,141 ---- void m_loadbang();
+ void m_seed(int i) + { + rgen.init(i); + } + private: int lo; int hi; RGen rgen; + FLEXT_CALLBACK_I(m_seed); };
*************** *** 130,133 **** --- 144,149 ---- IRand_kr::IRand_kr(int argc, t_atom *argv) { + FLEXT_ADDMETHOD_(0,"seed",m_seed); + AtomList Args(argc,argv); if (Args.Count() != 2) *************** *** 139,143 **** hi=int(sc_getfloatarg(Args,1));
! rgen.init(0);
AddOutInt(); --- 155,159 ---- hi=int(sc_getfloatarg(Args,1));
! rgen.init(timeseed());
AddOutInt();
Index: Dust2.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/sc4pd/source/Dust2.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Dust2.cpp 14 Jul 2004 18:29:52 -0000 1.2 --- Dust2.cpp 15 Jul 2004 19:05:05 -0000 1.3 *************** *** 65,71 **** --- 65,77 ---- m_scale = m_thresh > 0.f ? 1.f / m_thresh : 0.f; } + + void m_seed(int i) + { + rgen.init(i); + }
private: FLEXT_CALLBACK_F(m_set); + FLEXT_CALLBACK_I(m_seed); float m_density, m_thresh, m_scale; RGen rgen; *************** *** 78,81 **** --- 84,88 ---- { FLEXT_ADDMETHOD_(0,"set",m_set); + FLEXT_ADDMETHOD_(0,"seed",m_seed);
//parse arguments *************** *** 83,87 **** m_density=sc_getfloatarg(Args,0);
! rgen.init(0); //set seed to 0
AddOutSignal(); --- 90,94 ---- m_density=sc_getfloatarg(Args,0);
! rgen.init(timeseed());
AddOutSignal(); *************** *** 131,134 **** --- 138,146 ---- Timer Dust2_timer; void m_doit(void*); + + void m_seed(int i) + { + rgen.init(i); + }
private: *************** *** 137,140 **** --- 149,153 ---- RGen rgen; FLEXT_CALLBACK_1(m_set,float); + FLEXT_CALLBACK_I(m_seed); FLEXT_CALLBACK_T(m_doit); }; *************** *** 146,149 **** --- 159,163 ---- { FLEXT_ADDMETHOD(0,m_set); + FLEXT_ADDMETHOD_(0,"seed",m_seed);
//parse arguments *************** *** 151,155 **** m_density=sc_getfloatarg(Args,0);
! rgen.init(0); //set seed to 0 AddOutFloat();
--- 165,169 ---- m_density=sc_getfloatarg(Args,0);
! rgen.init(timeseed()); AddOutFloat();
Index: PinkNoise.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/sc4pd/source/PinkNoise.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PinkNoise.cpp 14 Jul 2004 16:21:44 -0000 1.1.1.1 --- PinkNoise.cpp 15 Jul 2004 19:05:05 -0000 1.2 *************** *** 58,61 **** --- 58,66 ---- protected: virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + + void m_seed(int i) + { + rgen.init(i); + }
private: *************** *** 63,66 **** --- 68,72 ---- int32 m_total; RGen rgen; + FLEXT_CALLBACK_I(m_seed); };
*************** *** 70,78 **** : m_total(0) {
//parse arguments AtomList Args(argc,argv);
! rgen.init(0); //set seed to 0
for (int i=0; i<16; ++i) --- 76,85 ---- : m_total(0) { + FLEXT_ADDMETHOD_(0,"seed",m_seed);
//parse arguments AtomList Args(argc,argv);
! rgen.init(timeseed());
for (int i=0; i<16; ++i) *************** *** 124,127 **** --- 131,139 ---- protected: void m_perform(); + + void m_seed(int i) + { + rgen.init(i); + }
private: *************** *** 130,133 **** --- 142,146 ---- RGen rgen; FLEXT_CALLBACK(m_perform); + FLEXT_CALLBACK_I(m_seed); };
*************** *** 138,146 **** { 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) --- 151,160 ---- { FLEXT_ADDBANG(0,m_perform); + FLEXT_ADDMETHOD_(0,"seed",m_seed);
//parse arguments AtomList Args(argc,argv);
! rgen.init(timeseed());
for (int i=0; i<16; ++i)
Index: Rand.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/sc4pd/source/Rand.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Rand.cpp 14 Jul 2004 18:34:35 -0000 1.1 --- Rand.cpp 15 Jul 2004 19:05:05 -0000 1.2 *************** *** 59,62 **** --- 59,67 ---- virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); virtual void m_dsp(int n, t_sample *const *in, t_sample *const *out); + + void m_seed(int i) + { + rgen.init(i); + }
private: *************** *** 65,68 **** --- 70,74 ---- float hi; RGen rgen; + FLEXT_CALLBACK_I(m_seed); };
*************** *** 71,74 **** --- 77,82 ---- Rand_ar::Rand_ar(int argc, t_atom *argv) { + FLEXT_ADDMETHOD_(0,"seed",m_seed); + AtomList Args(argc,argv);
*************** *** 81,85 **** hi=sc_getfloatarg(Args,1);
! rgen.init(0); //this should be changed
AddOutSignal(); --- 89,93 ---- hi=sc_getfloatarg(Args,1);
! rgen.init(timeseed());
AddOutSignal(); *************** *** 120,127 **** --- 128,141 ---- void m_loadbang();
+ void m_seed(int i) + { + rgen.init(i); + } + private: float lo; float hi; RGen rgen; + FLEXT_CALLBACK_I(m_seed); };
*************** *** 130,133 **** --- 144,149 ---- Rand_kr::Rand_kr(int argc, t_atom *argv) { + FLEXT_ADDMETHOD_(0,"seed",m_seed); + AtomList Args(argc,argv); if (Args.Count() != 2) *************** *** 139,144 **** hi=sc_getfloatarg(Args,1);
! rgen.init(0); ! AddOutFloat(); } --- 155,160 ---- hi=sc_getfloatarg(Args,1);
! rgen.init(timeseed()); ! AddOutFloat(); }
--- NEW FILE: ExpRand.cpp --- /* sc4pd ExpRand, ExpRand~
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: Jim O'Rourke & Loren Mazzacane Connors: In Bern
*/
#include <flext.h> #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
/* ------------------------ ExpRand~ -------------------------------*/
class ExpRand_ar: public flext_dsp { FLEXT_HEADER(ExpRand_ar,flext_dsp);
public: ExpRand_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_sample *const *in, t_sample *const *out);
void m_seed(int i) { rgen.init(i); }
private: float m_sample; float lo; float hi; int sc_n; RGen rgen; FLEXT_CALLBACK_I(m_seed); };
FLEXT_LIB_DSP_V("ExpRand~",ExpRand_ar);
ExpRand_ar::ExpRand_ar(int argc, t_atom *argv) { FLEXT_ADDMETHOD_(0,"seed",m_seed);
AtomList Args(argc,argv);
if (Args.Count() != 2) { post("not enough arguments"); return; } lo=sc_getfloatarg(Args,0); hi=sc_getfloatarg(Args,1);
rgen.init(timeseed());
AddOutSignal(); }
void ExpRand_ar::m_dsp(int n, t_sample *const *in, t_sample *const *out) { float ratio = hi / lo; m_sample = pow(ratio,rgen.frand()) * lo); }
void ExpRand_ar::m_signal(int n, t_sample *const *in, t_sample *const *out) { t_sample *nout = *out;
float sample = m_sample;
for (int i = 0; i!= n;++i) { (*(nout)++) = sample; } }
/* ------------------------ ExpRand ---------------------------------*/
class ExpRand_kr: public flext_base { FLEXT_HEADER(ExpRand_kr,flext_base);
public: ExpRand_kr(int argc, t_atom *argv);
protected: void m_loadbang();
void m_seed(int i) { rgen.init(i); }
private: float lo; float hi; int sc_n; RGen rgen; FLEXT_CALLBACK_I(m_seed); };
FLEXT_LIB_V("ExpRand",ExpRand_kr);
ExpRand_kr::ExpRand_kr(int argc, t_atom *argv) { FLEXT_ADDMETHOD_(0,"seed",m_seed);
AtomList Args(argc,argv); if (Args.Count() != 2) { post("not enough arguments"); return; } lo=sc_getfloatarg(Args,0); hi=sc_getfloatarg(Args,1);
rgen.init(timeseed());
AddOutFloat(); }
void ExpRand_kr::m_loadbang() { float ratio = hi / lo; ToOutFloat(0,pow(ratio,rgen.frand()) * lo); }
Index: TIRand.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/sc4pd/source/TIRand.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TIRand.cpp 14 Jul 2004 22:07:27 -0000 1.1 --- TIRand.cpp 15 Jul 2004 19:05:05 -0000 1.2 *************** *** 74,77 **** --- 74,81 ---- }
+ void m_seed(int i) + { + rgen.init(i); + }
private: *************** *** 85,88 **** --- 89,93 ---- FLEXT_CALLBACK_I(m_setlo); FLEXT_CALLBACK_I(m_sethi); + FLEXT_CALLBACK_I(m_seed); };
*************** *** 102,106 **** range = hi - lo;
! rgen.init(0); //this should be changed
AddOutSignal(); --- 107,111 ---- range = hi - lo;
! rgen.init(timeseed());
AddOutSignal(); *************** *** 109,112 **** --- 114,118 ---- FLEXT_ADDMETHOD_(0,"setlo",m_setlo); FLEXT_ADDMETHOD_(0,"sethi",m_sethi); + FLEXT_ADDMETHOD_(0,"seed",m_seed); }
*************** *** 161,164 **** --- 167,175 ---- }
+ void m_seed(int i) + { + rgen.init(i); + } + private: int lo; *************** *** 169,172 **** --- 180,184 ---- FLEXT_CALLBACK_I(m_setlo); FLEXT_CALLBACK_I(m_sethi); + FLEXT_CALLBACK_I(m_seed); };
*************** *** 185,189 **** range = hi - lo;
! rgen.init(0);
AddOutInt(); --- 197,201 ---- range = hi - lo;
! rgen.init(timeseed());
AddOutInt(); *************** *** 192,195 **** --- 204,208 ---- FLEXT_ADDMETHOD_(0,"setlo",m_setlo); FLEXT_ADDMETHOD_(0,"sethi",m_sethi); + FLEXT_ADDMETHOD_(0,"seed",m_seed); }
Index: BrownNoise.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/sc4pd/source/BrownNoise.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** BrownNoise.cpp 14 Jul 2004 16:21:44 -0000 1.1.1.1 --- BrownNoise.cpp 15 Jul 2004 19:05:05 -0000 1.2 *************** *** 59,65 **** --- 59,71 ---- virtual void m_signal(int n, t_sample *const *in, t_sample *const *out);
+ void m_seed(int i) + { + rgen.init(i); + } + private: float m_level; RGen rgen; + FLEXT_CALLBACK_I(m_seed); };
*************** *** 68,78 **** 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(); } --- 74,85 ---- BrownNoise_ar::BrownNoise_ar(int argc, t_atom *argv) { //parse arguments AtomList Args(argc,argv);
! rgen.init(timeseed()); m_level=rgen.frand2(); ! ! FLEXT_ADDMETHOD_(0,"seed",m_seed); ! AddOutSignal(); } *************** *** 116,119 **** --- 123,131 ---- protected: void m_perform(); + + void m_seed(int i) + { + rgen.init(i); + }
private: *************** *** 121,124 **** --- 133,137 ---- RGen rgen; FLEXT_CALLBACK(m_perform); + FLEXT_CALLBACK_I(m_seed); };
*************** *** 128,136 **** { FLEXT_ADDBANG(0,m_perform);
//parse arguments AtomList Args(argc,argv);
! rgen.init(0); //set seed to 0 m_level=rgen.frand2();
--- 141,150 ---- { FLEXT_ADDBANG(0,m_perform); + FLEXT_ADDMETHOD_(0,"seed",m_seed);
//parse arguments AtomList Args(argc,argv);
! rgen.init(timeseed()); m_level=rgen.frand2();
Index: GrayNoise.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/sc4pd/source/GrayNoise.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** GrayNoise.cpp 14 Jul 2004 16:21:44 -0000 1.1.1.1 --- GrayNoise.cpp 15 Jul 2004 19:05:05 -0000 1.2 *************** *** 58,65 **** --- 58,71 ---- protected: virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + + void m_seed(int i) + { + rgen.init(i); + }
private: int m_counter; RGen rgen; + FLEXT_CALLBACK_I(m_seed); };
*************** *** 68,76 **** GrayNoise_ar::GrayNoise_ar(int argc, t_atom *argv) {
//parse arguments AtomList Args(argc,argv);
! rgen.init(0); //set seed to 0
AddOutSignal(); --- 74,83 ---- GrayNoise_ar::GrayNoise_ar(int argc, t_atom *argv) { + FLEXT_ADDMETHOD_(0,"seed",m_seed);
//parse arguments AtomList Args(argc,argv);
! rgen.init(timeseed());
AddOutSignal(); *************** *** 109,112 **** --- 116,124 ---- protected: void m_perform(); + + void m_seed(int i) + { + rgen.init(i); + }
private: *************** *** 114,117 **** --- 126,130 ---- RGen rgen; FLEXT_CALLBACK(m_perform); + FLEXT_CALLBACK_I(m_seed); };
*************** *** 121,129 **** { FLEXT_ADDBANG(0,m_perform);
//parse arguments AtomList Args(argc,argv);
! rgen.init(0); //set seed to 0
AddOutFloat(); --- 134,143 ---- { FLEXT_ADDBANG(0,m_perform); + FLEXT_ADDMETHOD_(0,"seed",m_seed);
//parse arguments AtomList Args(argc,argv);
! rgen.init(timeseed());
AddOutFloat();
Index: TRand.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/sc4pd/source/TRand.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TRand.cpp 14 Jul 2004 22:07:27 -0000 1.1 --- TRand.cpp 15 Jul 2004 19:05:05 -0000 1.2 *************** *** 74,77 **** --- 74,81 ---- }
+ void m_seed(int i) + { + rgen.init(i); + }
private: *************** *** 85,88 **** --- 89,93 ---- FLEXT_CALLBACK_F(m_setlo); FLEXT_CALLBACK_F(m_sethi); + FLEXT_CALLBACK_I(m_seed); };
*************** *** 102,106 **** range = hi - lo;
! rgen.init(0); //this should be changed
AddOutSignal(); --- 107,111 ---- range = hi - lo;
! rgen.init(timeseed());
AddOutSignal(); *************** *** 109,112 **** --- 114,118 ---- FLEXT_ADDMETHOD_(0,"setlo",m_setlo); FLEXT_ADDMETHOD_(0,"sethi",m_sethi); + FLEXT_ADDMETHOD_(0,"seed",m_seed); }
*************** *** 161,164 **** --- 167,175 ---- }
+ void m_seed(int i) + { + rgen.init(i); + } + private: float lo; *************** *** 169,172 **** --- 180,184 ---- FLEXT_CALLBACK_F(m_setlo); FLEXT_CALLBACK_F(m_sethi); + FLEXT_CALLBACK_I(m_seed); };
*************** *** 185,189 **** range = hi - lo;
! rgen.init(0);
AddOutFloat(); --- 197,201 ---- range = hi - lo;
! rgen.init(timeseed());
AddOutFloat(); *************** *** 192,195 **** --- 204,208 ---- FLEXT_ADDMETHOD_(0,"setlo",m_setlo); FLEXT_ADDMETHOD_(0,"sethi",m_sethi); + FLEXT_ADDMETHOD_(0,"seed",m_seed); }
Index: WhiteNoise.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/sc4pd/source/WhiteNoise.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** WhiteNoise.cpp 14 Jul 2004 16:21:44 -0000 1.1.1.1 --- WhiteNoise.cpp 15 Jul 2004 19:05:05 -0000 1.2 *************** *** 58,64 **** --- 58,70 ---- protected: virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + + void m_seed(int i) + { + rgen.init(i); + }
private: RGen rgen; + FLEXT_CALLBACK_I(m_seed); };
*************** *** 67,75 **** WhiteNoise_ar::WhiteNoise_ar(int argc, t_atom *argv) {
//parse arguments AtomList Args(argc,argv);
! rgen.init(0); //set seed to 0
AddOutSignal(); --- 73,82 ---- WhiteNoise_ar::WhiteNoise_ar(int argc, t_atom *argv) { + FLEXT_ADDMETHOD_(0,"seed",m_seed);
//parse arguments AtomList Args(argc,argv);
! rgen.init(timeseed());
AddOutSignal(); *************** *** 105,112 **** --- 112,125 ---- protected: void m_perform(); + + void m_seed(int i) + { + rgen.init(i); + }
private: RGen rgen; FLEXT_CALLBACK(m_perform); + FLEXT_CALLBACK_I(m_seed); };
*************** *** 116,124 **** { FLEXT_ADDBANG(0,m_perform);
//parse arguments AtomList Args(argc,argv);
! rgen.init(0); //set seed to 0
AddOutFloat(); --- 129,138 ---- { FLEXT_ADDBANG(0,m_perform); + FLEXT_ADDMETHOD_(0,"seed",m_seed);
//parse arguments AtomList Args(argc,argv);
! rgen.init(timeseed());
AddOutFloat();
Index: ClipNoise.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/sc4pd/source/ClipNoise.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ClipNoise.cpp 14 Jul 2004 16:21:44 -0000 1.1.1.1 --- ClipNoise.cpp 15 Jul 2004 19:05:05 -0000 1.2 *************** *** 58,64 **** --- 58,70 ---- protected: virtual void m_signal(int n, t_sample *const *in, t_sample *const *out); + + void m_seed(int i) + { + rgen.init(i); + }
private: RGen rgen; + FLEXT_CALLBACK_I(m_seed); };
*************** *** 67,75 **** ClipNoise_ar::ClipNoise_ar(int argc, t_atom *argv) {
//parse arguments AtomList Args(argc,argv);
! rgen.init(0); //set seed to 0
AddOutSignal(); --- 73,82 ---- ClipNoise_ar::ClipNoise_ar(int argc, t_atom *argv) { + FLEXT_ADDMETHOD_(0,"seed",m_seed);
//parse arguments AtomList Args(argc,argv);
! rgen.init(timeseed());
AddOutSignal(); *************** *** 105,112 **** --- 112,125 ---- protected: void m_perform(); + + void m_seed(int i) + { + rgen.init(i); + }
private: RGen rgen; FLEXT_CALLBACK(m_perform); + FLEXT_CALLBACK_I(m_seed); };
*************** *** 116,124 **** { FLEXT_ADDBANG(0,m_perform); ! //parse arguments AtomList Args(argc,argv);
! rgen.init(0); //set seed to 0
AddOutFloat(); --- 129,137 ---- { FLEXT_ADDBANG(0,m_perform); ! FLEXT_ADDMETHOD_(0,"seed",m_seed); //parse arguments AtomList Args(argc,argv);
! rgen.init(timeseed());
AddOutFloat();
Index: Dust.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/sc4pd/source/Dust.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Dust.cpp 14 Jul 2004 18:29:52 -0000 1.2 --- Dust.cpp 15 Jul 2004 19:05:05 -0000 1.3 *************** *** 64,70 **** --- 64,76 ---- m_scale = m_thresh > 0.f ? 1.f / m_thresh : 0.f; } + + void m_seed(int i) + { + rgen.init(i); + }
private: FLEXT_CALLBACK_F(m_set); + FLEXT_CALLBACK_I(m_seed); float m_density, m_thresh, m_scale; RGen rgen; *************** *** 77,80 **** --- 83,87 ---- { FLEXT_ADDMETHOD_(0,"set",m_set); + FLEXT_ADDMETHOD_(0,"seed",m_seed);
//parse arguments *************** *** 82,86 **** m_density=sc_getfloatarg(Args,0);
! rgen.init(0); //set seed to 0
AddOutSignal(); --- 89,94 ---- m_density=sc_getfloatarg(Args,0);
! rgen.init(timeseed()); !
AddOutSignal(); *************** *** 130,133 **** --- 138,146 ---- Timer Dust_timer; void m_doit(void*); + + void m_seed(int i) + { + rgen.init(i); + }
private: *************** *** 137,140 **** --- 150,154 ---- FLEXT_CALLBACK_1(m_set,float); FLEXT_CALLBACK_T(m_doit); + FLEXT_CALLBACK_I(m_seed); };
*************** *** 145,148 **** --- 159,163 ---- { FLEXT_ADDMETHOD(0,m_set); + FLEXT_ADDMETHOD_(0,"seed",m_seed);
//parse arguments *************** *** 150,154 **** m_density=sc_getfloatarg(Args,0);
! rgen.init(0); //set seed to 0 AddOutFloat();
--- 165,169 ---- m_density=sc_getfloatarg(Args,0);
! rgen.init(timeseed()); AddOutFloat();