Browse Source

NSM: Clients must use the same protocol (UDP,TCP) as NSM server.

tags/non-daw-v1.1.0
Jonathan Moore Liles 13 years ago
parent
commit
f769375a7a
10 changed files with 34 additions and 20 deletions
  1. +1
    -1
      mixer/src/Mixer.C
  2. +2
    -2
      mixer/src/main.C
  3. +18
    -6
      nonlib/NSM/Client.C
  4. +5
    -3
      nonlib/NSM/Client.H
  5. +2
    -2
      nonlib/OSC/Endpoint.C
  6. +1
    -1
      nonlib/OSC/Endpoint.H
  7. +1
    -1
      session/src/nsmd.C
  8. +1
    -1
      session/src/session-manager.C
  9. +1
    -1
      timeline/src/Timeline.C
  10. +2
    -2
      timeline/src/main.C

+ 1
- 1
mixer/src/Mixer.C View File

@@ -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;


+ 2
- 2
mixer/src/main.C View File

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


+ 18
- 6
nonlib/NSM/Client.C View File

@@ -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 )


+ 5
- 3
nonlib/NSM/Client.H View File

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


+ 2
- 2
nonlib/OSC/Endpoint.C View File

@@ -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 )
{


+ 1
- 1
nonlib/OSC/Endpoint.H View File

@@ -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 ( );


+ 1
- 1
session/src/nsmd.C View File

@@ -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." );
}


+ 1
- 1
session/src/session-manager.C View File

@@ -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;


+ 1
- 1
timeline/src/Timeline.C View File

@@ -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;


+ 2
- 2
timeline/src/main.C View File

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


Loading…
Cancel
Save