summaryrefslogtreecommitdiff
path: root/libs/evoral/src
diff options
context:
space:
mode:
authorBen Loftis <ben@harrisonconsoles.com>2014-08-05 15:42:06 -0500
committerBen Loftis <ben@harrisonconsoles.com>2014-08-05 15:42:06 -0500
commit16ca4e0f9a4ffc87e8e572b8d69767648c2170ae (patch)
tree1ff9d225e598e4ed7c2379e1a870b9cce1f4d59f /libs/evoral/src
parent45afed5e9a38e50030c9f82f81f60a1bb883e867 (diff)
Initial steps towards usable range-based automation editing.
TODO: needs undo. only works in top quarter of automation lane. selection model feels weird sometimes. needs to show gain curve when you are using Range tool
Diffstat (limited to 'libs/evoral/src')
-rw-r--r--libs/evoral/src/ControlList.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/libs/evoral/src/ControlList.cpp b/libs/evoral/src/ControlList.cpp
index 95e61c1742..be08cb446b 100644
--- a/libs/evoral/src/ControlList.cpp
+++ b/libs/evoral/src/ControlList.cpp
@@ -444,6 +444,39 @@ ControlList::in_write_pass () const
}
void
+ControlList::editor_add (double when, double value)
+{
+ /* this is for making changes from a graphical line editor
+ */
+
+ if (!clamp_value (when, value)) {
+ return;
+ }
+
+ if (_events.empty()) {
+
+ /* as long as the point we're adding is not at zero,
+ * add an "anchor" point there.
+ */
+
+ if (when >= 1) {
+ _events.insert (_events.end(), new ControlEvent (0, _default_value));
+ DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 added default value %2 at zero\n", this, _default_value));
+ }
+ }
+
+ ControlEvent cp (when, 0.0f);
+ iterator i = lower_bound (_events.begin(), _events.end(), &cp, time_comparator);
+ DEBUG_TRACE (DEBUG::ControlList, string_compose ("editor_add: actually add when= %1 value= %1\n", when, value));
+ _events.insert (i, new ControlEvent (when, value));
+
+ mark_dirty ();
+
+ maybe_signal_changed ();
+
+}
+
+void
ControlList::add (double when, double value, bool with_guards)
{
/* this is for making changes from some kind of user interface or