diff --git a/externals/lyonpotpourri/bashfest~.c b/externals/lyonpotpourri/bashfest~.c index c2eea11e389aab6d5e1dd960501fba0b274a961b..4069a79800dc785e2338c44c2b894ce547822bfa 100755 --- a/externals/lyonpotpourri/bashfest~.c +++ b/externals/lyonpotpourri/bashfest~.c @@ -273,6 +273,8 @@ void *bashfest_new(t_symbol *msg, short argc, t_atom *argv) /* argument list: buffer name, work buffer duration, latency in samples, number of overlaps */ atom_arg_getsym(&x->wavename,0,argc,argv); + /* We probably don't want to segfault when instantiating with no args, so */ + if (!x->wavename) x->wavename = &s_; atom_arg_getfloat(&x->work_buffer_size,1,argc,argv); tmpfloat = DEFAULT_LATENCY; atom_arg_getfloat(&tmpfloat,2,argc,argv); @@ -437,7 +439,7 @@ void bashfest_setbuf(t_bashfest *x, t_symbol *wavename) garray_usedindsp(a); x->b_valid = 1; } - + } @@ -1310,7 +1312,7 @@ void bashfest_dsp_free(t_bashfest *x) void bashfest_dsp(t_bashfest *x, t_signal **sp) { bashfest_setbuf(x, x->wavename); - + if( x->hosed ){ error("bashfest~ needs a valid buffer"); } diff --git a/externals/lyonpotpourri/buffet~.c b/externals/lyonpotpourri/buffet~.c index d11f2ca7b3dc8e42c1e48b81ee1baf53d85d040f..b29955d527a0d3b1d984ce7626b8ccb673061ece 100755 --- a/externals/lyonpotpourri/buffet~.c +++ b/externals/lyonpotpourri/buffet~.c @@ -1081,6 +1081,8 @@ void *buffet_new(t_symbol *msg, short argc, t_atom *argv) OBJECT_NAME); } atom_arg_getsym(&x->wavename,0,argc,argv); + /* Let's not crash just yet... */ + if (!x->wavename) x->wavename = &s_; atom_arg_getfloat(&x->minframes,1,argc,argv); atom_arg_getfloat(&x->maxframes,2,argc,argv); if(!x->minframes) diff --git a/externals/lyonpotpourri/magfreq_analysis~.c b/externals/lyonpotpourri/magfreq_analysis~.c index cf90a4d8aeb041c3c112e550285da7bce30c9a90..448f20d406598ffd4b02cdfe7081dbe0807cbd1b 100755 --- a/externals/lyonpotpourri/magfreq_analysis~.c +++ b/externals/lyonpotpourri/magfreq_analysis~.c @@ -291,9 +291,35 @@ void *magfreq_analysis_new(t_symbol *s, int argc, t_atom *argv) x->lofreq = atom_getfloatarg(0,argc,argv); x->hifreq = atom_getfloatarg(1,argc,argv); - x->overlap = atom_getfloatarg(2,argc,argv); + + x->overlap = (int)atom_getfloatarg(2,argc,argv); + /* Totally guessing that overlap should default to 1... */ + if (x->overlap <= 0) + { + x->overlap = 1; + pd_error(x, OBJECT_NAME + ": this object's default overlap of zero is incorrect. " + "Purr Data will change it to an overlap factor of 1 to " + "prevent DSP errors. " + "For compatibility with Pd Vanilla please set the " + "arguments manually so that the overlap (third argument) " + "is nonzero."); + } + x->winfac = atom_getfloatarg(3,argc,argv); - + /* Again-- just assuming the window factor shouldn't ever be zero + since that will cause negative indices in the perf routine... */ + if (x->winfac < 1) + { + x->winfac = 1; + pd_error(x, OBJECT_NAME + ": this object's default window factor of zero is " + "incorrect. Purr Data will change it to 1 to prevent " + "DSP errors. For compatibility with Pd Vanilla please " + "set the arguments manually so that the window factor " + "(fourth argument) is nonzero."); + } + if(x->lofreq <0 || x->lofreq> 22050) x->lofreq = 0; if(x->hifreq <50 || x->hifreq> 22050) @@ -343,7 +369,6 @@ t_int *magfreq_analysis_perform(t_int *w) float *channel = x->channel; in = on = x->inCount ; - if(x->mute){ for( j = 0; j < n; j++ ) { *magnitude_vec++ = 0; @@ -353,7 +378,6 @@ t_int *magfreq_analysis_perform(t_int *w) return w+7; } - if (x->bypass_state) { for( j = 0; j < n; j++ ) { *magnitude_vec++ = 0; @@ -371,6 +395,8 @@ t_int *magfreq_analysis_perform(t_int *w) for ( j = 0 ; j < (Nw - D) ; j++ ){ input[j] = input[j+D]; } + + /* Bug: this loop creates negative indices! */ for ( j = (Nw-D); j < Nw; j++) { input[j] = *inbuf++; } diff --git a/externals/lyonpotpourri/rotapan~.c b/externals/lyonpotpourri/rotapan~.c index 2c46a1e99bcc2a33032452aeaefecc80a164ffc6..8a9c92646c9c86489dfc6059fd93ddbfdcdf65d7 100755 --- a/externals/lyonpotpourri/rotapan~.c +++ b/externals/lyonpotpourri/rotapan~.c @@ -42,6 +42,25 @@ void *rotapan_new(t_symbol *s, int argc, t_atom *argv) t_rotapan *x = (t_rotapan *)pd_new(rotapan_class); x->rchans = (long) atom_getfloatarg(0,argc,argv); + + /* The rotapan_perform routine does a modulo computation with + x->rchans value as the right operand. Thus, the value cannot + be zero. + + Here, we set rchans to 1 to keep from hitting the issue when + no arguments are given. + + However, we want to encourage the user to actually set the argument + in order to remain compatible with lyonpotpourri in Pd Vanilla. + So we send an error here, too. + */ + if (x->rchans < 1) + { + x->rchans = 1; + pd_error(x, "need an argument to specify the number of channels. " + "Defaulting to 1."); + } + /* allocate in chans plus 1 for controlling the pan */ for(i = 0; i < x->rchans; i++){ inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("signal"),gensym("signal"));