From 9ecfff90135ec05498f9f55a39cd386c855a8571 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Thu, 15 Jul 2004 19:05:05 +0000 Subject: rng have setable seed and other changes svn path=/trunk/externals/tb/; revision=1867 --- sc4pd/source/WhiteNoise.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'sc4pd/source/WhiteNoise.cpp') diff --git a/sc4pd/source/WhiteNoise.cpp b/sc4pd/source/WhiteNoise.cpp index ecedf3d..6d308db 100644 --- a/sc4pd/source/WhiteNoise.cpp +++ b/sc4pd/source/WhiteNoise.cpp @@ -57,20 +57,27 @@ public: 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); }; FLEXT_LIB_DSP_V("WhiteNoise~",WhiteNoise_ar); WhiteNoise_ar::WhiteNoise_ar(int argc, t_atom *argv) { + FLEXT_ADDMETHOD_(0,"seed",m_seed); //parse arguments AtomList Args(argc,argv); - rgen.init(0); //set seed to 0 + rgen.init(timeseed()); AddOutSignal(); } @@ -104,10 +111,16 @@ public: protected: void m_perform(); + + void m_seed(int i) + { + rgen.init(i); + } private: RGen rgen; FLEXT_CALLBACK(m_perform); + FLEXT_CALLBACK_I(m_seed); }; FLEXT_LIB_V("WhiteNoise",WhiteNoise_kr); @@ -115,11 +128,12 @@ FLEXT_LIB_V("WhiteNoise",WhiteNoise_kr); WhiteNoise_kr::WhiteNoise_kr(int argc, t_atom *argv) { FLEXT_ADDBANG(0,m_perform); + FLEXT_ADDMETHOD_(0,"seed",m_seed); //parse arguments AtomList Args(argc,argv); - rgen.init(0); //set seed to 0 + rgen.init(timeseed()); AddOutFloat(); } -- cgit v1.2.1