From 57ce447fd19bd794afe90748d466bbe172c2eab0 Mon Sep 17 00:00:00 2001 From: nick_m Date: Sun, 7 Jun 2015 23:07:56 +1000 Subject: Fix some workflow problems wrt automation. - clearing automation points sets control to "off" rather than touch. - multiple touches on the same pass acts consistently (no more fader jumps on mouse button press - use actual value for initial point rather than some arbitrary default. clarify new semantics of add () (with_default->with_initial). - clean some whitespace - add guard points as needed in stop. - catch grab broken signal (i can't trigger it, but the docs seem to think it is essential). --- libs/ardour/automation_control.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libs/ardour/automation_control.cc') diff --git a/libs/ardour/automation_control.cc b/libs/ardour/automation_control.cc index 21952038cf..da33ad12a5 100644 --- a/libs/ardour/automation_control.cc +++ b/libs/ardour/automation_control.cc @@ -116,6 +116,8 @@ AutomationControl::start_touch(double when) if (!_list) return; if (!touching()) { if (alist()->automation_state() == Touch) { + /* subtle. aligns the user value with the playback */ + set_value (get_value ()); alist()->start_touch (when); if (!_desc.toggled) { AutomationWatch::instance().add_automation_watch (shared_from_this()); -- cgit v1.2.3 From 7cb9dbb8af5c4bd957067816d304282fa5120844 Mon Sep 17 00:00:00 2001 From: nick_m Date: Sun, 14 Jun 2015 05:17:25 +1000 Subject: Rudimentary automation touch undo/redo. --- libs/ardour/ardour/automation_control.h | 1 + libs/ardour/automation_control.cc | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'libs/ardour/automation_control.cc') diff --git a/libs/ardour/ardour/automation_control.h b/libs/ardour/ardour/automation_control.h index 24a9e0de3e..5d73e4aef9 100644 --- a/libs/ardour/ardour/automation_control.h +++ b/libs/ardour/ardour/automation_control.h @@ -101,6 +101,7 @@ protected: ARDOUR::Session& _session; const ParameterDescriptor _desc; + XMLNode* _before; //used for undo of touch start/stop pairs. }; diff --git a/libs/ardour/automation_control.cc b/libs/ardour/automation_control.cc index da33ad12a5..4ece790248 100644 --- a/libs/ardour/automation_control.cc +++ b/libs/ardour/automation_control.cc @@ -19,12 +19,15 @@ */ #include - #include "ardour/automation_control.h" #include "ardour/automation_watch.h" #include "ardour/event_type_map.h" #include "ardour/session.h" +#include "pbd/memento_command.h" + +#include "i18n.h" + using namespace std; using namespace ARDOUR; using namespace PBD; @@ -118,6 +121,7 @@ AutomationControl::start_touch(double when) if (alist()->automation_state() == Touch) { /* subtle. aligns the user value with the playback */ set_value (get_value ()); + _before = &alist ()->get_state (); alist()->start_touch (when); if (!_desc.toggled) { AutomationWatch::instance().add_automation_watch (shared_from_this()); @@ -138,6 +142,10 @@ AutomationControl::stop_touch(bool mark, double when) if (!_desc.toggled) { AutomationWatch::instance().remove_automation_watch (shared_from_this()); } + + _session.begin_reversible_command (_("record automation controller")); + _session.add_command (new MementoCommand (*alist ().get (), _before, &alist ()->get_state ())); + _session.commit_reversible_command (); } } } -- cgit v1.2.3 From 15336d06e41fed130f1a0db9eee07b74546c7d92 Mon Sep 17 00:00:00 2001 From: nick_m Date: Wed, 17 Jun 2015 00:39:20 +1000 Subject: Add undo for automation write. --- libs/ardour/automation_control.cc | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'libs/ardour/automation_control.cc') diff --git a/libs/ardour/automation_control.cc b/libs/ardour/automation_control.cc index 4ece790248..f2361c2b30 100644 --- a/libs/ardour/automation_control.cc +++ b/libs/ardour/automation_control.cc @@ -116,8 +116,16 @@ AutomationControl::set_automation_style (AutoStyle as) void AutomationControl::start_touch(double when) { - if (!_list) return; + if (!_list) { + return; + } + 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 ()); @@ -137,13 +145,20 @@ AutomationControl::stop_touch(bool mark, double when) if (!_list) return; if (touching()) { set_touching (false); + + if (alist()->automation_state() == Write) { + _session.begin_reversible_command (string_compose (_("write %1 automation"), name ())); + _session.add_command (new MementoCommand (*alist ().get (), _before, &alist ()->get_state ())); + _session.commit_reversible_command (); + } + if (alist()->automation_state() == Touch) { alist()->stop_touch (mark, when); if (!_desc.toggled) { AutomationWatch::instance().remove_automation_watch (shared_from_this()); } - _session.begin_reversible_command (_("record automation controller")); + _session.begin_reversible_command (string_compose (_("touch %1 automation"), name ())); _session.add_command (new MementoCommand (*alist ().get (), _before, &alist ()->get_state ())); _session.commit_reversible_command (); } -- cgit v1.2.3 From 80090f0f71256d65c876f83d3c6f3637cb9d44bb Mon Sep 17 00:00:00 2001 From: nick_m Date: Wed, 17 Jun 2015 22:19:21 +1000 Subject: Fix thinko in automation write undo. - also allow saved automation list state to be touch or off if actually in write mode. --- libs/ardour/automation_control.cc | 6 ++---- libs/ardour/automation_list.cc | 6 +++++- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'libs/ardour/automation_control.cc') diff --git a/libs/ardour/automation_control.cc b/libs/ardour/automation_control.cc index f2361c2b30..bfb1046849 100644 --- a/libs/ardour/automation_control.cc +++ b/libs/ardour/automation_control.cc @@ -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 ()); diff --git a/libs/ardour/automation_list.cc b/libs/ardour/automation_list.cc index 7f7599f8ca..706a3330a7 100644 --- a/libs/ardour/automation_list.cc +++ b/libs/ardour/automation_list.cc @@ -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 */ -- cgit v1.2.3