diff --git a/libs/surfaces/osc/osc_select_observer.cc b/libs/surfaces/osc/osc_select_observer.cc index e5995edf2f..de58cd8916 100644 --- a/libs/surfaces/osc/osc_select_observer.cc +++ b/libs/surfaces/osc/osc_select_observer.cc @@ -38,6 +38,7 @@ #include "ardour/plugin_insert.h" #include "ardour/processor.h" #include "ardour/readonly_control.h" +#include "ardour/vca.h" #include "osc.h" #include "osc_select_observer.h" @@ -195,6 +196,10 @@ OSCSelectObserver::refresh_strip (boost::shared_ptr new_strip _strip->gain_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::gain_message, this), OSC::instance()); gain_automation (); + boost::shared_ptr slv = boost::dynamic_pointer_cast (_strip); + slv->AssignmentChange.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::slaved_changed, this, _1, _2), OSC::instance()); + slaved_changed (boost::shared_ptr(), false); + boost::shared_ptr trim_controllable = boost::dynamic_pointer_cast(_strip->trim_control()); if (trim_controllable) { trim_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::trim_message, this, X_("/select/trimdB"), _strip->trim_control()), OSC::instance()); @@ -1021,3 +1026,28 @@ OSCSelectObserver::eq_restart(int x) //eq_end(); eq_init(); } + +void +OSCSelectObserver::slaved_changed (boost::shared_ptr vca, bool state) +{ + lo_message reply; + reply = lo_message_new (); + StripableList stripables; + session->get_stripables (stripables); + for (StripableList::iterator it = stripables.begin(); it != stripables.end(); ++it) { + boost::shared_ptr s = *it; + + // we only want VCAs + boost::shared_ptr v = boost::dynamic_pointer_cast (s); + if (v) { + lo_message_add_string (reply, v->name().c_str()); + if (_strip->slaved_to (v)) { + lo_message_add_int32 (reply, 1); + } else { + lo_message_add_int32 (reply, 0); + } + } + } + lo_send_message (addr, X_("/select/vcas"), reply); + lo_message_free (reply); +} diff --git a/libs/surfaces/osc/osc_select_observer.h b/libs/surfaces/osc/osc_select_observer.h index 0b9f697f2e..063b0e7839 100644 --- a/libs/surfaces/osc/osc_select_observer.h +++ b/libs/surfaces/osc/osc_select_observer.h @@ -122,6 +122,7 @@ class OSCSelectObserver void eq_init (void); void eq_end (void); void no_strip (); + void slaved_changed (boost::shared_ptr vca, bool state); }; #endif /* __osc_oscselectobserver_h__ */