diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-02-02 20:11:35 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-02-02 20:11:35 +0000 |
commit | 58c2facb6a34c8a39e7f33bc87f8384c6b435975 (patch) | |
tree | 538a6f075ec6079435d73310fc24f065b8e479c7 | |
parent | d5d45ceca34e7a0c290dabc3bb25b6493d3e370d (diff) |
fix loss of end of region when split-at-points is done
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2996 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 3410c8195d..c37b7c0dbd 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -5119,7 +5119,7 @@ Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList AnalysisFeatureList::const_iterator x; nframes64_t pos = ar->position(); - + XMLNode& before (pl->get_state()); x = positions.begin(); @@ -5137,7 +5137,7 @@ Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList pl->freeze (); pl->remove_region (ar); - do { + while (x != positions.end()) { /* file start = original start + how far we from the initial position ? */ @@ -5148,6 +5148,14 @@ Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList */ nframes64_t len = (*x) - pos; + + /* XXX we do we really want to allow even single-sample regions? + shouldn't we have some kind of lower limit on region size? + */ + + if (len <= 0) { + break; + } string new_name; @@ -5158,11 +5166,13 @@ Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList pl->add_region (RegionFactory::create (ar->get_sources(), file_start, len, new_name), pos); pos += len; - ++x; - - } while (x != positions.end() && (*x) < ar->last_frame()); - + + if (*x > ar->last_frame()) { + break; + } + } + pl->thaw (); XMLNode& after (pl->get_state()); |