52 st.setTempoChange (percentage);
53 st.setPitchSemiTones (0);
91 snprintf (suffix,
sizeof (suffix),
"@%d", (
int) floor (
tsr.
time_fraction * 100.0f));
99 gain_buffer =
new gain_t[bufsize];
100 buffer =
new Sample[bufsize];
105 for (uint32_t i = 0; i < nsrcs.size(); ++i) {
118 this_time = min (bufsize, region->
length() - pos);
125 if ((this_read = region->
master_read_at (buffer, buffer, gain_buffer, pos + region->
position(), this_time)) != this_time) {
135 st.putSamples (buffer, this_read);
137 while ((this_read =
st.receiveSamples (buffer, bufsize)) > 0 && !
tsr.
cancel) {
138 if (asrc->
write (buffer, this_read) != this_read) {
149 while (!
tsr.
cancel && (this_read =
st.receiveSamples (buffer, bufsize)) > 0) {
150 if (asrc->
write (buffer, this_read) != this_read) {
157 }
catch (runtime_error& err) {
158 error <<
_(
"timefx code failure. please notify ardour-developers.") <<
endmsg;
163 new_name = region->
name();
164 at = new_name.find (
'@');
168 if (at != string::npos && at > 2) {
169 new_name = new_name.substr (0, at - 1);
174 ret =
finish (region, nsrcs, new_name);
180 framepos_t alength = (*x)->ancestral_length();
189 start = (
framepos_t) floor (astart + ((astart - (*x)->start()) / stretch));
190 length = (
framecnt_t) floor (alength / stretch);
192 (*x)->set_ancestral_data (start, length, stretch, (*x)->shift());
197 delete [] gain_buffer;
201 for (SourceList::iterator si = nsrcs.begin(); si != nsrcs.end(); ++si) {
202 (*si)->mark_for_remove ();
int make_new_sources(boost::shared_ptr< ARDOUR::Region >, ARDOUR::SourceList &, std::string suffix="")
shared_ptr< T > dynamic_pointer_cast(shared_ptr< U > const &r)
int run(boost::shared_ptr< ARDOUR::Region >)
LIBPBD_API Transmitter error
std::ostream & endmsg(std::ostream &ostr)
LIBARDOUR_API PBD::PropertyDescriptor< framepos_t > start
framecnt_t frame_rate() const
LIBARDOUR_API PBD::PropertyDescriptor< float > stretch
virtual framecnt_t master_read_at(Sample *buf, Sample *mixdown_buf, float *gain_buf, framepos_t position, framecnt_t cnt, uint32_t chan_n=0) const
framepos_t position() const
std::vector< boost::shared_ptr< ARDOUR::Region > > results
uint32_t n_channels() const
virtual framecnt_t write(Sample *src, framecnt_t cnt)
soundtouch::SoundTouch st
framecnt_t length() const
int finish(boost::shared_ptr< ARDOUR::Region >, ARDOUR::SourceList &, std::string region_name="")
std::vector< boost::shared_ptr< Source > > SourceList
std::string string_compose(const std::string &fmt, const T1 &o1)
LIBARDOUR_API PBD::PropertyDescriptor< framecnt_t > length