summaryrefslogtreecommitdiff
path: root/libs/ardour/rb_effect.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2008-09-10 21:27:39 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2008-09-10 21:27:39 +0000
commitc86210a9d5bdb7b36ad58552a1f99f53d48781b3 (patch)
tree6ab06935a1e2bc4ef6a4448dd01b09f5b2628c66 /libs/ardour/rb_effect.cc
parent68e943265edf04e63a8e8b8f62bab20f99d9c637 (diff)
merge 2.0-ongoing into 3.0 @ 3581 - 3710
git-svn-id: svn://localhost/ardour2/branches/3.0@3712 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/rb_effect.cc')
-rw-r--r--libs/ardour/rb_effect.cc32
1 files changed, 22 insertions, 10 deletions
diff --git a/libs/ardour/rb_effect.cc b/libs/ardour/rb_effect.cc
index 9d8ac311b7..d0a8a3abbf 100644
--- a/libs/ardour/rb_effect.cc
+++ b/libs/ardour/rb_effect.cc
@@ -60,8 +60,15 @@ RBEffect::~RBEffect ()
}
int
-RBEffect::run (boost::shared_ptr<AudioRegion> region)
+RBEffect::run (boost::shared_ptr<Region> r)
{
+ boost::shared_ptr<AudioRegion> region = boost::dynamic_pointer_cast<AudioRegion> (r);
+
+ if (!region) {
+ error << "RBEffect::run() passed a non-audio region! WTF?" << endmsg;
+ return -1;
+ }
+
SourceList nsrcs;
nframes_t done;
int ret = -1;
@@ -158,9 +165,6 @@ RBEffect::run (boost::shared_ptr<AudioRegion> region)
stretcher.setExpectedInputDuration(read_duration);
stretcher.setDebugLevel(1);
- stretcher.setExpectedInputDuration(duration);
- stretcher.setDebugLevel(1);
-
/* the name doesn't need to be super-precise, but allow for 2 fractional
digits just to disambiguate close but not identical FX
*/
@@ -288,8 +292,12 @@ RBEffect::run (boost::shared_ptr<AudioRegion> region)
for (uint32_t i = 0; i < nsrcs.size(); ++i) {
- if (nsrcs[i]->write(buffers[i], this_read) !=
- this_read) {
+ boost::shared_ptr<AudioSource> asrc = boost::dynamic_pointer_cast<AudioSource>(nsrcs[i]);
+ if (!asrc) {
+ continue;
+ }
+
+ if (asrc->write(buffers[i], this_read) != this_read) {
error << string_compose (_("error writing tempo-adjusted data to %1"), nsrcs[i]->name()) << endmsg;
goto out;
}
@@ -305,7 +313,12 @@ RBEffect::run (boost::shared_ptr<AudioRegion> region)
for (uint32_t i = 0; i < nsrcs.size(); ++i) {
- if (nsrcs[i]->write(buffers[i], this_read) !=
+ boost::shared_ptr<AudioSource> asrc = boost::dynamic_pointer_cast<AudioSource>(nsrcs[i]);
+ if (!asrc) {
+ continue;
+ }
+
+ if (asrc->write(buffers[i], this_read) !=
this_read) {
error << string_compose (_("error writing tempo-adjusted data to %1"), nsrcs[i]->name()) << endmsg;
goto out;
@@ -334,14 +347,13 @@ RBEffect::run (boost::shared_ptr<AudioRegion> region)
/* now reset ancestral data for each new region */
- for (vector<boost::shared_ptr<AudioRegion> >::iterator x = results.begin(); x != results.end(); ++x) {
-
+ for (vector<boost::shared_ptr<Region> >::iterator x = results.begin(); x != results.end(); ++x) {
(*x)->set_ancestral_data (read_start,
read_duration,
stretch,
shift);
- (*x)->set_master_sources (region->get_master_sources());
+ (*x)->set_master_sources (region->master_sources());
}
out: