, _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)
{
{
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);
{
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());
/** 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())