From 86cb9348e829e61b7c1e324930882af147f504c9 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 27 Dec 2011 19:10:31 +0000 Subject: [PATCH] Hack around one case where satisfying all constraints in a relayer is impossible. git-svn-id: svn://localhost/ardour2/branches/3.0@11096 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/playlist.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index c149ff30cf..1eebafba5a 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -2410,6 +2410,11 @@ Playlist::compute_temporary_layers (RegionList const & relayer_regions) continue; } + DEBUG_TRACE (DEBUG::Layering, "Overlaps to check:\n"); + for (RegionList::iterator j = overlaps_to_check.begin(); j != overlaps_to_check.end(); ++j) { + DEBUG_TRACE (DEBUG::Layering, string_compose ("\t%1\n", (*j)->name())); + } + /* Put *i on our overlaps_to_check_list */ overlaps_to_check.push_back (*i); @@ -2446,6 +2451,14 @@ Playlist::compute_temporary_layers (RegionList const & relayer_regions) next_layer = temporary_layers.get (*j); } + if (next_layer < previous_layer) { + /* If this happens, it means that it's impossible to put *i between overlaps_to_check + in a way that satisfies the current layering rule. So we'll punt and put *i + above previous_layer. + */ + next_layer = DBL_MAX; + } + /* Now we know where *i and overlaps_to_preserve should go: between previous_layer and next_layer. */