From 535597ac84616c8d729aa0cfeb49798370272177 Mon Sep 17 00:00:00 2001 From: Marije Baalman Date: Thu, 12 Sep 2013 16:05:09 +0200 Subject: [PATCH] clean up osc interface --- hidapi2osc/hidapi2osc.cpp | 4 ++-- hidapi2osc/supercollider/hidapi2osc-test.scd | 20 +++++++++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/hidapi2osc/hidapi2osc.cpp b/hidapi2osc/hidapi2osc.cpp index ff129e6d..833b2323 100644 --- a/hidapi2osc/hidapi2osc.cpp +++ b/hidapi2osc/hidapi2osc.cpp @@ -166,7 +166,7 @@ int init_osc( char * ip, char *outport, char * port ){ lo_server_thread st = lo_server_thread_new(port, error); lo_server_thread_add_method(st, "/hid/open", "ii", hid_open_handler, NULL); - lo_server_thread_add_method(st, "/hid/elements/info", "i", hid_element_info_handler, NULL); + lo_server_thread_add_method(st, "/hid/element/info", "i", hid_element_info_handler, NULL); lo_server_thread_add_method(st, "/hid/info", "i", hid_info_handler, NULL); lo_server_thread_add_method(st, "/hid/close", "i", hid_close_handler, NULL); @@ -327,7 +327,7 @@ void send_elements_hid_info(int joy_idx) { hid_dev_desc * hid = hiddevices.find( joy_idx )->second; if ( hid == NULL ){ - lo_send_from( t, s, LO_TT_IMMEDIATE, "/hid/elements/info/error", "i", joy_idx ); + lo_send_from( t, s, LO_TT_IMMEDIATE, "/hid/element/info/error", "i", joy_idx ); return; } lo_bundle b = lo_bundle_new( LO_TT_IMMEDIATE ); diff --git a/hidapi2osc/supercollider/hidapi2osc-test.scd b/hidapi2osc/supercollider/hidapi2osc-test.scd index 7d2ebe97..d6a651d2 100644 --- a/hidapi2osc/supercollider/hidapi2osc-test.scd +++ b/hidapi2osc/supercollider/hidapi2osc-test.scd @@ -1,12 +1,26 @@ OSCFunc.trace( true ) OSCFunc.trace( false ) +OSCdef( \hidStarted, { |msg| msg.postln; }, '/hidapi2osc/started' ); +OSCdef( \hidQuit, { |msg| msg.postln; }, '/hidapi2osc/quit' ); + +OSCdef( \hidOpen, { |msg| msg.postln; }, '/hid/open' ); +OSCdef( \hidOpenError, { |msg| msg.postln; }, '/hid/open/error' ); +OSCdef( \hidClose, { |msg| msg.postln; }, '/hid/closed' ); +OSCdef( \hidCloseError, { |msg| msg.postln; }, '/hid/close/error' ); + +OSCdef( \hidNumber, { |msg| msg.postln; }, '/hid/number' ); OSCdef( \hidInfo, { |msg| msg.postln; }, '/hid/info' ); +OSCdef( \hidInfoError, { |msg| msg.postln; }, '/hid/info/error' ); + -OSCdef( \elementInfo, { |msg| msg.postln; }, '/hid/element/info' ); OSCdef( \elementNumber, { |msg| msg.postln; }, '/hid/element/number' ); +OSCdef( \elementInfo, { |msg| msg.postln; }, '/hid/element/info' ); +OSCdef( \elementInfoError, { |msg| msg.postln; }, '/hid/element/info/error' ); + -// OSCdef( \elementData, { |msg| msg.postln; }, '/hid/element/data' ); +OSCdef( \elementData, { |msg| msg.postln; }, '/hid/element/data' ); +OSCdef( \deviceData, { |msg| msg.postln; }, '/hid/device/data' ); n = NetAddr.new( "127.0.0.1", 57151 ); @@ -16,7 +30,7 @@ n.sendMsg( "/hid/open", 1103, 53251 ); n.sendMsg( "/hid/info", 0); -n.sendMsg( "/hid/elements/info", 0); +n.sendMsg( "/hid/element/info", 0); n.sendMsg( "/hid/close", 0);