Update of /cvsroot/pure-data/externals/hardware/multio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27235
Modified Files: multio.c Log Message: added a verbose-flag (default: 0==quiet) to stop writing uninteresting things to the console (like which bit is set when using digi_out)
Index: multio.c =================================================================== RCS file: /cvsroot/pure-data/externals/hardware/multio/multio.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** multio.c 17 Mar 2006 02:41:47 -0000 1.2 --- multio.c 28 Mar 2006 19:47:21 -0000 1.3 *************** *** 51,54 **** --- 51,55 ---- char digi_outs[8]; // buffer of digital input, is a byte, 8 values at a time int analog_buffer[64]; // buffered analog outs + int x_verbose; t_outlet *a_out, *d_out, *s_out; // outlets } t_multio; *************** *** 81,85 **** x->double_buffer[mybuf][x->buf_count[mybuf]++] = buffer[cnt]; } ! // post("thread read %i bytes to buffer %i (now %i bytes)",bytesread, mybuf,x->buf_count[mybuf] ); } } --- 82,86 ---- x->double_buffer[mybuf][x->buf_count[mybuf]++] = buffer[cnt]; } ! // if(x->x_verbose)post("thread read %i bytes to buffer %i (now %i bytes)",bytesread, mybuf,x->buf_count[mybuf] ); } } *************** *** 96,115 **** if(pthread_attr_init(&x->multio_thread_attr) < 0) { ! post("multio: could not launch receive thread"); return; } if(pthread_attr_setdetachstate(&x->multio_thread_attr, PTHREAD_CREATE_DETACHED) < 0) { ! post("multio: could not launch receive thread"); return; } if(pthread_create(&x->x_threadid, &x->multio_thread_attr, usb_read_thread, x) < 0) { ! post("multio: could not launch receive thread"); return; } else { ! post("multio: thread %d launched", (int)x->x_threadid ); } } --- 97,116 ---- if(pthread_attr_init(&x->multio_thread_attr) < 0) { ! error("multio: could not launch receive thread"); return; } if(pthread_attr_setdetachstate(&x->multio_thread_attr, PTHREAD_CREATE_DETACHED) < 0) { ! error("multio: could not launch receive thread"); return; } if(pthread_create(&x->x_threadid, &x->multio_thread_attr, usb_read_thread, x) < 0) { ! error("multio: could not launch receive thread"); return; } else { ! if(x->x_verbose)post("multio: thread %d launched", (int)x->x_threadid ); } } *************** *** 140,144 **** if(channel < 0 || channel > 63) { ! error("multio: inconsistent dac output channel"); return; } --- 141,145 ---- if(channel < 0 || channel > 63) { ! error("multio: inconsistent dac output channel: %d", channel); return; } *************** *** 178,182 **** if(channel < 0 || channel > 63) { ! error("multio: inconsistent digital output channel"); return; } --- 179,183 ---- if(channel < 0 || channel > 63) { ! error("multio: inconsistent digital output channel: %d", channel); return; } *************** *** 195,199 **** buffer[1] = ctmp; bytesread = usb_interrupt_write(x->d, 1, buffer, 3, TIMEOUT); ! post("multio: writing %i to group %i", ctmp, group); }
--- 196,200 ---- buffer[1] = ctmp; bytesread = usb_interrupt_write(x->d, 1, buffer, 3, TIMEOUT); ! if(x->x_verbose)post("multio: writing %i to group %i", ctmp, group); }
*************** *** 328,332 **** } else { ! post("error, connection not inizialized"); return; } --- 329,333 ---- } else { ! error("multIO: connection not inizialized"); return; } *************** *** 487,491 **** } // if i am here then i couldn't find mutlIO! ! post("multio: unable to find multI/O !"); }
--- 488,492 ---- } // if i am here then i couldn't find mutlIO! ! error("multio: unable to find multI/O !"); }
*************** *** 523,526 **** --- 524,531 ---- x->x_deltime = g; } + static void multio_verbose(t_multio *x, t_floatarg g) + { + x->x_verbose=(g > 0) ; + }
*************** *** 529,545 **** { if(is_open) ! { clock_free(x->x_clock); if(x->d) { while(pthread_cancel(x->x_threadid) < 0) ! post("multio: killing thread\n"); ! post("multio: thread canceled\n"); usb_close(x->d); } is_open = 0; ! } ! else ! post("multio: not active object"); }
--- 534,550 ---- { if(is_open) ! { clock_free(x->x_clock); if(x->d) { while(pthread_cancel(x->x_threadid) < 0) ! if(x->x_verbose)post("multio: killing thread\n"); ! if(x->x_verbose)post("multio: thread canceled\n"); usb_close(x->d); } is_open = 0; ! } ! else ! if(x->x_verbose)post("multio: not active object"); }
*************** *** 552,555 **** --- 557,561 ---- x->x_clock = clock_new(x, (t_method)multio_tick); x->x_deltime = DEFDELTIME; + x->x_verbose = 0; x->a_out = outlet_new(&x->x_obj, &s_list); x->d_out = outlet_new(&x->x_obj, &s_list); *************** *** 569,573 **** else { ! post("multio: object already exists"); return(0); } --- 575,579 ---- else { ! error("multio: object already exists"); return(0); } *************** *** 596,599 **** --- 602,608 ---- A_GIMME, 0); is_open = 0; + + class_addmethod(multio_class, (t_method)multio_verbose, gensym("verbose"), A_FLOAT, 0); + // welcome message post("\nmultio: a pd driver for the multI/O USB device");