#include <ardour/audioregion.h>
#include <ardour/sndfilesource.h>
#include <ardour/region_factory.h>
+#include <ardour/source_factory.h>
#include "i18n.h"
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.
}
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<AudioFileSource> (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;
}
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);
xnow = localtime (&now);
for (it = sources.begin(); it != sources.end(); ++it) {
- AudioFileSource* afs = dynamic_cast<AudioFileSource*>(*it);
+ boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource>(*it);
if (afs) {
afs->update_header (tsr.region->position(), *xnow, now);
}
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 */