Skip to content

Commit

Permalink
clean up osc interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Marije Baalman committed Sep 12, 2013
1 parent 5eb06f0 commit 535597a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
4 changes: 2 additions & 2 deletions hidapi2osc/hidapi2osc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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 );
Expand Down
20 changes: 17 additions & 3 deletions hidapi2osc/supercollider/hidapi2osc-test.scd
Original file line number Diff line number Diff line change
@@ -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 );

Expand All @@ -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);

Expand Down

0 comments on commit 535597a

Please sign in to comment.