diff options
author | Len Ovens <len@ovenwerks.net> | 2017-05-09 14:10:49 -0700 |
---|---|---|
committer | Len Ovens <len@ovenwerks.net> | 2017-05-09 14:10:49 -0700 |
commit | 82fed14f41f1d480fef400384d81838d1edf3d32 (patch) | |
tree | 0d9dba531fbf32e37062dbef291bc076adda130d | |
parent | a12d4c87c666cb511752ce6f5ff43741f87536d5 (diff) |
OSC: Fix select fader automation play feedback as well fixes issue #7160
-rw-r--r-- | libs/surfaces/osc/osc_select_observer.cc | 39 | ||||
-rw-r--r-- | libs/surfaces/osc/osc_select_observer.h | 4 |
2 files changed, 38 insertions, 5 deletions
diff --git a/libs/surfaces/osc/osc_select_observer.cc b/libs/surfaces/osc/osc_select_observer.cc index b11d277947..2cc42569cc 100644 --- a/libs/surfaces/osc/osc_select_observer.cc +++ b/libs/surfaces/osc/osc_select_observer.cc @@ -49,8 +49,10 @@ OSCSelectObserver::OSCSelectObserver (boost::shared_ptr<Stripable> s, lo_address ,gainmode (gm) ,feedback (fb) ,nsends (0) + ,_last_gain (0.0) { addr = lo_address_new (lo_address_get_hostname(a) , lo_address_get_port(a)); + as = ARDOUR::AutoState::Off; if (feedback[0]) { // buttons are separate feedback _strip->PropertyChanged.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::name_changed, this, boost::lambda::_1), OSC::instance()); @@ -99,12 +101,15 @@ OSCSelectObserver::OSCSelectObserver (boost::shared_ptr<Stripable> s, lo_address } if (feedback[1]) { // level controls + boost::shared_ptr<GainControl> gain_cont = _strip->gain_control(); if (gainmode) { - _strip->gain_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::gain_message, this, X_("/select/fader"), _strip->gain_control()), OSC::instance()); - gain_message ("/select/fader", _strip->gain_control()); + gain_cont->alist()->automation_state_changed.connect (strip_connections, MISSING_INVALIDATOR, bind (&OSCSelectObserver::gain_automation, this, X_("/select/fader")), OSC::instance()); + gain_cont->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::gain_message, this, X_("/select/fader"), gain_cont), OSC::instance()); + gain_automation ("/select/fader"); } else { - _strip->gain_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::gain_message, this, X_("/select/gain"), _strip->gain_control()), OSC::instance()); - gain_message ("/select/gain", _strip->gain_control()); + gain_cont->alist()->automation_state_changed.connect (strip_connections, MISSING_INVALIDATOR, bind (&OSCSelectObserver::gain_automation, this, X_("/select/gain")), OSC::instance()); + gain_cont->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::gain_message, this, X_("/select/gain"), _strip->gain_control()), OSC::instance()); + gain_automation ("/strip/gain"); } boost::shared_ptr<Controllable> trim_controllable = boost::dynamic_pointer_cast<Controllable>(_strip->trim_control()); @@ -366,6 +371,18 @@ OSCSelectObserver::tick () } } } + 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) { + gain_message ("/select/fader", _strip->gain_control()); + } else { + gain_message ("/select/fader", _strip->gain_control()); + } + } + } + } } @@ -511,6 +528,20 @@ OSCSelectObserver::gain_message (string path, boost::shared_ptr<Controllable> co } void +OSCSelectObserver::gain_automation (string path) +{ + lo_message msg = lo_message_new (); + string apath = string_compose ("%1/automation", path); + + boost::shared_ptr<GainControl> control = _strip->gain_control(); + as = control->alist()->automation_state(); + lo_message_add_float (msg, as); + gain_message (path, control); + lo_send_message (addr, apath.c_str(), msg); + lo_message_free (msg); +} + +void OSCSelectObserver::send_gain (uint32_t id, boost::shared_ptr<PBD::Controllable> controllable) { lo_message msg = lo_message_new (); diff --git a/libs/surfaces/osc/osc_select_observer.h b/libs/surfaces/osc/osc_select_observer.h index b004f938d9..a603d12fd4 100644 --- a/libs/surfaces/osc/osc_select_observer.h +++ b/libs/surfaces/osc/osc_select_observer.h @@ -58,7 +58,8 @@ class OSCSelectObserver uint32_t gain_timeout; float _last_meter; uint32_t nsends; - + float _last_gain; + ARDOUR::AutoState as; void name_changed (const PBD::PropertyChange& what_changed); void change_message (std::string path, boost::shared_ptr<PBD::Controllable> controllable); @@ -70,6 +71,7 @@ class OSCSelectObserver void text_with_id (std::string path, uint32_t id, std::string name); void monitor_status (boost::shared_ptr<PBD::Controllable> controllable); void gain_message (std::string path, boost::shared_ptr<PBD::Controllable> controllable); + void gain_automation (std::string path); void trim_message (std::string path, boost::shared_ptr<PBD::Controllable> controllable); // sends stuff void send_init (void); |