diff --git a/pd/src/d_soundfile.c b/pd/src/d_soundfile.c index 285720ea94cdc4d1cef3fca90a3514bbec1ccef5..f3d65ebb1f48a09f070fce2811000e9a640b9140 100644 --- a/pd/src/d_soundfile.c +++ b/pd/src/d_soundfile.c @@ -1283,7 +1283,7 @@ static void soundfiler_read(t_soundfiler *x, t_symbol *s, { int vecsize; - garray_resize(garrays[i], finalsize); + garray_resize_long(garrays[i], finalsize); /* for sanity's sake let's clear the save-in-patch flag here */ garray_setsaveit(garrays[i], 0); garray_getfloatwords(garrays[i], &vecsize, diff --git a/pd/src/g_array.c b/pd/src/g_array.c index 91fb0e902de418a0bfb68ac04bc55f77e0941b45..ab50218e6a9a7d228f05272f137c1c390e20338f 100644 --- a/pd/src/g_array.c +++ b/pd/src/g_array.c @@ -698,7 +698,7 @@ void garray_arraydialog(t_garray *x, t_symbol *s, int argc, t_atom *argv) template_findbyname(x->x_scalar->sc_template), gensym("style"), x->x_scalar->sc_vec, 1);*/ - int size; + long size; t_symbol *argname = sharptodollar(name); t_array *a = garray_getarray(x); t_template *scalartemplate; @@ -757,7 +757,7 @@ void garray_arraydialog(t_garray *x, t_symbol *s, int argc, t_atom *argv) x->x_style = style; if (size != a->a_n) { - garray_resize(x, size); + garray_resize_long(x, size); } else { @@ -1680,7 +1680,7 @@ static void garray_const(t_garray *x, t_floatarg g) } /* sum of Fourier components; called from routines below */ -static void garray_dofo(t_garray *x, int npoints, t_float dcval, +static void garray_dofo(t_garray *x, long npoints, t_float dcval, int nsin, t_float *vsin, int sineflag) { double phase, phaseincr, fj; @@ -1696,7 +1696,7 @@ static void garray_dofo(t_garray *x, int npoints, t_float dcval, if (npoints != (1 << ilog2(npoints))) post("%s: rounding to %d points", array->a_templatesym->s_name, (npoints = (1<<ilog2(npoints)))); - garray_resize(x, npoints + 3); + garray_resize_long(x, npoints + 3); phaseincr = 2. * 3.14159 / npoints; for (i = 0, phase = -phaseincr; i < array->a_n; i++, phase += phaseincr) { @@ -1716,7 +1716,8 @@ static void garray_dofo(t_garray *x, int npoints, t_float dcval, static void garray_sinesum(t_garray *x, t_symbol *s, int argc, t_atom *argv) { t_float *svec; - int npoints, i; + long npoints; + int i; if (argc < 2) { error("sinesum: %s: need number of points and partial strengths", @@ -1739,7 +1740,8 @@ static void garray_sinesum(t_garray *x, t_symbol *s, int argc, t_atom *argv) static void garray_cosinesum(t_garray *x, t_symbol *s, int argc, t_atom *argv) { t_float *svec; - int npoints, i; + long npoints; + int i; if (argc < 2) { error("sinesum: %s: need number of points and partial strengths", @@ -1956,10 +1958,11 @@ int garray_ambigendian(void) return (c==0); } -void garray_resize(t_garray *x, t_floatarg f) +void garray_resize_long(t_garray *x, long n) { t_array *array = garray_getarray(x); - int n = (f < 1 ? 1 : f); + if (n < 1) + n = 1; //fprintf(stderr,"garray_resize %d\n", n); array_resize(array, n); garray_fittograph(x, n, 1);/*template_getfloat( @@ -1970,6 +1973,12 @@ void garray_resize(t_garray *x, t_floatarg f) canvas_update_dsp(); } + /* float version to use as Pd method */ +void garray_resize(t_garray *x, t_floatarg f) +{ + garray_resize_long(x, f); +} + static void garray_print(t_garray *x) { t_array *array = garray_getarray(x); diff --git a/pd/src/m_pd.h b/pd/src/m_pd.h index cf3a09982cd14a484daec87311b95065794c940d..36f19c65e255f728a66c93da6f91c522dddf2e8c 100644 --- a/pd/src/m_pd.h +++ b/pd/src/m_pd.h @@ -673,7 +673,8 @@ EXTERN t_float garray_get(t_garray *x, t_symbol *s, t_int indx); EXTERN void garray_redraw(t_garray *x); EXTERN int garray_npoints(t_garray *x); EXTERN char *garray_vec(t_garray *x); -EXTERN void garray_resize(t_garray *x, t_floatarg f); +EXTERN void garray_resize(t_garray *x, t_floatarg f); /* avoid; use this: */ +EXTERN void garray_resize_long(t_garray *x, long n); /* better version */ EXTERN void garray_usedindsp(t_garray *x); EXTERN void garray_setsaveit(t_garray *x, int saveit); EXTERN t_glist *garray_getglist(t_garray *x);