NSM: Clients must use the same protocol (UDP,TCP) as NSM server.
This commit is contained in:
parent
b2affcc5d5
commit
f769375a7a
|
@ -393,7 +393,7 @@ Mixer::init_osc ( const char *osc_port )
|
||||||
{
|
{
|
||||||
osc_endpoint = new OSC::Endpoint();
|
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;
|
return r;
|
||||||
|
|
||||||
osc_endpoint->owner = this;
|
osc_endpoint->owner = this;
|
||||||
|
|
|
@ -229,9 +229,9 @@ main ( int argc, char **argv )
|
||||||
|
|
||||||
if ( nsm_url )
|
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
|
// 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 );
|
Fl::add_timeout( NSM_CHECK_INTERVAL, check_nsm, NULL );
|
||||||
|
|
|
@ -60,11 +60,11 @@ namespace NSM
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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" );
|
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 )
|
if ( ! to )
|
||||||
{
|
{
|
||||||
|
@ -151,9 +151,15 @@ namespace NSM
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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 )
|
if ( ! _server )
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -169,9 +175,15 @@ namespace NSM
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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 );
|
_server = lo_server_thread_get_server( _st );
|
||||||
|
|
||||||
if ( ! _server || ! _st )
|
if ( ! _server || ! _st )
|
||||||
|
|
|
@ -29,6 +29,8 @@ namespace NSM
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
const char *nsm_url;
|
||||||
|
|
||||||
lo_server _server;
|
lo_server _server;
|
||||||
lo_server_thread _st;
|
lo_server_thread _st;
|
||||||
lo_address nsm_addr;
|
lo_address nsm_addr;
|
||||||
|
@ -64,14 +66,14 @@ namespace NSM
|
||||||
void is_clean ( void );
|
void is_clean ( void );
|
||||||
void progress ( float f );
|
void progress ( float f );
|
||||||
void message( int priority, const char *msg );
|
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 );
|
void broadcast ( lo_message msg );
|
||||||
|
|
||||||
/* init without threading */
|
/* init without threading */
|
||||||
int init ( void );
|
int init ( const char *nsm_url );
|
||||||
/* init with threading */
|
/* init with threading */
|
||||||
int init_thread ( void );
|
int init_thread ( const char *nsm_url );
|
||||||
|
|
||||||
/* call this periodically to check for new messages */
|
/* call this periodically to check for new messages */
|
||||||
void check ( int timeout = 0 );
|
void check ( int timeout = 0 );
|
||||||
|
|
|
@ -87,11 +87,11 @@ namespace OSC
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
Endpoint::init ( const char *port )
|
Endpoint::init ( int proto, const char *port )
|
||||||
{
|
{
|
||||||
DMESSAGE( "Creating OSC server" );
|
DMESSAGE( "Creating OSC server" );
|
||||||
|
|
||||||
_server = lo_server_new( port, error_handler );
|
_server = lo_server_new_with_proto( port, proto, error_handler );
|
||||||
|
|
||||||
if ( ! _server )
|
if ( ! _server )
|
||||||
{
|
{
|
||||||
|
|
|
@ -270,7 +270,7 @@ namespace OSC
|
||||||
|
|
||||||
void list_peers ( void (*callback) (const char *, const char *, int, void * ), void *v );
|
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 ( );
|
||||||
|
|
||||||
~Endpoint ( );
|
~Endpoint ( );
|
||||||
|
|
|
@ -1801,7 +1801,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
osc_server = new OSC::Endpoint();
|
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." );
|
FATAL( "Failed to create OSC server." );
|
||||||
}
|
}
|
||||||
|
|
|
@ -668,7 +668,7 @@ public:
|
||||||
{
|
{
|
||||||
osc = new OSC::Endpoint();
|
osc = new OSC::Endpoint();
|
||||||
|
|
||||||
if ( int r = osc->init() )
|
if ( int r = osc->init( LO_UDP ) )
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
osc->owner = this;
|
osc->owner = this;
|
||||||
|
|
|
@ -1571,7 +1571,7 @@ Timeline::init_osc ( const char *osc_port )
|
||||||
{
|
{
|
||||||
osc = new OSC::Endpoint();
|
osc = new OSC::Endpoint();
|
||||||
|
|
||||||
if ( int r = osc->init( osc_port ) )
|
if ( int r = osc->init( LO_UDP, osc_port ) )
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
osc->owner = this;
|
osc->owner = this;
|
||||||
|
|
|
@ -207,9 +207,9 @@ main ( int argc, char **argv )
|
||||||
|
|
||||||
if ( nsm_url )
|
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 */
|
/* 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 );
|
Fl::add_timeout( NSM_CHECK_INTERVAL, check_nsm, NULL );
|
||||||
|
|
Loading…
Reference in New Issue