From a12d4c87c666cb511752ce6f5ff43741f87536d5 Mon Sep 17 00:00:00 2001 From: Len Ovens Date: Tue, 9 May 2017 13:38:57 -0700 Subject: [PATCH] OSC: Get gain feedback to show with automation Play. --- libs/surfaces/osc/osc_route_observer.cc | 19 ++++++++++++++++--- libs/surfaces/osc/osc_route_observer.h | 2 ++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/libs/surfaces/osc/osc_route_observer.cc b/libs/surfaces/osc/osc_route_observer.cc index beea83f84f..049098f0b1 100644 --- a/libs/surfaces/osc/osc_route_observer.cc +++ b/libs/surfaces/osc/osc_route_observer.cc @@ -39,10 +39,12 @@ OSCRouteObserver::OSCRouteObserver (boost::shared_ptr s, lo_address a : _strip (s) ,ssid (ss) ,sur (su) + ,_last_gain (0.0) { addr = lo_address_new (lo_address_get_hostname(a) , lo_address_get_port(a)); gainmode = sur->gainmode; feedback = sur->feedback; + as = ARDOUR::AutoState::Off; if (feedback[0]) { // buttons are separate feedback _strip->PropertyChanged.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCRouteObserver::name_changed, this, boost::lambda::_1), OSC::instance()); @@ -220,6 +222,18 @@ OSCRouteObserver::tick () trim_timeout--; } } + if (feedback[1]) { + if (as != ARDOUR::AutoState::Off) { + if(_last_gain != _strip->gain_control()->get_value()) { + _last_gain = _strip->gain_control()->get_value(); + if (gainmode) { + send_gain_message ("/strip/fader", _strip->gain_control()); + } else { + send_gain_message ("/strip/fader", _strip->gain_control()); + } + } + } + } } @@ -374,13 +388,12 @@ OSCRouteObserver::gain_automation (string path) } boost::shared_ptr control = _strip->gain_control(); - lo_message_add_float (msg, control->alist()->automation_state()); + as = control->alist()->automation_state(); + lo_message_add_float (msg, as); send_gain_message (path, control); lo_send_message (addr, apath.c_str(), msg); lo_message_free (msg); } - - string OSCRouteObserver::set_path (string path) diff --git a/libs/surfaces/osc/osc_route_observer.h b/libs/surfaces/osc/osc_route_observer.h index a445334b3c..770d3118a4 100644 --- a/libs/surfaces/osc/osc_route_observer.h +++ b/libs/surfaces/osc/osc_route_observer.h @@ -58,6 +58,8 @@ class OSCRouteObserver float _last_meter; uint32_t gain_timeout; uint32_t trim_timeout; + float _last_gain; + ARDOUR::AutoState as; void name_changed (const PBD::PropertyChange& what_changed);