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
This commit is contained in:
Paul Davis 2012-05-19 16:40:05 +00:00
parent 6beff737fe
commit b7e3d20302

View File

@ -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));
}