diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-11-15 16:22:43 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-11-15 16:22:43 +0000 |
commit | a0f00d7d227e1fe3cc935d6e7570e0f6a0ec2f18 (patch) | |
tree | 58e3c8129dce6056f1f0bcdaf434d9f2ddb7afcc /libs/evoral/src/ControlList.cpp | |
parent | a6968f8d2c4fb7f14f7897227ff0b22b94586f2a (diff) |
add a "guard" point after a write/touch automation insertion, preserving the shape of the later segment of the existing line
git-svn-id: svn://localhost/ardour2/branches/3.0@13507 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/evoral/src/ControlList.cpp')
-rw-r--r-- | libs/evoral/src/ControlList.cpp | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/libs/evoral/src/ControlList.cpp b/libs/evoral/src/ControlList.cpp index 31811e2fc9..7db4e74650 100644 --- a/libs/evoral/src/ControlList.cpp +++ b/libs/evoral/src/ControlList.cpp @@ -493,6 +493,27 @@ ControlList::add (double when, double value) } ++most_recent_insert_iterator; } + + if (most_recent_insert_iterator != _events.end()) { + if ((*most_recent_insert_iterator)->when - when > 64) { + /* next control point is some + * distance from where our new + * point is going to go - add a + * new point to avoid changing + * the shape of the line too + * much. the insert iterator needs + * to point to the new control + * point so that our insert + * will happen correctly. + */ + most_recent_insert_iterator = _events.insert (most_recent_insert_iterator, + new ControlEvent (when+1, (*most_recent_insert_iterator)->value)); + DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 added post-erase guard point @ %2 = %3\n", + this, when+1, + (*most_recent_insert_iterator)->value)); + } + } + } else { /* not in a write pass: figure out the iterator we should insert in front of */ @@ -599,7 +620,27 @@ ControlList::add (double when, double value) } } } - + + if (most_recent_insert_iterator != _events.end()) { + if ((*most_recent_insert_iterator)->when - when > 64) { + /* next control point is some + * distance from where our new + * point is going to go - add a + * new point to avoid changing + * the shape of the line too + * much. the insert iterator needs + * to point to the new control + * point so that our insert + * will happen correctly. + */ + most_recent_insert_iterator = _events.insert (most_recent_insert_iterator, + new ControlEvent (when+1, (*most_recent_insert_iterator)->value)); + DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 added insert-post-erase guard point @ %2 = %3\n", + this, when+1, + (*most_recent_insert_iterator)->value)); + } + } + if (!done) { EventList::iterator x = _events.insert (most_recent_insert_iterator, new ControlEvent (when, value)); DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 inserted new value before MRI, size now %2\n", this, _events.size())); |