From 9ff41fe8faa7b4e43b169e7c2c7044b6ebb65fc6 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Fri, 10 Feb 2012 00:28:37 -0800 Subject: [PATCH] Mixer: Display realtime parameter changes (initiated via automation or GUI) in Module_Parameter_Editor --- mixer/src/Module.C | 17 ++++++++++++----- mixer/src/Module.H | 2 +- mixer/src/Module_Parameter_Editor.C | 14 +++++++++++++- mixer/src/Module_Parameter_Editor.H | 2 ++ nonlib/OSC/Endpoint.C | 6 +++--- 5 files changed, 31 insertions(+), 10 deletions(-) diff --git a/mixer/src/Module.C b/mixer/src/Module.C index e4ccfd2..2fc88a1 100644 --- a/mixer/src/Module.C +++ b/mixer/src/Module.C @@ -191,13 +191,22 @@ Module::paste_before ( void ) m->copy(); } + + + +void +Module::handle_control_changed ( Port *p ) +{ + if ( _editor ) + _editor->handle_control_changed ( p ); +} char * Module::Port::generate_osc_path () { const Port *p = this; - char *path; + char *path = NULL; // /mixer/strip/STRIPNAME/control/MODULENAME/CONTROLNAME @@ -237,11 +246,9 @@ Module::Port::change_osc_path ( char *path ) if ( path ) { - _osc_path_cv = (char*)malloc( strlen( path ) + 4 ); - _osc_path_cv[0] = 0; + _osc_path_cv = NULL; - strcpy( _osc_path_cv, path ); - strcat( _osc_path_cv, "/unscaled" ); + asprintf( &_osc_path_cv, "%s/unscaled", path ); mixer->osc_endpoint->add_method( path, "f", &Module::Port::osc_control_change_cv, this, "value" ); diff --git a/mixer/src/Module.H b/mixer/src/Module.H index 78e749b..ec2095b 100644 --- a/mixer/src/Module.H +++ b/mixer/src/Module.H @@ -381,7 +381,7 @@ public: /* called whenever the value of a control port is changed. This can be used to take appropriate action from the GUI thread */ - virtual void handle_control_changed ( Port * ) { } + virtual void handle_control_changed ( Port * ); /* called whenever the name of the chain changes (usually because * the name of the mixer strip changed). */ diff --git a/mixer/src/Module_Parameter_Editor.C b/mixer/src/Module_Parameter_Editor.C index f9dab01..1338b4c 100644 --- a/mixer/src/Module_Parameter_Editor.C +++ b/mixer/src/Module_Parameter_Editor.C @@ -168,7 +168,6 @@ Module_Parameter_Editor::make_controls ( void ) o->selection_color( FL_GREEN ); o->type( FL_TOGGLE_BUTTON ); o->value( p->control_value() ); - } else if ( p->hints.type == Module::Port::Hints::INTEGER ) { @@ -370,6 +369,19 @@ Module_Parameter_Editor::bind_control ( int i ) _module->redraw(); } +/* Display changes initiated via automation or from other parts of the GUI */ +void +Module_Parameter_Editor::handle_control_changed ( Module::Port *p ) +{ + int i = _module->control_input_port_index( p ); + + Fl_Group *g = (Fl_Group*)control_pack->child( i ); + Fl_Group *g2 = (Fl_Group*)g->child( 0 ); + Fl_Valuator *v = (Fl_Valuator*)g2->child( 0 ); + + v->value( p->control_value() ); +} + void Module_Parameter_Editor::set_value (int i, float value ) { diff --git a/mixer/src/Module_Parameter_Editor.H b/mixer/src/Module_Parameter_Editor.H index d87b5af..b2fe550 100644 --- a/mixer/src/Module_Parameter_Editor.H +++ b/mixer/src/Module_Parameter_Editor.H @@ -67,6 +67,8 @@ class Module_Parameter_Editor : public Fl_Double_Window public: + void handle_control_changed ( Module::Port *p ); + Module_Parameter_Editor ( Module *module ); virtual ~Module_Parameter_Editor ( ); }; diff --git a/nonlib/OSC/Endpoint.C b/nonlib/OSC/Endpoint.C index b629587..6b2c17b 100644 --- a/nonlib/OSC/Endpoint.C +++ b/nonlib/OSC/Endpoint.C @@ -111,10 +111,10 @@ namespace OSC lo_server_add_method( _server, path, typespec, handler, user_data ); - char *stored_path; - + char *stored_path = NULL; + asprintf( &stored_path, "%s (%s); %s", path, typespec, argument_description ); - + _path_names.push_back( stored_path ); }