Fix thinko in automation write undo.
authornick_m <mainsbridge@gmail.com>
Wed, 17 Jun 2015 12:19:21 +0000 (22:19 +1000)
committernick_m <mainsbridge@gmail.com>
Wed, 17 Jun 2015 12:19:21 +0000 (22:19 +1000)
- also allow saved automation list state to be touch or off if
  actually in write mode.

libs/ardour/automation_control.cc
libs/ardour/automation_list.cc

index f2361c2b30328efc85b48cbeecffe60e5845c461..bfb1046849887b83fa57a67d391efe99b4404896 100644 (file)
@@ -88,6 +88,8 @@ AutomationControl::set_automation_state (AutoState as)
                }
 
                if (as == Write) {
+                       /* get state for undo */
+                       _before = &alist ()->get_state ();
                        AutomationWatch::instance().add_automation_watch (shared_from_this());
                } else if (as == Touch) {
                        if (!touching()) {
@@ -122,10 +124,6 @@ AutomationControl::start_touch(double when)
 
        if (!touching()) {
 
-               if (alist()->automation_state() == Write) {
-                       _before = &alist ()->get_state ();
-               }
-
                if (alist()->automation_state() == Touch) {
                        /* subtle. aligns the user value with the playback */
                        set_value (get_value ());
index 7f7599f8ca4abc8025ec62c78f337c735386ffd6..706a3330a74d360f91e98efed3cebb5717d0f381 100644 (file)
@@ -276,7 +276,11 @@ AutomationList::state (bool full)
                 if (_state != Write) {
                         root->add_property ("state", auto_state_to_string (_state));
                 } else {
-                        root->add_property ("state", auto_state_to_string (Off));
+                       if (_events.empty ()) {
+                               root->add_property ("state", auto_state_to_string (Off));
+                       } else {
+                               root->add_property ("state", auto_state_to_string (Touch));
+                       }
                 }
        } else {
                /* never save anything but Off for automation state to a template */