From 896961b4114babd52408b1ee7eb65e9f3d3d7bcb Mon Sep 17 00:00:00 2001 From: GZharun Date: Fri, 9 Jan 2015 10:49:42 +0200 Subject: [PATCH] [Summary] The same as previous reverted commit but with more correct and full description: Fixed two bugs. Not specified in TT. 1.Ranges which coincided with region borders (achieved by the context menu commands like Move Range Start/End ... ) used to cut a small byte of region which border coincided. 2. If you cover region with a range which start coincides with region's start and ends coincides as well when you drag such range it does cut the whole region, but it does not remove it. Process similar to "copy" accures when "cut" operation is expected. --- libs/ardour/audio_playlist.cc | 13 +++++++++++++ libs/ardour/playlist.cc | 23 ++++++++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc index 6ef4ec6454..d34c67ff17 100644 --- a/libs/ardour/audio_playlist.cc +++ b/libs/ardour/audio_playlist.cc @@ -85,6 +85,19 @@ AudioPlaylist::AudioPlaylist (boost::shared_ptr other, fram framecnt_t fade_in = 64; framecnt_t fade_out = 64; + /* coverage will return OverlapStart if the start/end coincides + with the end/start point. we do not add such a region to the new playlist, + so catch this special case. + */ + + if (region->first_frame() >= end) { + continue; + } + + if (region->last_frame() <= start) { + continue; + } + switch (region->coverage (start, end)) { case Evoral::OverlapNone: continue; diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index ff2f524398..204ca5cbdc 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -210,6 +210,19 @@ Playlist::Playlist (boost::shared_ptr other, framepos_t start, f region = *i; + /* coverage will return OverlapStart if the start/end coincides + with the end/start point. we do not add such a region to the new playlist, + so catch this special case. + */ + + if (region->first_frame() >= end) { + continue; + } + + if (region->last_frame() <= start) { + continue; + } + overlap = region->coverage (start, end); switch (overlap) { @@ -914,7 +927,7 @@ Playlist::flush_notifications (bool from_undo) current = *i; - if (current->first_frame() >= start && current->last_frame() < end) { + if (current->first_frame() >= start && current->last_frame() <= end) { if (cutting) { remove_region_internal (current); @@ -923,14 +936,18 @@ Playlist::flush_notifications (bool from_undo) continue; } - /* coverage will return OverlapStart if the start coincides - with the end point. we do not partition such a region, + /* coverage will return OverlapStart if the start/end coincides + with the end/start point. we do not partition such a region, so catch this special case. */ if (current->first_frame() >= end) { continue; } + + if (current->last_frame() <= start) { + continue; + } if ((overlap = current->coverage (start, end)) == Evoral::OverlapNone) { continue;