#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"
, tsr (req)
{
- tsr.progress = 0.0f;
+
}
RBEffect::~RBEffect ()
}
int
-RBEffect::run (boost::shared_ptr<Region> r, Progress*)
+RBEffect::run (boost::shared_ptr<Region> r, Progress* progress)
{
boost::shared_ptr<AudioRegion> region = boost::dynamic_pointer_cast<AudioRegion> (r);
framepos_t pos = 0;
framecnt_t avail = 0;
boost::shared_ptr<AudioRegion> result;
-
+
cerr << "RBEffect: source region: position = " << region->position()
<< ", start = " << region->start()
<< ", length = " << region->length()
(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);
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);
}
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);
stretch,
shift);
(*x)->set_master_sources (region->master_sources());
- (*x)->set_length( (*x)->length() * stretch, this);
+ /* 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 */
}
}
- tsr.done = true;
-
return ret;
}