diff options
Diffstat (limited to 'pd/src/x_arithmetic.c')
-rw-r--r-- | pd/src/x_arithmetic.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/pd/src/x_arithmetic.c b/pd/src/x_arithmetic.c index f64c8cbd..0dd19937 100644 --- a/pd/src/x_arithmetic.c +++ b/pd/src/x_arithmetic.c @@ -623,7 +623,6 @@ static void log_float(t_object *x, t_float f) outlet_float(x->ob_outlet, r); } - static t_class *exp_class; /* ----------- exp --------------- */ static void *exp_new(void) @@ -659,6 +658,20 @@ static void abs_float(t_object *x, t_float f) outlet_float(x->ob_outlet, fabsf(f)); } +static t_class *wrap_class; /* ----------- wrap --------------- */ + +static void *wrap_new(void) +{ + t_object *x = (t_object *)pd_new(wrap_class); + outlet_new(x, &s_float); + return (x); +} + +static void wrap_float(t_object *x, t_float f) +{ + outlet_float(x->ob_outlet, f - floor(f)); +} + /* ------------------------ misc ------------------------ */ static t_class *clip_class; @@ -898,6 +911,11 @@ void x_arithmetic_setup(void) class_addfloat(abs_class, (t_method)abs_float); class_sethelpsymbol(abs_class, math_sym); + wrap_class = class_new(gensym("wrap"), wrap_new, 0, + sizeof(t_object), 0, 0); + class_addfloat(wrap_class, (t_method)wrap_float); + class_sethelpsymbol(wrap_class, math_sym); + /* ------------------------ misc ------------------------ */ clip_setup(); |