diff options
-rw-r--r-- | gtk2_ardour/region_view.cc | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/playlist.h | 1 | ||||
-rw-r--r-- | libs/ardour/playlist.cc | 33 |
3 files changed, 34 insertions, 2 deletions
diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc index e79a7134af..aa7005e9c0 100644 --- a/gtk2_ardour/region_view.cc +++ b/gtk2_ardour/region_view.cc @@ -616,7 +616,7 @@ RegionView::update_coverage_frames (LayerDisplay d) t++; /* is this region is on top at time t? */ - bool const new_me = (pl->top_region_at (t) == _region); + bool const new_me = (pl->top_unmuted_region_at (t) == _region); /* finish off any old rect, if required */ if (cr && me != new_me) { diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h index 1018419c26..6778a70f53 100644 --- a/libs/ardour/ardour/playlist.h +++ b/libs/ardour/ardour/playlist.h @@ -114,6 +114,7 @@ class Playlist : public SessionObject, RegionList* regions_to_read (nframes_t start, nframes_t end); boost::shared_ptr<Region> find_region (const PBD::ID&) const; boost::shared_ptr<Region> top_region_at (nframes_t frame); + boost::shared_ptr<Region> top_unmuted_region_at (nframes_t frame); boost::shared_ptr<Region> find_next_region (nframes_t frame, RegionPoint point, int dir); nframes64_t find_next_region_boundary (nframes64_t frame, int dir); bool region_is_shuffle_constrained (boost::shared_ptr<Region>); diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index f74eb1001f..94e6e421bd 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -1418,7 +1418,38 @@ Playlist::top_region_at (nframes_t frame) delete rlist; return region; -} +} + +boost::shared_ptr<Region> +Playlist::top_unmuted_region_at (nframes_t frame) + +{ + RegionLock rlock (this); + RegionList *rlist = find_regions_at (frame); + + for (RegionList::iterator i = rlist->begin(); i != rlist->end(); ) { + + RegionList::iterator tmp = i; + ++tmp; + + if ((*i)->muted()) { + rlist->erase (i); + } + + i = tmp; + } + + boost::shared_ptr<Region> region; + + if (rlist->size()) { + RegionSortByLayer cmp; + rlist->sort (cmp); + region = rlist->back(); + } + + delete rlist; + return region; +} Playlist::RegionList* Playlist::regions_to_read (nframes_t start, nframes_t end) |