X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Ffilter.cc;h=96e7cfa3d7664de29035daf2e5dac73111feeb04;hb=5fa05b403ca21a6573d07b921dc14f0769dc9fc7;hp=d782db96f24a1679903f003713f96b9bff17f602;hpb=91fac4c96dc6210dcc056da70dc608700d7eb570;p=ardour.git diff --git a/libs/ardour/filter.cc b/libs/ardour/filter.cc index d782db96f2..96e7cfa3d7 100644 --- a/libs/ardour/filter.cc +++ b/libs/ardour/filter.cc @@ -32,14 +32,14 @@ #include "ardour/smf_source.h" #include "ardour/source_factory.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace std; using namespace ARDOUR; using namespace PBD; int -Filter::make_new_sources (boost::shared_ptr region, SourceList& nsrcs, string suffix) +Filter::make_new_sources (boost::shared_ptr region, SourceList& nsrcs, std::string suffix, bool use_session_sample_rate) { vector names = region->master_source_names(); assert (region->n_channels() <= names.size()); @@ -70,9 +70,22 @@ Filter::make_new_sources (boost::shared_ptr region, SourceList& nsrcs, s } try { + samplecnt_t sample_rate; + if (use_session_sample_rate) { + sample_rate = session.sample_rate(); + } else { + boost::shared_ptr aregion = boost::dynamic_pointer_cast(region); + + if (aregion) { + sample_rate = aregion->audio_source()->sample_rate(); + } else { + return -1; + } + } + nsrcs.push_back (boost::dynamic_pointer_cast ( - SourceFactory::createWritable (region->data_type(), session, - path, false, session.frame_rate()))); + SourceFactory::createWritable (region->data_type(), session, + path, false, sample_rate))); } catch (failed_constructor& err) {