X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Frb_effect.cc;h=804b79f87df9e8a555adcbe56bb0a844279e5f8e;hb=5f00d2f3a7afaccaeb9f3057d55d5e1e59c54e47;hp=6b1dbdec93d65e700fb9d8dc8b9d324eaa50f768;hpb=d4d5b30aebb8a54358bfb203c84cfd641bff79f3;p=ardour.git diff --git a/libs/ardour/rb_effect.cc b/libs/ardour/rb_effect.cc index 6b1dbdec93..804b79f87d 100644 --- a/libs/ardour/rb_effect.cc +++ b/libs/ardour/rb_effect.cc @@ -20,15 +20,17 @@ #include #include +#include + #include "pbd/error.h" -#include "rubberband/RubberBandStretcher.h" -#include "ardour/types.h" -#include "ardour/stretch.h" +#include "ardour/audioregion.h" +#include "ardour/audiosource.h" #include "ardour/pitch.h" -#include "ardour/audiofilesource.h" +#include "ardour/progress.h" #include "ardour/session.h" -#include "ardour/audioregion.h" +#include "ardour/stretch.h" +#include "ardour/types.h" #include "i18n.h" @@ -52,7 +54,7 @@ RBEffect::RBEffect (Session& s, TimeFXRequest& req) , tsr (req) { - tsr.progress = 0.0f; + } RBEffect::~RBEffect () @@ -60,7 +62,7 @@ RBEffect::~RBEffect () } int -RBEffect::run (boost::shared_ptr r, Progress*) +RBEffect::run (boost::shared_ptr r, Progress* progress) { boost::shared_ptr region = boost::dynamic_pointer_cast (r); @@ -81,7 +83,7 @@ RBEffect::run (boost::shared_ptr r, Progress*) framepos_t pos = 0; framecnt_t avail = 0; boost::shared_ptr result; - + cerr << "RBEffect: source region: position = " << region->position() << ", start = " << region->start() << ", length = " << region->length() @@ -160,7 +162,7 @@ RBEffect::run (boost::shared_ptr r, Progress*) (session.frame_rate(), channels, (RubberBandStretcher::Options) tsr.opts, stretch, shift); - tsr.progress = 0.0f; + progress->set_progress (0); tsr.done = false; stretcher.setExpectedInputDuration(read_duration); @@ -238,7 +240,7 @@ RBEffect::run (boost::shared_ptr r, Progress*) pos += this_read; done += this_read; - tsr.progress = ((float) done / read_duration) * 0.25; + progress->set_progress (((float) done / read_duration) * 0.25); stretcher.study(buffers, this_read, pos == read_duration); } @@ -279,7 +281,7 @@ RBEffect::run (boost::shared_ptr r, Progress*) pos += this_read; done += this_read; - tsr.progress = 0.25 + ((float) done / read_duration) * 0.75; + progress->set_progress (0.25 + ((float) done / read_duration) * 0.75); stretcher.process(buffers, this_read, pos == read_duration); @@ -328,7 +330,7 @@ RBEffect::run (boost::shared_ptr r, Progress*) } } catch (runtime_error& err) { - error << _("timefx code failure. please notify ardour-developers.") << endmsg; + error << string_compose (_("programming error: %1"), X_("timefx code failure")) << endmsg; error << err.what() << endmsg; goto out; } @@ -355,7 +357,10 @@ RBEffect::run (boost::shared_ptr r, Progress*) stretch, shift); (*x)->set_master_sources (region->master_sources()); - (*x)->set_length( (*x)->length() * stretch); + /* multiply the old (possibly previously stretched) region length by the extra + stretch this time around to get its new length + */ + (*x)->set_length ((*x)->length() * tsr.time_fraction); } /* stretch region gain envelope */ @@ -384,8 +389,6 @@ RBEffect::run (boost::shared_ptr r, Progress*) } } - tsr.done = true; - return ret; }