From 9c0e19a3be2288db79e2502e5fa450c3e20a668d Mon Sep 17 00:00:00 2001 From: Guenter Geiger Date: Fri, 9 May 2003 16:04:00 +0000 Subject: This commit was generated by cvs2svn to compensate for changes in r610, which included commits to RCS files with non-trunk default branches. svn path=/trunk/; revision=611 --- pd/doc/6.externs/obj3.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 pd/doc/6.externs/obj3.c (limited to 'pd/doc/6.externs/obj3.c') diff --git a/pd/doc/6.externs/obj3.c b/pd/doc/6.externs/obj3.c new file mode 100644 index 00000000..434fbb95 --- /dev/null +++ b/pd/doc/6.externs/obj3.c @@ -0,0 +1,39 @@ +/* code for the "obj3" pd class. This adds an outlet and a state variable. */ + +#include "m_pd.h" + +typedef struct obj3 +{ + t_object x_ob; + t_outlet *x_outlet; + float x_value; +} t_obj3; + +void obj3_float(t_obj3 *x, t_floatarg f) +{ + outlet_float(x->x_outlet, f + x->x_value); +} + +void obj3_ft1(t_obj3 *x, t_floatarg g) +{ + x->x_value = g; +} + +t_class *obj3_class; + +void *obj3_new(void) +{ + t_obj3 *x = (t_obj3 *)pd_new(obj3_class); + inlet_new(&x->x_ob, &x->x_ob.ob_pd, gensym("float"), gensym("ft1")); + x->x_outlet = outlet_new(&x->x_ob, gensym("float")); + return (void *)x; +} + +void obj3_setup(void) +{ + obj3_class = class_new(gensym("obj3"), (t_newmethod)obj3_new, + 0, sizeof(t_obj3), 0, 0); + class_addmethod(obj3_class, (t_method)obj3_ft1, gensym("ft1"), A_FLOAT, 0); + class_addfloat(obj3_class, obj3_float); +} + -- cgit v1.2.1