summaryrefslogtreecommitdiff
path: root/libs/ardour/playlist.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-11-14 15:01:53 +0000
committerCarl Hetherington <carl@carlh.net>2010-11-14 15:01:53 +0000
commita46af0460b0fdcc145c4dd282fa4fe071d4971fc (patch)
tree81a1a2f4c779958df0f19d976e6cfd003afea5eb /libs/ardour/playlist.cc
parent7a25fa1beb76b7148d4f96de5629d8b639aac9e7 (diff)
Create a new layer if required on record to a track in stacked mode. Fixes #3391.
git-svn-id: svn://localhost/ardour2/branches/3.0@8026 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/playlist.cc')
-rw-r--r--libs/ardour/playlist.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc
index e462bceb10..971ed8b2e8 100644
--- a/libs/ardour/playlist.cc
+++ b/libs/ardour/playlist.cc
@@ -2981,3 +2981,27 @@ Playlist::remove_region_by_source (boost::shared_ptr<Source> s)
i = j;
}
}
+
+/** Look from a session frame time and find the start time of the next region
+ * which is on the top layer of this playlist.
+ * @param t Time to look from.
+ * @return Position of next top-layered region, or max_framepos if there isn't one.
+ */
+framepos_t
+Playlist::find_next_top_layer_position (framepos_t t) const
+{
+ RegionLock rlock (const_cast<Playlist *> (this));
+
+ layer_t const top = top_layer ();
+
+ RegionList copy = regions.rlist ();
+ copy.sort (RegionSortByPosition ());
+
+ for (RegionList::const_iterator i = copy.begin(); i != copy.end(); ++i) {
+ if ((*i)->position() >= t && (*i)->layer() == top) {
+ return (*i)->position();
+ }
+ }
+
+ return max_framepos;
+}