From d959b54f6adfe0d2ffbcdb3d19ddc5b4fe428c22 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Wed, 8 Feb 2012 10:39:03 -0800 Subject: [PATCH] Mixer: Add commandline option for specifying the OSC port to use. --- mixer/src/Mixer.C | 6 +++++- mixer/src/Mixer.H | 2 ++ mixer/src/main.C | 20 ++++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/mixer/src/Mixer.C b/mixer/src/Mixer.C index 7327037..6f69a02 100644 --- a/mixer/src/Mixer.C +++ b/mixer/src/Mixer.C @@ -384,8 +384,12 @@ Mixer::Mixer ( int X, int Y, int W, int H, const char *L ) : update_menu(); load_options(); +} - osc_endpoint = new OSC::Endpoint(); +void +Mixer::init_osc ( const char *osc_port ) +{ + osc_endpoint = new OSC::Endpoint(osc_port); osc_endpoint->url(); diff --git a/mixer/src/Mixer.H b/mixer/src/Mixer.H index 70119b0..6e2710f 100644 --- a/mixer/src/Mixer.H +++ b/mixer/src/Mixer.H @@ -95,6 +95,8 @@ public: void announce ( const char *nash_url ); + void init_osc ( const char* osc_port ); + public: bool command_save ( void ); diff --git a/mixer/src/main.C b/mixer/src/main.C index d159288..138fb2d 100644 --- a/mixer/src/main.C +++ b/mixer/src/main.C @@ -137,8 +137,11 @@ main ( int argc, char **argv ) o->callback( (Fl_Callback*)cb_main, main_window ); o->show( argc, argv ); + // o->show(); } + const char *osc_port = NULL; + { int r = argc - 1; int i = 1; @@ -150,6 +153,7 @@ main ( int argc, char **argv ) { MESSAGE( "Using instance name \"%s\"", argv[i+1] ); instance_name = argv[i+1]; + --r; ++i; } else @@ -157,6 +161,20 @@ main ( int argc, char **argv ) FATAL( "Missing instance name" ); } } + else if ( !strcmp( argv[i], "--osc-port" ) ) + { + if ( r > 1 ) + { + MESSAGE( "Using OSC port \"%s\"", argv[i+1] ); + osc_port = argv[i+1]; + --r; + ++i; + } + else + { + FATAL( "Missing OSC port" ); + } + } else if ( !strncmp( argv[i], "--", 2 ) ) { WARNING( "Unrecognized option: %s", argv[i] ); @@ -177,6 +195,8 @@ main ( int argc, char **argv ) } + mixer->init_osc( osc_port ); + Fl::run(); delete main_window;