From 0060c5e3213b60801346e9aadb2cb1523c7762b2 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 6 Jun 2005 22:39:51 +0000 Subject: - cleaned up CFLAGS and tried higher optimization, which failed to build - implemented a second outlet which outputs data upon [refresh( to build a popup menu to select the device by name using a [popup]. This uncovered a bug, which is not fixed, it seems that everytime you open a device, that device gets added again to the list of devices svn path=/trunk/externals/hcs/hid/; revision=3122 --- hid.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'hid.c') diff --git a/hid.c b/hid.c index 2b69f05..2509d7b 100644 --- a/hid.c +++ b/hid.c @@ -50,13 +50,13 @@ static void hid_float(t_hid* x, t_floatarg f); void hid_output_event(t_hid *x, char *type, char *code, t_float value) { - t_atom event_data[4]; + t_atom event_data[3]; SETSYMBOL(event_data, gensym(type)); /* type */ SETSYMBOL(event_data + 1, gensym(code)); /* code */ SETFLOAT(event_data + 2, value); /* value */ - outlet_anything(x->x_obj.te_outlet,atom_gensym(event_data),2,event_data+1); + outlet_anything(x->x_data_outlet,atom_gensym(event_data),2,event_data+1); } void hid_set_from_float(t_hid *x, t_floatarg f) @@ -115,10 +115,14 @@ t_int hid_close(t_hid *x) } -/* closed / same device open */ -/* open / same device no action */ -/* closed / different device open */ -/* open / different device close open */ +/* hid_open behavoir + * current state action + * --------------------------------------- + * closed / same device open + * open / same device no action + * closed / different device open + * open / different device close open + */ t_int hid_open(t_hid *x, t_float f) { @@ -241,8 +245,9 @@ static void *hid_new(t_float f) x->x_clock = clock_new(x, (t_method)hid_read); /* create anything outlet used for HID data */ - outlet_new(&x->x_obj, 0); - + x->x_data_outlet = outlet_new(&x->x_obj, 0); + x->x_device_name_outlet = outlet_new(&x->x_obj, 0); + /* find and report the list of devices */ hid_build_device_list(x); -- cgit v1.2.1