diff options
author | Ben Loftis <ben@harrisonconsoles.com> | 2014-08-05 15:42:06 -0500 |
---|---|---|
committer | Ben Loftis <ben@harrisonconsoles.com> | 2014-08-05 15:42:06 -0500 |
commit | 16ca4e0f9a4ffc87e8e572b8d69767648c2170ae (patch) | |
tree | 1ff9d225e598e4ed7c2379e1a870b9cce1f4d59f /libs/evoral | |
parent | 45afed5e9a38e50030c9f82f81f60a1bb883e867 (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')
-rw-r--r-- | libs/evoral/evoral/ControlList.hpp | 4 | ||||
-rw-r--r-- | libs/evoral/src/ControlList.cpp | 33 |
2 files changed, 36 insertions, 1 deletions
diff --git a/libs/evoral/evoral/ControlList.hpp b/libs/evoral/evoral/ControlList.hpp index e66cbe2253..debd4989e0 100644 --- a/libs/evoral/evoral/ControlList.hpp +++ b/libs/evoral/evoral/ControlList.hpp @@ -121,7 +121,9 @@ public: virtual bool clamp_value (double& /*when*/, double& /*value*/) const { return true; } - virtual void add (double when, double value, bool with_guards=true); + virtual void add (double when, double value, bool with_guards=true); + virtual void editor_add (double when, double value); + void fast_simple_add (double when, double value); void erase_range (double start, double end); 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 |