Hi all,
The following code crashes Pd when the randomwalk object receives a bang... I'm stuck as to why, can anyone see a reason? void randomwalk_bang(t_randomwalk *x) { t_float randval = rand() % 2; if(randval == 0) randval = -1; if(randval == 1) randval = 1; x->current += (x->step * randval); outlet_float(x->f_out, x->current); }
Thanks in advance,
-Greg
Crashes are usually because memory hasn't been allocated properly. I'd check x->current and x->step. Hooking up to gdb will give you a lot more info. Search puredata.info for 'gdb' for a little howto.
.hc
On Mar 16, 2008, at 7:42 PM, Greg Surges wrote:
Hi all,
The following code crashes Pd when the randomwalk object receives a bang... I'm stuck as to why, can anyone see a reason? void randomwalk_bang(t_randomwalk *x) { t_float randval = rand() % 2; if(randval == 0) randval = -1; if(randval == 1) randval = 1; x->current += (x->step * randval); outlet_float(x->f_out, x->current); }
Thanks in advance,
-Greg
-- http://www.uwm.edu/~gssurges/ _______________________________________________ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
------------------------------------------------------------------------ ----
I spent 33 years and four months in active military service and during that period I spent most of my time as a high class muscle man for Big Business, for Wall Street and the bankers. - General Smedley Butler
Excellent, worked like a charm. I had an uninitialized outlet pointer. *grin*
Thanks much for the gdb tip, I'm certain it will come in handy often.
-Greg
On Sun, Mar 16, 2008 at 8:31 PM, Hans-Christoph Steiner hans@eds.org wrote:
Crashes are usually because memory hasn't been allocated properly. I'd check x->current and x->step. Hooking up to gdb will give you a lot more info. Search puredata.info for 'gdb' for a little howto.
.hc
On Mar 16, 2008, at 7:42 PM, Greg Surges wrote:
Hi all,
The following code crashes Pd when the randomwalk object receives a bang... I'm stuck as to why, can anyone see a reason? void randomwalk_bang(t_randomwalk *x) { t_float randval = rand() % 2; if(randval == 0) randval = -1; if(randval == 1) randval = 1; x->current += (x->step * randval); outlet_float(x->f_out, x->current); }
Thanks in advance,
-Greg
-- http://www.uwm.edu/~gssurges/ http://www.uwm.edu/%7Egssurges/ _______________________________________________ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
I spent 33 years and four months in active military service and during that period I spent most of my time as a high class muscle man for Big Business, for Wall Street and the bankers. - General Smedley Butler
On Sun, 16 Mar 2008, Greg Surges wrote:
The following code crashes Pd when the randomwalk object receives a bang... I'm stuck as to why, can anyone see a reason?
check that x->f_out is really set to a return value of outlet_new.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada