diff options
author | Tim Blechmann <timblech@users.sourceforge.net> | 2004-07-15 19:05:05 +0000 |
---|---|---|
committer | IOhannes m zmölnig <zmoelnig@iem.at> | 2015-10-14 15:11:55 +0200 |
commit | 9ecfff90135ec05498f9f55a39cd386c855a8571 (patch) | |
tree | 4df5eeeadcca3431512a2a6f4a22b29bbeb0756e /sc4pd/source/IRand.cpp | |
parent | 0f1258611b064b215d1dd877f69e694fedf0d109 (diff) |
rng have setable seed and other changes
svn path=/trunk/externals/tb/; revision=1867
Diffstat (limited to 'sc4pd/source/IRand.cpp')
-rw-r--r-- | sc4pd/source/IRand.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/sc4pd/source/IRand.cpp b/sc4pd/source/IRand.cpp index 05cc5f0..095df92 100644 --- a/sc4pd/source/IRand.cpp +++ b/sc4pd/source/IRand.cpp @@ -58,18 +58,26 @@ public: 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; int lo; int hi; RGen rgen; + FLEXT_CALLBACK_I(m_seed); }; FLEXT_LIB_DSP_V("IRand~",IRand_ar); IRand_ar::IRand_ar(int argc, t_atom *argv) { + FLEXT_ADDMETHOD_(0,"seed",m_seed); + AtomList Args(argc,argv); if (Args.Count() != 2) @@ -80,7 +88,7 @@ IRand_ar::IRand_ar(int argc, t_atom *argv) lo=int(sc_getfloatarg(Args,0)); hi=int(sc_getfloatarg(Args,1)); - rgen.init(0); //this should be changed + rgen.init(timeseed()); AddOutSignal(); } @@ -119,16 +127,24 @@ public: protected: void m_loadbang(); + void m_seed(int i) + { + rgen.init(i); + } + private: int lo; int hi; RGen rgen; + FLEXT_CALLBACK_I(m_seed); }; FLEXT_LIB_V("IRand",IRand_kr); IRand_kr::IRand_kr(int argc, t_atom *argv) { + FLEXT_ADDMETHOD_(0,"seed",m_seed); + AtomList Args(argc,argv); if (Args.Count() != 2) { @@ -138,7 +154,7 @@ IRand_kr::IRand_kr(int argc, t_atom *argv) lo=int(sc_getfloatarg(Args,0)); hi=int(sc_getfloatarg(Args,1)); - rgen.init(0); + rgen.init(timeseed()); AddOutInt(); } |