diff options
author | Carl Hetherington <carl@carlh.net> | 2010-11-14 15:01:53 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-11-14 15:01:53 +0000 |
commit | a46af0460b0fdcc145c4dd282fa4fe071d4971fc (patch) | |
tree | 81a1a2f4c779958df0f19d976e6cfd003afea5eb /libs/ardour/playlist.cc | |
parent | 7a25fa1beb76b7148d4f96de5629d8b639aac9e7 (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.cc | 24 |
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; +} |