aboutsummaryrefslogtreecommitdiff
path: root/sc4pd/source/IRand.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sc4pd/source/IRand.cpp')
-rw-r--r--sc4pd/source/IRand.cpp20
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();
}