summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-04-26 00:23:40 +0000
committerCarl Hetherington <carl@carlh.net>2010-04-26 00:23:40 +0000
commita4917c9831f42b68bce3414244c14300b92bbb76 (patch)
treeee1e913f19e0cbb6ee494e4ecea914d16693a36d /libs
parented9d42c55d4d8b40ed82470ddfe110355a9eca61 (diff)
Preserve gain envelopes across filtering operations and stretch them across time stretches. Fixes #902.
git-svn-id: svn://localhost/ardour2/branches/3.0@6989 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/filter.cc1
-rw-r--r--libs/ardour/rb_effect.cc12
2 files changed, 12 insertions, 1 deletions
diff --git a/libs/ardour/filter.cc b/libs/ardour/filter.cc
index 44e7f11cbd..2bbeecf37e 100644
--- a/libs/ardour/filter.cc
+++ b/libs/ardour/filter.cc
@@ -138,6 +138,7 @@ Filter::finish (boost::shared_ptr<Region> region, SourceList& nsrcs, string regi
audio_r->set_fade_in (audio_region->fade_in ());
audio_r->set_fade_out_active (audio_region->fade_out_active ());
audio_r->set_fade_out (audio_region->fade_out ());
+ *(audio_r->envelope()) = *(audio_region->envelope ());
}
results.push_back (r);
diff --git a/libs/ardour/rb_effect.cc b/libs/ardour/rb_effect.cc
index 4cb77d1c58..60764c1220 100644
--- a/libs/ardour/rb_effect.cc
+++ b/libs/ardour/rb_effect.cc
@@ -80,7 +80,8 @@ RBEffect::run (boost::shared_ptr<Region> r)
string::size_type at;
nframes_t pos = 0;
int avail = 0;
-
+ boost::shared_ptr<AudioRegion> result;
+
cerr << "RBEffect: source region: position = " << region->position()
<< ", start = " << region->start()
<< ", length = " << region->length()
@@ -357,6 +358,15 @@ RBEffect::run (boost::shared_ptr<Region> r)
(*x)->set_length( (*x)->length() * stretch, this);
}
+ /* stretch region gain envelope */
+ /* XXX: assuming we've only processed one input region into one result here */
+
+ if (tsr.time_fraction != 1) {
+ result = boost::dynamic_pointer_cast<AudioRegion> (results.front());
+ assert (result);
+ result->envelope()->x_scale (tsr.time_fraction);
+ }
+
out:
delete [] gain_buffer;