X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fsession_timefx.cc;h=d7274388aab35af77bf0968351deed9e2adbbe2c;hb=1bd4c5b3a212460eed1773f6b049d18c89625565;hp=2b6b45dad0287a2d8de51e0199c4c29cbd9d9a46;hpb=ce234f363e95c38fc92728e520bf5ba240a89aa7;p=ardour.git diff --git a/libs/ardour/session_timefx.cc b/libs/ardour/session_timefx.cc index 2b6b45dad0..d7274388aa 100644 --- a/libs/ardour/session_timefx.cc +++ b/libs/ardour/session_timefx.cc @@ -29,6 +29,7 @@ #include #include #include +#include #include "i18n.h" @@ -47,8 +48,8 @@ Session::tempoize_region (TimeStretchRequest& tsr) string region_name; string ident = X_("-TIMEFX-"); float percentage; - jack_nframes_t total_frames; - jack_nframes_t done; + nframes_t total_frames; + nframes_t done; /* the soundtouch code wants a *tempo* change percentage, which is of opposite sign to the length change. @@ -81,10 +82,8 @@ Session::tempoize_region (TimeStretchRequest& tsr) } try { - sources.push_back (new SndFileSource (path, - Config->get_native_file_data_format(), - Config->get_native_file_header_format(), - frame_rate())); + sources.push_back (boost::dynamic_pointer_cast (SourceFactory::createWritable (*this, path, false, frame_rate()))); + } catch (failed_constructor& err) { error << string_compose (_("tempoize: error creating new audio file %1 (%2)"), path, strerror (errno)) << endmsg; goto out; @@ -92,17 +91,17 @@ Session::tempoize_region (TimeStretchRequest& tsr) } try { - const jack_nframes_t bufsize = 16384; + const nframes_t bufsize = 16384; for (uint32_t i = 0; i < sources.size(); ++i) { gain_t gain_buffer[bufsize]; Sample buffer[bufsize]; - jack_nframes_t pos = 0; - jack_nframes_t this_read = 0; + nframes_t pos = 0; + nframes_t this_read = 0; st.clear(); while (tsr.running && pos < tsr.region->length()) { - jack_nframes_t this_time; + nframes_t this_time; this_time = min (bufsize, tsr.region->length() - pos); @@ -153,7 +152,7 @@ Session::tempoize_region (TimeStretchRequest& tsr) xnow = localtime (&now); for (it = sources.begin(); it != sources.end(); ++it) { - AudioFileSource* afs = dynamic_cast(*it); + boost::shared_ptr afs = boost::dynamic_pointer_cast(*it); if (afs) { afs->update_header (tsr.region->position(), *xnow, now); } @@ -175,9 +174,10 @@ Session::tempoize_region (TimeStretchRequest& tsr) if ((!r || !tsr.running)) { for (it = sources.begin(); it != sources.end(); ++it) { (*it)->mark_for_remove (); - delete *it; } } + + sources.clear (); } /* if the process was cancelled, delete the region */