Properly remove-time automation
authorRobin Gareus <robin@gareus.org>
Sat, 22 Dec 2018 00:09:24 +0000 (01:09 +0100)
committerRobin Gareus <robin@gareus.org>
Sat, 22 Dec 2018 00:09:24 +0000 (01:09 +0100)
Previously "remove time" was able to produce overlapping, not
ordered automation.

libs/evoral/src/ControlList.cpp

index 8d0ac688e9d465f2f93e2da317fb2f9c83d973bc..e1729483cc7b1f2d3f9cccb05799ca11476f6058 100644 (file)
@@ -990,6 +990,14 @@ ControlList::shift (double pos, double frames)
 {
        {
                Glib::Threads::RWLock::WriterLock lm (_lock);
+               if (frames < 0) {
+                       /* Route::shift () with negative shift is used
+                        * for "remove time". The time [pos.. pos-frames] is removed.
+                        * and everyhing after, moved backwards.
+                        * TODO: consider adding guard-points (need special-casing)
+                        */
+                       erase_range_internal (pos, pos - frames, _events);
+               }
 
                for (iterator i = _events.begin(); i != _events.end(); ++i) {
                        if ((*i)->when >= pos) {