summaryrefslogtreecommitdiff
path: root/libs/evoral/src/ControlList.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/evoral/src/ControlList.cpp')
-rw-r--r--libs/evoral/src/ControlList.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/libs/evoral/src/ControlList.cpp b/libs/evoral/src/ControlList.cpp
index d8665d3396..d9c1b993bd 100644
--- a/libs/evoral/src/ControlList.cpp
+++ b/libs/evoral/src/ControlList.cpp
@@ -451,12 +451,19 @@ ControlList::in_write_pass () const
return _in_write_pass;
}
-void
+bool
ControlList::editor_add (double when, double value, bool with_guard)
{
/* this is for making changes from a graphical line editor
*/
+ ControlEvent cp (when, 0.0f);
+ iterator i = lower_bound (_events.begin(), _events.end(), &cp, time_comparator);
+
+ if (i != _events.end () && (*i)->when == when) {
+ return false;
+ }
+
if (_events.empty()) {
/* as long as the point we're adding is not at zero,
@@ -477,15 +484,18 @@ ControlList::editor_add (double when, double value, bool with_guard)
maybe_add_insert_guard (when);
}
- ControlEvent cp (when, 0.0f);
- iterator i = lower_bound (_events.begin(), _events.end(), &cp, time_comparator);
+ iterator result;
DEBUG_TRACE (DEBUG::ControlList, string_compose ("editor_add: actually add when= %1 value= %2\n", when, value));
- _events.insert (i, new ControlEvent (when, value));
+ result = _events.insert (i, new ControlEvent (when, value));
- mark_dirty ();
+ if (i == result) {
+ return false;
+ }
+ mark_dirty ();
maybe_signal_changed ();
+ return true;
}
void