summaryrefslogtreecommitdiff
path: root/libs/ardour/region.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-05-10 18:17:47 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-05-10 18:17:47 +0000
commit6e6b3d325bffe5b654f94cb3ef91c829786bc7a5 (patch)
tree758b387ea5fbed971660a8a166d5a87ee3778058 /libs/ardour/region.cc
parent916202ea649fbc430b63afa3e93efde20c52de8a (diff)
trim a single other region when adjusting xfade length
git-svn-id: svn://localhost/ardour2/branches/3.0@12241 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/region.cc')
-rw-r--r--libs/ardour/region.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc
index efaa104d35..a4a1584792 100644
--- a/libs/ardour/region.cc
+++ b/libs/ardour/region.cc
@@ -1654,3 +1654,33 @@ Region::set_start_internal (framecnt_t s)
{
_start = s;
}
+
+framepos_t
+Region::earliest_possible_position () const
+{
+ if (_start > _position) {
+ return 0;
+ } else {
+ return _position - _start;
+ }
+}
+
+framecnt_t
+Region::latest_possible_frame () const
+{
+ framecnt_t minlen = max_framecnt;
+
+ for (SourceList::const_iterator i = _sources.begin(); i != _sources.end(); ++i) {
+ /* non-audio regions have a length that may vary based on their
+ * position, so we have to pass it in the call.
+ */
+ minlen = min (minlen, (*i)->length (_position));
+ }
+
+ /* the latest possible last frame is determined by the current
+ * position, plus the shortest source extent past _start.
+ */
+
+ return _position + (minlen - _start) - 1;
+}
+