summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-05-19 16:40:05 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-05-19 16:40:05 +0000
commitb7e3d203024950de03b68bcd3101651941bcaf7e (patch)
tree52843c47b954f3430230d0ffaaf980e1d984473b /libs
parent6beff737fe50ca79b0903a8296d2c2771df52457 (diff)
prevent xfades from being dragged to a longer length than the region that owns them
git-svn-id: svn://localhost/ardour2/branches/3.0@12332 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/audioregion.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc
index 33a81c4f27..8ace0a9940 100644
--- a/libs/ardour/audioregion.cc
+++ b/libs/ardour/audioregion.cc
@@ -1875,12 +1875,20 @@ AudioRegion::get_single_other_xfade_region (bool start) const
framecnt_t
AudioRegion::verify_xfade_bounds (framecnt_t len, bool start)
{
+ /* this is called from a UI to check on whether a new proposed
+ length for an xfade is legal or not. it returns the legal
+ length corresponding to @a len which may be shorter than or
+ equal to @a len itself.
+ */
+
boost::shared_ptr<Region> other = get_single_other_xfade_region (start);
framecnt_t maxlen;
if (!other) {
- /* zero or > 2 regions here, don't care about len */
- return len;
+ /* zero or > 2 regions here, don't care about len, but
+ it can't be longer than the region itself.
+ */
+ return min (length(), len);
}
/* we overlap a single region. clamp the length of an xfade to
@@ -1894,7 +1902,7 @@ AudioRegion::verify_xfade_bounds (framecnt_t len, bool start)
maxlen = last_frame() - other->earliest_possible_position();
}
- return min (maxlen, len);
+ return min (length(), min (maxlen, len));
}