From c8f805ef7c1c455ddd455ca6afc343afbba19db9 Mon Sep 17 00:00:00 2001 From: Len Ovens Date: Wed, 10 May 2017 09:42:48 -0700 Subject: [PATCH] OSC: Automation feedback should match command --- libs/surfaces/osc/osc_route_observer.cc | 40 +++++++++++++++++------- libs/surfaces/osc/osc_select_observer.cc | 22 +++++++++++-- 2 files changed, 49 insertions(+), 13 deletions(-) diff --git a/libs/surfaces/osc/osc_route_observer.cc b/libs/surfaces/osc/osc_route_observer.cc index c379ede4ed..e8f94946f2 100644 --- a/libs/surfaces/osc/osc_route_observer.cc +++ b/libs/surfaces/osc/osc_route_observer.cc @@ -50,29 +50,29 @@ OSCRouteObserver::OSCRouteObserver (boost::shared_ptr s, lo_address a _strip->PropertyChanged.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCRouteObserver::name_changed, this, boost::lambda::_1), OSC::instance()); name_changed (ARDOUR::Properties::name); - _strip->mute_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, bind (&OSCRouteObserver::send_change_message, this, X_("/strip/mute"), _strip->mute_control()), OSC::instance()); + _strip->mute_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCRouteObserver::send_change_message, this, X_("/strip/mute"), _strip->mute_control()), OSC::instance()); send_change_message ("/strip/mute", _strip->mute_control()); - _strip->solo_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, bind (&OSCRouteObserver::send_change_message, this, X_("/strip/solo"), _strip->solo_control()), OSC::instance()); + _strip->solo_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCRouteObserver::send_change_message, this, X_("/strip/solo"), _strip->solo_control()), OSC::instance()); send_change_message ("/strip/solo", _strip->solo_control()); boost::shared_ptr track = boost::dynamic_pointer_cast (_strip); if (track) { - track->monitoring_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, bind (&OSCRouteObserver::send_monitor_status, this, track->monitoring_control()), OSC::instance()); + track->monitoring_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCRouteObserver::send_monitor_status, this, track->monitoring_control()), OSC::instance()); send_monitor_status (track->monitoring_control()); } boost::shared_ptr rec_controllable = _strip->rec_enable_control (); if (rec_controllable) { - rec_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, bind (&OSCRouteObserver::send_change_message, this, X_("/strip/recenable"), _strip->rec_enable_control()), OSC::instance()); + rec_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCRouteObserver::send_change_message, this, X_("/strip/recenable"), _strip->rec_enable_control()), OSC::instance()); send_change_message ("/strip/recenable", _strip->rec_enable_control()); } boost::shared_ptr recsafe_controllable = _strip->rec_safe_control (); if (rec_controllable) { - recsafe_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, bind (&OSCRouteObserver::send_change_message, this, X_("/strip/record_safe"), _strip->rec_safe_control()), OSC::instance()); + recsafe_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCRouteObserver::send_change_message, this, X_("/strip/record_safe"), _strip->rec_safe_control()), OSC::instance()); send_change_message ("/strip/record_safe", _strip->rec_safe_control()); } - _strip->presentation_info().PropertyChanged.connect (strip_connections, MISSING_INVALIDATOR, bind (&OSCRouteObserver::send_select_status, this, _1), OSC::instance()); + _strip->presentation_info().PropertyChanged.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCRouteObserver::send_select_status, this, _1), OSC::instance()); send_select_status (ARDOUR::Properties::selected); } @@ -80,23 +80,23 @@ OSCRouteObserver::OSCRouteObserver (boost::shared_ptr s, lo_address a boost::shared_ptr gain_cont = _strip->gain_control(); if (gainmode) { gain_cont->alist()->automation_state_changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCRouteObserver::gain_automation, this, X_("/strip/fader")), OSC::instance()); - gain_cont->Changed.connect (strip_connections, MISSING_INVALIDATOR, bind (&OSCRouteObserver::send_gain_message, this, X_("/strip/fader"), gain_cont), OSC::instance()); + gain_cont->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCRouteObserver::send_gain_message, this, X_("/strip/fader"), gain_cont), OSC::instance()); gain_automation ("/strip/fader"); } else { gain_cont->alist()->automation_state_changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCRouteObserver::gain_automation, this, X_("/strip/gain")), OSC::instance()); - gain_cont->Changed.connect (strip_connections, MISSING_INVALIDATOR, bind (&OSCRouteObserver::send_gain_message, this, X_("/strip/gain"), gain_cont), OSC::instance()); + gain_cont->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCRouteObserver::send_gain_message, this, X_("/strip/gain"), gain_cont), OSC::instance()); gain_automation ("/strip/gain"); } boost::shared_ptr trim_controllable = boost::dynamic_pointer_cast(_strip->trim_control()); if (trim_controllable) { - trim_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, bind (&OSCRouteObserver::send_trim_message, this, X_("/strip/trimdB"), _strip->trim_control()), OSC::instance()); + trim_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCRouteObserver::send_trim_message, this, X_("/strip/trimdB"), _strip->trim_control()), OSC::instance()); send_trim_message ("/strip/trimdB", _strip->trim_control()); } boost::shared_ptr pan_controllable = boost::dynamic_pointer_cast(_strip->pan_azimuth_control()); if (pan_controllable) { - pan_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, bind (&OSCRouteObserver::send_change_message, this, X_("/strip/pan_stereo_position"), _strip->pan_azimuth_control()), OSC::instance()); + pan_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCRouteObserver::send_change_message, this, X_("/strip/pan_stereo_position"), _strip->pan_azimuth_control()), OSC::instance()); send_change_message ("/strip/pan_stereo_position", _strip->pan_azimuth_control()); } } @@ -389,7 +389,25 @@ OSCRouteObserver::gain_automation (string path) boost::shared_ptr control = _strip->gain_control(); as = control->alist()->automation_state(); - lo_message_add_float (msg, as); + float output; + switch (as) { + case ARDOUR::Off: + output = 0; + break; + case ARDOUR::Play: + output = 1; + break; + case ARDOUR::Write: + output = 2; + break; + case ARDOUR::Touch: + output = 3; + break; + default: + break; + } + + lo_message_add_float (msg, output); send_gain_message (path, control); lo_send_message (addr, apath.c_str(), msg); lo_message_free (msg); diff --git a/libs/surfaces/osc/osc_select_observer.cc b/libs/surfaces/osc/osc_select_observer.cc index 3c770b9628..35d35841d9 100644 --- a/libs/surfaces/osc/osc_select_observer.cc +++ b/libs/surfaces/osc/osc_select_observer.cc @@ -515,11 +515,29 @@ OSCSelectObserver::gain_message () void OSCSelectObserver::gain_automation () { + float output; as = _strip->gain_control()->alist()->automation_state(); + switch (as) { + case ARDOUR::Off: + output = 0; + break; + case ARDOUR::Play: + output = 1; + break; + case ARDOUR::Write: + output = 2; + break; + case ARDOUR::Touch: + output = 3; + break; + default: + break; + } + if (gainmode) { - send_float ("/select/fader/automation", as); + send_float ("/select/fader/automation", output); } else { - send_float ("/select/gain/automation", as); + send_float ("/select/gain/automation", output); } gain_message ();