diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2015-05-12 10:25:13 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-06-29 14:18:12 -0400 |
commit | 4a27a8b531af152ea97d3710a2ef09ff37bb03a9 (patch) | |
tree | f92574f9638849f17c4dcf01524826f1be328293 /libs/ardour/filter.cc | |
parent | f11645528089bca423bd9594f918b95783c68dd6 (diff) |
when creating new sources for a non-realtime Filter process, add option to use the same SR as the initial sources
Diffstat (limited to 'libs/ardour/filter.cc')
-rw-r--r-- | libs/ardour/filter.cc | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/libs/ardour/filter.cc b/libs/ardour/filter.cc index d782db96f2..382e6d9d86 100644 --- a/libs/ardour/filter.cc +++ b/libs/ardour/filter.cc @@ -39,7 +39,7 @@ using namespace ARDOUR; using namespace PBD; int -Filter::make_new_sources (boost::shared_ptr<Region> region, SourceList& nsrcs, string suffix) +Filter::make_new_sources (boost::shared_ptr<Region> region, SourceList& nsrcs, std::string suffix, bool use_session_sample_rate) { vector<string> names = region->master_source_names(); assert (region->n_channels() <= names.size()); @@ -70,11 +70,24 @@ Filter::make_new_sources (boost::shared_ptr<Region> region, SourceList& nsrcs, s } try { + framecnt_t sample_rate; + if (use_session_sample_rate) { + sample_rate = session.frame_rate(); + } else { + boost::shared_ptr<AudioRegion> aregion = boost::dynamic_pointer_cast<AudioRegion>(region); + + if (aregion) { + sample_rate = aregion->audio_source()->sample_rate(); + } else { + return -1; + } + } + nsrcs.push_back (boost::dynamic_pointer_cast<Source> ( - 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) { error << string_compose (_("filter: error creating new file %1 (%2)"), path, strerror (errno)) << endmsg; return -1; |