summaryrefslogtreecommitdiff
path: root/libs/ardour/slavable_automation_control.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-06-23 15:51:46 +0200
committerRobin Gareus <robin@gareus.org>2017-06-23 17:39:20 +0200
commitde731940505dff6a9ba4cd624c2cd721b8970a63 (patch)
tree7cdf69ce0d3a9960743a70e538ba28de737b4294 /libs/ardour/slavable_automation_control.cc
parentd34fdb98e358b8d1905b72c3f1cf6a065e4446e2 (diff)
Implement undo for merging VCA-master automation/value on disconnect.
Diffstat (limited to 'libs/ardour/slavable_automation_control.cc')
-rw-r--r--libs/ardour/slavable_automation_control.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/libs/ardour/slavable_automation_control.cc b/libs/ardour/slavable_automation_control.cc
index 6558637383..3128543dde 100644
--- a/libs/ardour/slavable_automation_control.cc
+++ b/libs/ardour/slavable_automation_control.cc
@@ -21,6 +21,7 @@
#include "pbd/enumwriter.h"
#include "pbd/error.h"
+#include "pbd/memento_command.h"
#include "pbd/types_convert.h"
#include "pbd/i18n.h"
@@ -366,6 +367,7 @@ SlavableAutomationControl::remove_master (boost::shared_ptr<AutomationControl> m
/* ..and update automation */
if (_list) {
+ XMLNode* before = &alist ()->get_state ();
if (master->automation_playback () && master->list()) {
_list->list_merge (*master->list().get(), boost::bind (&SlavableAutomationControl::scale_automation_callback, this, _1, _2));
_list->y_transform (boost::bind (&SlavableAutomationControl::scale_automation_callback, this, _1, list_ratio));
@@ -373,6 +375,11 @@ SlavableAutomationControl::remove_master (boost::shared_ptr<AutomationControl> m
// do we need to freeze/thaw the list? probably no: iterators & positions don't change
_list->y_transform (boost::bind (&SlavableAutomationControl::scale_automation_callback, this, _1, master_ratio));
}
+ XMLNode* after = &alist ()->get_state ();
+ if (*before != *after) {
+ _session.begin_reversible_command (string_compose (_("Merge VCA automation into %1"), name ()));
+ _session.commit_reversible_command (alist()->memento_command (before, after));
+ }
}
}
@@ -432,6 +439,7 @@ SlavableAutomationControl::clear_masters ()
/* ..and update automation */
if (_list) {
+ XMLNode* before = &alist ()->get_state ();
if (!masters.empty()) {
for (ControlList::const_iterator m = masters.begin(); m != masters.end(); ++m) {
_list->list_merge (*(*m)->list().get(), boost::bind (&SlavableAutomationControl::scale_automation_callback, this, _1, _2));
@@ -440,6 +448,11 @@ SlavableAutomationControl::clear_masters ()
} else {
_list->y_transform (boost::bind (&SlavableAutomationControl::scale_automation_callback, this, _1, master_ratio));
}
+ XMLNode* after = &alist ()->get_state ();
+ if (*before != *after) {
+ _session.begin_reversible_command (string_compose (_("Merge VCA automation into %1"), name ()));
+ _session.commit_reversible_command (alist()->memento_command (before, after));
+ }
}
}