Rudimentary automation touch undo/redo.

This commit is contained in:
nick_m
2015-06-14 05:17:25 +10:00
parent 57ce447fd1
commit 7cb9dbb8af
2 changed files with 10 additions and 1 deletions

View File

@@ -101,6 +101,7 @@ protected:
ARDOUR::Session& _session;
const ParameterDescriptor _desc;
XMLNode* _before; //used for undo of touch start/stop pairs.
};

View File

@@ -19,12 +19,15 @@
*/
#include <iostream>
#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<AutomationList> (*alist ().get (), _before, &alist ()->get_state ()));
_session.commit_reversible_command ();
}
}
}