From 2a156b8e765ee64fc5b01f78fa6f6974593053c6 Mon Sep 17 00:00:00 2001 From: Olaf Matthes Date: Thu, 21 Dec 2006 18:40:59 +0000 Subject: fixed the bug that made it crash in Max/MSP on OS X svn path=/trunk/externals/io/hidio/; revision=7044 --- hidio.c | 3 ++- hidio.h | 44 +++++++++++++++++++++++--------------------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/hidio.c b/hidio.c index f732d43..0ff2cce 100644 --- a/hidio.c +++ b/hidio.c @@ -429,6 +429,7 @@ static void hidio_open(t_hidio *x, t_symbol *s, int argc, t_atom *argv) t_int hidio_child_read(t_hidio *x) { // debug_print(LOG_DEBUG,"hidio_child_read"); + t_hid_element *current_element; unsigned int i; #ifdef PD double right_now = clock_getlogicaltime(); @@ -436,7 +437,6 @@ t_int hidio_child_read(t_hidio *x) double right_now; clock_getftime(&right_now); #endif /* PD */ - t_hid_element *current_element; if(right_now > last_execute_time[x->x_device_number]) { @@ -940,6 +940,7 @@ int main() ps_total = gensym("total"); ps_range = gensym("range"); + generate_type_symbols(); generate_event_symbols(); return 0; diff --git a/hidio.h b/hidio.h index ba8f843..2e1ce08 100644 --- a/hidio.h +++ b/hidio.h @@ -34,6 +34,8 @@ typedef double t_float; typedef double t_floatarg; typedef void t_outlet; typedef void t_clock; +#define getbytes(s) malloc(s) +#define freebytes(p, s) free(p) #define MAXPDSTRING 512 #define pd_error(x, b) error(b) #define SETSYMBOL SETSYM @@ -42,7 +44,7 @@ typedef void t_clock; #define HIDIO_MAJOR_VERSION 0 #define HIDIO_MINOR_VERSION 0 -/* static char *version = "$Revision: 1.10 $"; */ +/* static char *version = "$Revision: 1.11 $"; */ /*------------------------------------------------------------------------------ * MACRO DEFINES @@ -180,31 +182,31 @@ void hidio_output_event(t_hidio *x, t_hid_element *output_data); /* generic, cross-platform functions implemented in a separate file for each * platform */ -t_int hidio_open_device(t_hidio *x, short device_number); -t_int hidio_close_device(t_hidio *x); -void hidio_build_device_list(void); -void hidio_get_events(t_hidio *x); -void hidio_doprint(t_hidio* x); /* print info to the console */ -void hidio_platform_specific_info(t_hidio* x); /* device info on the status outlet */ -void hidio_platform_specific_free(t_hidio *x); -short get_device_number_by_id(unsigned short vendor_id, unsigned short product_id); +extern t_int hidio_open_device(t_hidio *x, short device_number); +extern t_int hidio_close_device(t_hidio *x); +extern void hidio_build_device_list(void); +extern void hidio_get_events(t_hidio *x); +extern void hidio_doprint(t_hidio* x); /* print info to the console */ +extern void hidio_platform_specific_info(t_hidio* x); /* device info on the status outlet */ +extern void hidio_platform_specific_free(t_hidio *x); +extern short get_device_number_by_id(unsigned short vendor_id, unsigned short product_id); /* TODO: this function should probably accept the single unsigned for the combined usage_page and usage, instead of two separate variables */ -short get_device_number_from_usage(short device_number, +extern short get_device_number_from_usage(short device_number, unsigned short usage_page, unsigned short usage); /* cross-platform force feedback functions */ -t_int hidio_ff_autocenter(t_hidio *x, t_float value); -t_int hidio_ff_gain(t_hidio *x, t_float value); -t_int hidio_ff_motors(t_hidio *x, t_float value); -t_int hidio_ff_continue(t_hidio *x); -t_int hidio_ff_pause(t_hidio *x); -t_int hidio_ff_reset(t_hidio *x); -t_int hidio_ff_stopall(t_hidio *x); +extern t_int hidio_ff_autocenter(t_hidio *x, t_float value); +extern t_int hidio_ff_gain(t_hidio *x, t_float value); +extern t_int hidio_ff_motors(t_hidio *x, t_float value); +extern t_int hidio_ff_continue(t_hidio *x); +extern t_int hidio_ff_pause(t_hidio *x); +extern t_int hidio_ff_reset(t_hidio *x); +extern t_int hidio_ff_stopall(t_hidio *x); // these are just for testing... -t_int hidio_ff_fftest (t_hidio *x, t_float value); -void hidio_ff_print(t_hidio *x); +extern t_int hidio_ff_fftest (t_hidio *x, t_float value); +extern void hidio_ff_print(t_hidio *x); /*============================================================================== * event symbols array sizes @@ -233,8 +235,8 @@ extern t_symbol *led_symbols[LED_ARRAY_MAX]; extern t_symbol *pid_symbols[PID_ARRAY_MAX]; extern t_symbol *relative_symbols[RELATIVE_ARRAY_MAX]; -void generate_event_symbols(); -void generate_type_symbols(); +extern void generate_event_symbols(); +extern void generate_type_symbols(); #endif /* NOT _HIDIO_H */ -- cgit v1.2.1