aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--externals/vanilla/line.c7
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);
}