From bc1c46df72fcf6c1592a4b1210a083c97611aec1 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 20 Sep 2012 21:05:14 +0000 Subject: also fix the 'fl1' method for setting the max number of floats to average svn path=/trunk/externals/markex/; revision=16259 --- average.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/average.c b/average.c index dc7711b..62d4580 100644 --- a/average.c +++ b/average.c @@ -41,9 +41,15 @@ void average_float(t_average *x, t_floatarg n) average_bang(x); } -void average_total(t_average *x, t_floatarg n) +void average_total(t_average *x, t_float f) { - x->a_total = (int)n; + if (f) x->a_total = (int)f; + else x->a_total = 10; + if (x->a_total > MAX_NUMBERS) { + logpost(x, 2, "[average]: argument set max numbers greater than %i, setting to %i", + MAX_NUMBERS, MAX_NUMBERS); + x->a_total = MAX_NUMBERS; + } } void average_reset(t_average *x, t_floatarg newVal) @@ -64,13 +70,7 @@ void *average_new(t_floatarg f) /* init vals in struc */ x->t_out1 = outlet_new(&x->x_obj, 0); inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl1")); average_clear(x); - if (f) x->a_total = (int)f; - else x->a_total = 10; - if (x->a_total > MAX_NUMBERS) { - logpost(x, 2, "[average]: argument set max numbers greater than %i, setting to %i", - MAX_NUMBERS, MAX_NUMBERS); - x->a_total = MAX_NUMBERS; - } + average_total(x, f); x->a_whichNum = 0; return (x); } -- cgit v1.2.1