summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-07-27 02:11:15 +0000
committerCarl Hetherington <carl@carlh.net>2010-07-27 02:11:15 +0000
commitb1e535570c0dff1827d74b044e8dd7b621d7e050 (patch)
tree3f3eea233c41efca01155ef61d2092537416d623
parent4977924a6e0914f40adfb3d66b714045188a877d (diff)
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
-rw-r--r--libs/ardour/audioregion.cc6
-rw-r--r--libs/ardour/playlist.cc13
-rw-r--r--libs/ardour/region.cc6
3 files changed, 15 insertions, 10 deletions
diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc
index 8c66591fa7..f0219ce729 100644
--- a/libs/ardour/audioregion.cc
+++ b/libs/ardour/audioregion.cc
@@ -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)
{
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc
index e55b82c06b..8ea84b96bf 100644
--- a/libs/ardour/playlist.cc
+++ b/libs/ardour/playlist.cc
@@ -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());
diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc
index 6dc090ce3c..234dddcc45 100644
--- a/libs/ardour/region.cc
+++ b/libs/ardour/region.cc
@@ -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())