-Fixed NSM bug: now handles reply properly: wasn't calling nsm_check()

This commit is contained in:
Harry van Haaren 2013-11-07 22:42:28 +00:00
parent 84b220728e
commit 260a1d5a0c
8 changed files with 24 additions and 21 deletions

View file

@ -50,12 +50,12 @@ add_executable (luppp ${sources} )
# Linking
target_link_libraries( luppp ${JACK_LIBRARIES} )
target_link_libraries( luppp ${LIBLO_LIBRARIES} )
target_link_libraries( luppp ${NTK_LIBRARIES} )
target_link_libraries( luppp ${CAIRO_LIBRARIES} )
target_link_libraries( luppp ${SNDFILE_LIBRARIES} )
target_link_libraries(luppp ${SAMPLERATE_LIBRARIES})
target_link_libraries( luppp ${JACK_LIBRARIES} )
target_link_libraries( luppp ${LIBLO_LIBRARIES} )
target_link_libraries( luppp ${NTK_LIBRARIES} )
target_link_libraries( luppp ${CAIRO_LIBRARIES} )
target_link_libraries( luppp ${SNDFILE_LIBRARIES} )
target_link_libraries( luppp ${SAMPLERATE_LIBRARIES} )
# Check build type, linking with gcov for code analysis if needed
IF(BUILD_TESTS)

View file

@ -34,8 +34,6 @@ int DiskReader::loadPreferences()
s << getenv("HOME") << "/.config/openAV/luppp/luppp.prfs";
std::ifstream sampleFile( s.str().c_str(), std::ios_base::in|std::ios_base::ate);
// CRITICAL FIXME: check file_length here, can be 0 causing new[0] causing segfault
long file_length = sampleFile.tellg();
if ( file_length > 0 )
{

View file

@ -103,7 +103,6 @@ int DiskWriter::writeControllerFile(std::string name ,
cJSON_AddItemToArray( inputBindings, binding );
// add metadata to binding
// FIXME: get action string from Event class: need to move function from GenericMIDI to there
const char* actionName = Event::getPrettyName( b.at(i)->action );
if ( actionName )
{
@ -116,6 +115,8 @@ int DiskWriter::writeControllerFile(std::string name ,
cJSON_AddNumberToObject( binding, "scene" , b.at(i)->scene );
cJSON_AddNumberToObject( binding, "send" , b.at(i)->send );
cJSON_AddNumberToObject( binding, "active", b.at(i)->active );
LUPPP_NOTE("Creating Binding: action %i == %s!", b.at(i)->action, actionName );
}
else
{

View file

@ -45,7 +45,6 @@ static void addNewController(Fl_Widget* w, void*)
}
if ( c->status() == Controller::CONTROLLER_OK )
{
EventControllerInstance e(c);

View file

@ -65,6 +65,9 @@ void close_cb(Fl_Widget*o, void*)
static void gui_static_read_rb(void* inst)
{
handleGuiEvents();
nsm_check_nowait( gui->getNsm() );
Fl::repeat_timeout( 1 / 30.f, &gui_static_read_rb, inst);
}
@ -228,12 +231,12 @@ static int cb_nsm_open (const char *name,
{
//printf("nsm open()\n", out_msg[0] );
LUPPP_NOTE("%s %s","Loading session ", out_msg[0] );
LUPPP_NOTE("NSM open() loading session");
//gui->getDiskReader()->readSession( fnfc.filename() );
//OSC_REPLY( "OK" );
//OSC_REPLY_P( "/nsm/client/open", "OK" );
nsm_client_t* nsm = gui->getNsm();
//nsm_client_t* nsm = gui->getNsm();
//lo_send_from( nsm_addr, losrv, LO_TT_IMMEDIATE, "/reply", "ss", path, "OK" );
@ -257,7 +260,7 @@ static int cb_nsm_save ( char **out_msg, void *userdata )
Gui::Gui() :
Gui::Gui(std::string argZero) :
samplerate( 0 ),
window(1110,650),
@ -356,13 +359,13 @@ Gui::Gui() :
{
nsm = nsm_new();
nsm_set_open_callback( nsm, cb_nsm_open, 0 );
nsm_set_save_callback( nsm, cb_nsm_save, 0 );
nsm_set_open_callback( nsm, cb_nsm_open, this );
nsm_set_save_callback( nsm, cb_nsm_save, this );
if ( nsm_init( nsm, nsm_url ) == 0 )
{
nsm_send_announce( nsm, "Luppp", "", "luppp" );
LUPPP_WARN("Announcing to NSM");
nsm_send_announce( nsm, "Luppp", "", argZero.c_str() );
LUPPP_NOTE("Announcing to NSM");
}
else
{
@ -372,7 +375,7 @@ Gui::Gui() :
}
else
{
LUPPP_WARN("No NSM_URL env variable");
LUPPP_NOTE("No session management in use");
}
}

View file

@ -30,7 +30,7 @@ class AudioBuffer;
class Gui
{
public:
Gui();
Gui(std::string argZero);
~Gui();
int show();

View file

@ -66,7 +66,7 @@ int main(int argc, char** argv)
// setup the testing Gui / JACK: Jack first, then GUI
jack = new Jack();
gui = new Gui();
gui = new Gui(argv[0]);
// test offline functionality
testResult += gui->getDiskReader()->runTests();
@ -90,7 +90,7 @@ int main(int argc, char** argv)
// setup the "real" JACK / Gui: Jack first, then GUI
jack = new Jack();
gui = new Gui();
gui = new Gui(argv[0]);
jack->activate();

View file

@ -353,6 +353,8 @@ nsm_set_broadcast_callback( nsm_client_t *nsm, nsm_broadcast_callback *broadcast
NSM_EXPORT int _nsm_osc_open ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data )
{
printf("NSM OSC OPEN\n");
(void) types;
(void) argc;
(void) msg;