From 46f61d76626a2efbbc546ec09b6d4992925d3ca1 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 28 Sep 2024 21:14:52 +0200 Subject: [PATCH] Fix and simplify Playlist::fade_range for multiple ranges --- libs/ardour/playlist.cc | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 4b78a677d6..e4894f653c 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -3413,17 +3413,14 @@ Playlist::fade_range (list& ranges) { ThawList thawlist; RegionReadLock rlock (this); - for (list::iterator r = ranges.begin(); r != ranges.end(); ) { - list::iterator tmpr = r; - ++tmpr; - for (RegionList::const_iterator i = regions.begin (); i != regions.end ();) { - RegionList::const_iterator tmpi = i; - ++tmpi; - thawlist.add (*i); - (*i)->fade_range ((*r).start().samples(), (*r).end().samples()); - i = tmpi; + /* add regions only once, not for each range */ + for (auto const& r : regions) { + thawlist.add (r); + } + for (auto const& t: ranges) { + for (auto const& r : regions) { + r->fade_range (t.start().samples(), t.end().samples()); } - r = tmpr; } rlock.release (); thawlist.release ();