Automation - more toggled controller twiddling.
authornick_m <mainsbridge@gmail.com>
Fri, 2 Oct 2015 19:08:26 +0000 (05:08 +1000)
committernick_m <mainsbridge@gmail.com>
Mon, 19 Oct 2015 13:53:28 +0000 (00:53 +1100)
gtk2_ardour/automation_controller.cc
libs/ardour/automatable.cc
libs/ardour/route.cc

index 691e0f3b58328c96bcc128b9a2d6720d2a757463..14f778ffa84d3f9e1058489ae6fffe0b3ff05ed5 100644 (file)
@@ -197,28 +197,26 @@ AutomationController::toggled ()
 {
        ArdourButton* but = dynamic_cast<ArdourButton*>(_widget);
        const AutoState as = _controllable->automation_state ();
-
+       const double where = _controllable->session ().audible_frame ();
        const bool to_list = _controllable->list () && _controllable->session().transport_rolling () && (as == Touch || as == Write);
 
        if (but) {
-               if (_controllable->session().transport_rolling()) {
-                       if (_controllable->automation_state() == Touch && _controllable->list()->in_new_write_pass ()) {
-                               _controllable->alist()->start_write_pass ( _controllable->session().audible_frame());
-                       }
-                       if (_controllable->list()) {
-                               _controllable->list()->set_in_write_pass(true, false, _controllable->session().audible_frame());
+               if (to_list) {
+                       if (as == Touch && _controllable->list ()->in_new_write_pass ()) {
+                               _controllable->alist ()->start_write_pass (where);
                        }
+                       _controllable->list ()->set_in_write_pass (true, false, where);
                }
 
-               _controllable->set_double (!but->get_active (), _controllable->session ().transport_frame (), to_list);
+               _controllable->set_double (!but->get_active (), where, to_list);
 
-               const bool was_active = _controllable->get_value() >= 0.5;
-               if (was_active && but->get_active()) {
-                       _adjustment->set_value(0.0);
-                       but->set_active(false);
-               } else if (!was_active && !but->get_active()) {
-                       _adjustment->set_value(1.0);
-                       but->set_active(true);
+               const bool active = _controllable->get_double (to_list, where) >= 0.5;
+               if (active && !but->get_active ()) {
+                       _adjustment->set_value (1.0);
+                       but->set_active (true);
+               } else if (!active && but->get_active ()) {
+                       _adjustment->set_value (0.0);
+                       but->set_active (false);
                }
        }
 }
index cfe2d7a853f3b7afd388da27186a338daa8ae8a9..0fb048b9ef879c8aa149d3e944c09428127523b4 100644 (file)
@@ -397,17 +397,19 @@ Automatable::transport_stopped (framepos_t now)
                const bool list_did_write = !l->in_new_write_pass ();
 
                l->stop_touch (true, now);
+
                if (list_did_write) {
                        c->commit_transaction ();
                }
-               l->write_pass_finished (now, Config->get_automation_thinning_factor());
 
-               if (l->automation_state() == Write) {
+               l->write_pass_finished (now, Config->get_automation_thinning_factor ());
+
+               if (l->automation_state () == Write) {
                        l->set_automation_state (Touch);
                }
 
-               if (l->automation_playback()) {
-                       c->set_value(c->list()->eval(now));
+               if (l->automation_playback ()) {
+                       c->set_value (c->list ()->eval (now));
                }
        }
 }
index adbfefb829626ee1855c724051881884889d96ef..60f4908768c055952e0b642a902516a969acd1b5 100644 (file)
@@ -3900,22 +3900,22 @@ Route::MuteControllable::set_superficial_value(bool muted)
        /* Note we can not use AutomationControl::set_value here since it will emit
           Changed(), but the value will not be correct to the observer. */
 
-       /* this is a tweak of ControlList::automation_write ()
-          as currently MuteControllable can't be touching.
-          bool to_list = _list && ((AutomationList*)_list.get())->automation_write();
-       */
-       AutomationList* alist = (AutomationList*)_list.get();
-       const AutoState as = alist->automation_state ();
-       const bool to_list = _list && _session.transport_rolling () && (as == Touch || as == Write);
-
+       const bool to_list = _list && ((AutomationList*)_list.get ())->automation_write ();
+       const double where = _session.audible_frame ();
        if (to_list) {
-               if (as == Touch && _list->in_new_write_pass ()) {
-                       alist->start_write_pass (_session.audible_frame ());
-               }
-               _list->set_in_write_pass (true, false, _session.audible_frame ());
+               /* Note that we really need this:
+                *  if (as == Touch && _list->in_new_write_pass ()) {
+                *       alist->start_write_pass (_session.audible_frame ());
+                *  }
+                * here in the case of the user calling from a GUI or whatever.
+                * Without the ability to distinguish between user and
+                * automation-initiated changes, we lose the "touch mute"
+                * behaviour we have in AutomationController::toggled ().
+                */
+               _list->set_in_write_pass (true, false, where);
        }
 
-       Control::set_double (muted, _session.transport_frame(), to_list);
+       Control::set_double (muted, where, to_list);
 }
 
 void