aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2012-09-20 21:05:14 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2012-09-20 21:05:14 +0000
commitbc1c46df72fcf6c1592a4b1210a083c97611aec1 (patch)
tree483601b666ba3274ef1f8422349e205b05b1ea94
parent9b8ab99648518dc38fce2b85658a6217aa886bb0 (diff)
also fix the 'fl1' method for setting the max number of floats to average
svn path=/trunk/externals/markex/; revision=16259
-rw-r--r--average.c18
1 files 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);
}