From c86210a9d5bdb7b36ad58552a1f99f53d48781b3 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 10 Sep 2008 21:27:39 +0000 Subject: merge 2.0-ongoing into 3.0 @ 3581 - 3710 git-svn-id: svn://localhost/ardour2/branches/3.0@3712 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/rb_effect.cc | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'libs/ardour/rb_effect.cc') 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 region) +RBEffect::run (boost::shared_ptr r) { + boost::shared_ptr region = boost::dynamic_pointer_cast (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 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 region) for (uint32_t i = 0; i < nsrcs.size(); ++i) { - if (nsrcs[i]->write(buffers[i], this_read) != - this_read) { + boost::shared_ptr asrc = boost::dynamic_pointer_cast(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 region) for (uint32_t i = 0; i < nsrcs.size(); ++i) { - if (nsrcs[i]->write(buffers[i], this_read) != + boost::shared_ptr asrc = boost::dynamic_pointer_cast(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 region) /* now reset ancestral data for each new region */ - for (vector >::iterator x = results.begin(); x != results.end(); ++x) { - + for (vector >::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: -- cgit v1.2.3