diff options
author | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2012-02-20 18:43:11 +0000 |
---|---|---|
committer | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2012-02-20 18:43:11 +0000 |
commit | e38be5cb6d9dd1af40063a7d3c617621dbe0c83f (patch) | |
tree | a8d85ede12e9b1b21c0d42f17943a160793beefd /externals | |
parent | 02a3b685d9b997789412d454d1f4eb942d918709 (diff) |
sync with x_time.c from pure-data.git 0.43-1
svn path=/trunk/; revision=16008
Diffstat (limited to 'externals')
-rw-r--r-- | externals/vanilla/line.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/externals/vanilla/line.c b/externals/vanilla/line.c index 5591cee3..a3521ecb 100644 --- a/externals/vanilla/line.c +++ b/externals/vanilla/line.c @@ -7,6 +7,7 @@ #include "m_pd.h" #include <stdio.h> +#define DEFAULTLINEGRAIN 20 static t_class *line_class; typedef struct _line @@ -36,6 +37,8 @@ static void line_tick(t_line *x) outlet_float(x->x_obj.ob_outlet, x->x_setval + x->x_1overtimediff * (timenow - x->x_prevtime) * (x->x_targetval - x->x_setval)); + if (x->x_grain <= 0) + x->x_grain = DEFAULTLINEGRAIN; clock_delay(x->x_clock, (x->x_grain > msectogo ? msectogo : x->x_grain)); } @@ -56,6 +59,8 @@ static void line_float(t_line *x, t_float f) line_tick(x); x->x_gotinlet = 0; x->x_1overtimediff = 1./ (x->x_targettime - timenow); + if (x->x_grain <= 0) + x->x_grain = DEFAULTLINEGRAIN; clock_delay(x->x_clock, (x->x_grain > x->x_in1val ? x->x_in1val : x->x_grain)); @@ -100,10 +105,10 @@ static void *line_new(t_floatarg f, t_floatarg grain) x->x_1overtimediff = 1; x->x_clock = clock_new(x, (t_method)line_tick); x->x_targettime = x->x_prevtime = clock_getsystime(); - if (grain <= 0) grain = 20; x->x_grain = grain; outlet_new(&x->x_obj, gensym("float")); inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("ft1")); + floatinlet_new(&x->x_obj, &x->x_grain); return (x); } |