2 #include <unistd.h> //sleep()
3 #include <stdio.h> //printf()
5 static t_class
*counter_class
;
7 typedef struct _counter
{
15 void counter_bang(t_counter
*x
)
19 t_float g
=x
->i_count
*2;
20 outlet_float(x
->x_obj
.ob_outlet
, f
);
21 outlet_float(x
->x_out2
, g
);
24 void counter_reset(t_counter
*x
)
26 t_float f
= x
->i_count
= 0;
27 outlet_float(x
->x_obj
.ob_outlet
, f
);
30 void *counter_new(t_floatarg f
)
32 t_counter
*x
= (t_counter
*)pd_new(counter_class
);
35 outlet_new(&x
->x_obj
, &s_float
);
36 x
->x_out2
= outlet_new(&x
->x_obj
, &s_float
);
37 x
->x_out3
= outlet_new(&x
->x_obj
, &s_list
);
38 inlet_new(&x
->x_obj
, &x
->x_obj
.ob_pd
, gensym("lol"), gensym("reset"));
39 floatinlet_new(&x
->x_obj
, &x
->step
);
43 void counter_setup(void) {
44 counter_class
= class_new(gensym("counter"),
45 (t_newmethod
)counter_new
,
50 class_addbang(counter_class
, counter_bang
);
51 class_addmethod(counter_class
, (t_method
)counter_reset
, gensym("reset"), 0);
This page took 0.458939 seconds and 4 git commands to generate.