-Debugging NSM support

main
Harry van Haaren 2013-11-02 13:41:26 +00:00
parent f2345c8c02
commit ff1e57449c
3 changed files with 26 additions and 6 deletions

View File

@ -228,6 +228,14 @@ static int cb_nsm_open (const char *name,
LUPPP_NOTE("%s %s","Loading session ", out_msg[0] );
//gui->getDiskReader()->readSession( fnfc.filename() );
//OSC_REPLY( "OK" );
//OSC_REPLY_P( "/nsm/client/open", "OK" );
nsm_client_t* nsm = gui->getNsm();
//lo_send_from( nsm_addr, losrv, LO_TT_IMMEDIATE, "/reply", "ss", path, "OK" );
//lo_send_from( _NSM()->nsm_addr, _NSM()->_server, LO_TT_IMMEDIATE, "/reply", "ss", "/nsm/client/open", "OK" );
return ERR_OK;
}
@ -241,7 +249,7 @@ static int cb_nsm_save ( char **out_msg, void *userdata )
EventStateSave e;
//writeToDspRingbuffer( &e );
return ERR_OK;
return 0;
}
@ -341,8 +349,6 @@ Gui::Gui() :
// NSM stuff
nsm = 0;
const char *nsm_url = getenv( "NSM_URL" );
if ( nsm_url )
{
nsm = nsm_new();
@ -353,6 +359,7 @@ Gui::Gui() :
if ( nsm_init( nsm, nsm_url ) == 0 )
{
nsm_send_announce( nsm, "Luppp", "", "luppp" );
LUPPP_WARN("Announcing to NSM");
}
else
{
@ -360,6 +367,10 @@ Gui::Gui() :
nsm = 0;
}
}
else
{
LUPPP_WARN("No NSM_URL env variable");
}
}
void Gui::reset()

View File

@ -61,6 +61,8 @@ class Gui
int samplerate;
nsm_client_t* getNsm(){return nsm;}
private:
Fl_Double_Window window;

View File

@ -309,7 +309,6 @@ nsm_set_save_callback( nsm_client_t *nsm, nsm_save_callback *save_callback, void
{
_NSM()->save = save_callback;
_NSM()->save_userdata = userdata;
}
NSM_EXPORT
@ -337,7 +336,7 @@ nsm_set_broadcast_callback( nsm_client_t *nsm, nsm_broadcast_callback *broadcast
_NSM()->broadcast_userdata = userdata;
}
/****************/
/* OSC HANDLERS */
@ -347,6 +346,7 @@ nsm_set_broadcast_callback( nsm_client_t *nsm, nsm_broadcast_callback *broadcast
#undef OSC_REPLY_ERR
#define OSC_REPLY( value ) lo_send_from( ((struct _nsm_client_t*)user_data)->nsm_addr, ((struct _nsm_client_t*)user_data)->_server, LO_TT_IMMEDIATE, "/reply", "ss", path, value )
#define OSC_REPLY_P( path, value ) lo_send_from( ((struct _nsm_client_t*)user_data)->nsm_addr, ((struct _nsm_client_t*)user_data)->_server, LO_TT_IMMEDIATE, "/reply", "ss", path, value )
#define OSC_REPLY_ERR( errcode, value ) lo_send_from( ((struct _nsm_client_t*)user_data)->nsm_addr, ((struct _nsm_client_t*)user_data)->_server, LO_TT_IMMEDIATE, "/error", "sis", path, errcode, value )
@ -385,6 +385,8 @@ NSM_EXPORT int _nsm_osc_save ( const char *path, const char *types, lo_arg **arg
(void) argv;
(void) argc;
(void) msg;
printf("NSM SAVE()\n");
char *out_msg = NULL;
@ -396,10 +398,15 @@ NSM_EXPORT int _nsm_osc_save ( const char *path, const char *types, lo_arg **arg
int r = nsm->save(&out_msg, nsm->save_userdata );
if ( r )
{
printf("SEnding save ERROR\n");
OSC_REPLY_ERR( r, ( out_msg ? out_msg : "") );
}
else
{
printf("SEnding save OK\n");
OSC_REPLY( "OK" );
}
if ( out_msg )
free( out_msg );