diff --git a/mixer/src/Mixer.C b/mixer/src/Mixer.C index df7b498..d2a1033 100644 --- a/mixer/src/Mixer.C +++ b/mixer/src/Mixer.C @@ -393,7 +393,7 @@ Mixer::init_osc ( const char *osc_port ) { osc_endpoint = new OSC::Endpoint(); - if ( int r = osc_endpoint->init( osc_port ) ) + if ( int r = osc_endpoint->init( LO_UDP, osc_port ) ) return r; osc_endpoint->owner = this; diff --git a/mixer/src/main.C b/mixer/src/main.C index 7c65ce4..7757853 100644 --- a/mixer/src/main.C +++ b/mixer/src/main.C @@ -229,9 +229,9 @@ main ( int argc, char **argv ) if ( nsm_url ) { - if ( ! nsm->init() ) + if ( ! nsm->init( nsm_url ) ) { - nsm->announce( nsm_url, APP_NAME, ":switch:dirty:", argv[0] ); + nsm->announce( APP_NAME, ":switch:dirty:", argv[0] ); // poll so we can keep OSC handlers running in the GUI thread and avoid extra sync Fl::add_timeout( NSM_CHECK_INTERVAL, check_nsm, NULL ); diff --git a/nonlib/NSM/Client.C b/nonlib/NSM/Client.C index 350e628..e07eba1 100644 --- a/nonlib/NSM/Client.C +++ b/nonlib/NSM/Client.C @@ -60,11 +60,11 @@ namespace NSM } void - Client::announce ( const char *nash_url, const char *application_name, const char *capabilities, const char *process_name ) + Client::announce ( const char *application_name, const char *capabilities, const char *process_name ) { MESSAGE( "Announcing to NSM" ); - lo_address to = lo_address_new_from_url( nash_url ); + lo_address to = lo_address_new_from_url( nsm_url ); if ( ! to ) { @@ -151,9 +151,15 @@ namespace NSM } int - Client::init ( ) + Client::init ( const char *nsm_url ) { - _server = lo_server_new( NULL, NULL ); + this->nsm_url = nsm_url; + + lo_address addr = lo_address_new_from_url( nsm_url ); + int proto = lo_address_get_protocol( addr ); + lo_address_free( addr ); + + _server = lo_server_new_with_proto( NULL, proto, NULL ); if ( ! _server ) return -1; @@ -169,9 +175,15 @@ namespace NSM } int - Client::init_thread ( ) + Client::init_thread ( const char *nsm_url ) { - _st = lo_server_thread_new( NULL, NULL ); + this->nsm_url = nsm_url; + + lo_address addr = lo_address_new_from_url( nsm_url ); + int proto = lo_address_get_protocol( addr ); + lo_address_free( addr ); + + _st = lo_server_thread_new_with_proto( NULL, proto, NULL ); _server = lo_server_thread_get_server( _st ); if ( ! _server || ! _st ) diff --git a/nonlib/NSM/Client.H b/nonlib/NSM/Client.H index 7e211c5..92bbfe7 100644 --- a/nonlib/NSM/Client.H +++ b/nonlib/NSM/Client.H @@ -29,6 +29,8 @@ namespace NSM private: + const char *nsm_url; + lo_server _server; lo_server_thread _st; lo_address nsm_addr; @@ -64,14 +66,14 @@ namespace NSM void is_clean ( void ); void progress ( float f ); void message( int priority, const char *msg ); - void announce ( const char *nsm_url, const char *appliction_name, const char *capabilities, const char *process_name ); + void announce ( const char *appliction_name, const char *capabilities, const char *process_name ); void broadcast ( lo_message msg ); /* init without threading */ - int init ( void ); + int init ( const char *nsm_url ); /* init with threading */ - int init_thread ( void ); + int init_thread ( const char *nsm_url ); /* call this periodically to check for new messages */ void check ( int timeout = 0 ); diff --git a/nonlib/OSC/Endpoint.C b/nonlib/OSC/Endpoint.C index 1bfdfe7..6d49e22 100644 --- a/nonlib/OSC/Endpoint.C +++ b/nonlib/OSC/Endpoint.C @@ -87,11 +87,11 @@ namespace OSC } int - Endpoint::init ( const char *port ) + Endpoint::init ( int proto, const char *port ) { DMESSAGE( "Creating OSC server" ); - _server = lo_server_new( port, error_handler ); + _server = lo_server_new_with_proto( port, proto, error_handler ); if ( ! _server ) { diff --git a/nonlib/OSC/Endpoint.H b/nonlib/OSC/Endpoint.H index 42a10b9..3881158 100644 --- a/nonlib/OSC/Endpoint.H +++ b/nonlib/OSC/Endpoint.H @@ -270,7 +270,7 @@ namespace OSC void list_peers ( void (*callback) (const char *, const char *, int, void * ), void *v ); - int init ( const char *port = 0 ); + int init ( int proto, const char *port = 0 ); Endpoint ( ); ~Endpoint ( ); diff --git a/session/src/nsmd.C b/session/src/nsmd.C index 8870bda..2cd35e8 100644 --- a/session/src/nsmd.C +++ b/session/src/nsmd.C @@ -1801,7 +1801,7 @@ int main(int argc, char *argv[]) osc_server = new OSC::Endpoint(); - if ( osc_server->init( osc_port ) ) + if ( osc_server->init( LO_UDP, osc_port ) ) { FATAL( "Failed to create OSC server." ); } diff --git a/session/src/session-manager.C b/session/src/session-manager.C index f006ab4..04834d1 100644 --- a/session/src/session-manager.C +++ b/session/src/session-manager.C @@ -668,7 +668,7 @@ public: { osc = new OSC::Endpoint(); - if ( int r = osc->init() ) + if ( int r = osc->init( LO_UDP ) ) return r; osc->owner = this; diff --git a/timeline/src/Timeline.C b/timeline/src/Timeline.C index 11c5ae4..87da2d0 100644 --- a/timeline/src/Timeline.C +++ b/timeline/src/Timeline.C @@ -1571,7 +1571,7 @@ Timeline::init_osc ( const char *osc_port ) { osc = new OSC::Endpoint(); - if ( int r = osc->init( osc_port ) ) + if ( int r = osc->init( LO_UDP, osc_port ) ) return r; osc->owner = this; diff --git a/timeline/src/main.C b/timeline/src/main.C index 18a9780..455f36c 100644 --- a/timeline/src/main.C +++ b/timeline/src/main.C @@ -207,9 +207,9 @@ main ( int argc, char **argv ) if ( nsm_url ) { - if ( ! nsm->init() ); + if ( ! nsm->init( nsm_url ) ); { - nsm->announce( nsm_url, APP_NAME, ":progress:switch:", argv[0] ); + nsm->announce( APP_NAME, ":progress:switch:", argv[0] ); /* poll so we can keep OSC handlers running in the GUI thread and avoid extra sync */ Fl::add_timeout( NSM_CHECK_INTERVAL, check_nsm, NULL );