diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2017-01-09 12:42:08 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2017-01-09 12:42:08 +0000 |
commit | 129708ad8566e25c7f6313ba2a045625dc693450 (patch) | |
tree | 7a76870333f7bedc1a5b93bbfefb14a740385a74 /libs/evoral | |
parent | fa828e0385fbac4ed640c645ef8fe8dfaa6a810a (diff) |
add clamp for adding points to a ControlList from a (G)UI
Diffstat (limited to 'libs/evoral')
-rw-r--r-- | libs/evoral/src/ControlList.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libs/evoral/src/ControlList.cpp b/libs/evoral/src/ControlList.cpp index f952b9c519..0b2184a972 100644 --- a/libs/evoral/src/ControlList.cpp +++ b/libs/evoral/src/ControlList.cpp @@ -492,6 +492,11 @@ ControlList::editor_add (double when, double value, bool with_guard) maybe_add_insert_guard (when); } + /* clamp new value to allowed range */ + + value = max (_min_yval, value); + value = min (_max_yval, value); + iterator result; DEBUG_TRACE (DEBUG::ControlList, string_compose ("editor_add: actually add when= %1 value= %2\n", when, value)); result = _events.insert (i, new ControlEvent (when, value)); |