Fix up gain envelope handling with region split. Fixes #3306.

git-svn-id: svn://localhost/ardour2/branches/3.0@7510 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-07-27 02:11:15 +00:00
parent 4977924a6e
commit b1e535570c
3 changed files with 15 additions and 10 deletions

View file

@ -160,8 +160,10 @@ AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other, nframes64_
, _automatable (other->session())
, _fade_in (new AutomationList (*other->_fade_in))
, _fade_out (new AutomationList (*other->_fade_out))
/* XXX is this guaranteed to work for all values of offset+offset_relative? */
, _envelope (new AutomationList (*other->_envelope, _start, _start + _length))
/* As far as I can see, the _envelope's times are relative to region position, and have nothing
to do with sources (and hence _start). So when we copy the envelope, we just use the supplied offset.
*/
, _envelope (new AutomationList (*other->_envelope, offset, other->_length))
, _fade_in_suspended (0)
, _fade_out_suspended (0)
{

View file

@ -1401,12 +1401,15 @@ Playlist::_split_region (boost::shared_ptr<Region> region, framepos_t playlist_p
{
PropertyList plist;
plist.add (Properties::start, region->start());
plist.add (Properties::length, before);
plist.add (Properties::name, before_name);
plist.add (Properties::left_of_split, true);
left = RegionFactory::create (region, plist);
/* note: we must use the version of ::create with an offset here,
since it supplies that offset to the Region constructor, which
is necessary to get audio region gain envelopes right.
*/
left = RegionFactory::create (region, 0, plist);
}
RegionFactory::region_name (after_name, region->name(), false);
@ -1414,12 +1417,12 @@ Playlist::_split_region (boost::shared_ptr<Region> region, framepos_t playlist_p
{
PropertyList plist;
plist.add (Properties::start, region->start() + before);
plist.add (Properties::length, after);
plist.add (Properties::name, after_name);
plist.add (Properties::right_of_split, true);
right = RegionFactory::create (region, plist);
/* same note as above */
right = RegionFactory::create (region, before, plist);
}
add_region_internal (left, region->position());

View file

@ -247,10 +247,10 @@ Region::Region (const SourceList& srcs)
/** Create a new Region from part of an existing one, starting at one of two places:
if @param offset_relative is true, then the start within @param other is given by @param offset
(i.e. relative to the start of @param other's sources, the start is @param offset + @param other.start()
if \a offset_relative is true, then the start within \a other is given by \a offset
(i.e. relative to the start of \a other's sources, the start is \a offset + \a other.start()
if @param offset_relative is false, then the start within the source is given @param offset.
if @param offset_relative is false, then the start within the source is given \a offset.
*/
Region::Region (boost::shared_ptr<const Region> other, frameoffset_t offset, bool offset_relative)
: SessionObject(other->session(), other->name())