From f9740cad349961fac05e38338900b81f4d5ddd86 Mon Sep 17 00:00:00 2001 From: Ed Kelly Date: Sun, 10 May 2009 14:42:56 +0000 Subject: Changed behaviour for weightonset svn path=/trunk/externals/ekext/; revision=11313 --- weightonset/weightonset.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'weightonset/weightonset.c') diff --git a/weightonset/weightonset.c b/weightonset/weightonset.c index 0117b84..44265a2 100644 --- a/weightonset/weightonset.c +++ b/weightonset/weightonset.c @@ -25,11 +25,15 @@ void weightonset_float (t_weightonset *x, t_floatarg fin) SETFLOAT(&x->x_datachunk.data[len], fin); if(x->length < x->attack) { - x->increment = 1 / (x->attack + 1); - x->accumulator += fin*(x->length + 1)*x->increment; -// x->increment*len substitutes for the divider -// during the attack phase - x->divaccum += x->increment*(x->length + 1); + int i; + float weight = 1; + x->increment = x->length - x->attack; + for(i=0;iincrement;i++) + { + weight = weight*x->multiplier; + } + x->accumulator += fin*weight; + x->divaccum += weight; x->weighted = x->accumulator / x->divaccum; outlet_float(x->waverage, x->weighted); } -- cgit v1.2.1