X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Ffilter.cc;h=eab27b4ce07fcb31359deca6607a088e39d97bd6;hb=7d96960b162d25da87c388a3083775e8770bba56;hp=5922936b85da0815f75763d411353a7999d9ffb5;hpb=d1bc9e330b5b36d1d31af61e057871fc66a98749;p=ardour.git diff --git a/libs/ardour/filter.cc b/libs/ardour/filter.cc index 5922936b85..eab27b4ce0 100644 --- a/libs/ardour/filter.cc +++ b/libs/ardour/filter.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2004-2007 Paul Davis + Copyright (C) 2004-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,6 +29,7 @@ #include "ardour/region_factory.h" #include "ardour/source_factory.h" #include "ardour/analyser.h" +#include "ardour/audioregion.h" #include "i18n.h" @@ -61,7 +62,7 @@ Filter::make_new_sources (boost::shared_ptr region, SourceList& nsrcs, s PBD::basename_nosuffix (names[i]), string ("")); if (path.length() == 0) { - error << string_compose (_("filter: error creating name for new file based on %1"), region->name()) + error << string_compose (_("filter: error creating name for new file based on %1"), region->name()) << endmsg; return -1; } @@ -69,9 +70,8 @@ Filter::make_new_sources (boost::shared_ptr region, SourceList& nsrcs, s try { nsrcs.push_back (boost::dynamic_pointer_cast ( SourceFactory::createWritable (region->data_type(), session, - path, true, - false, session.frame_rate()))); - } + path, false, session.frame_rate()))); + } catch (failed_constructor& err) { error << string_compose (_("filter: error creating new file %1 (%2)"), path, strerror (errno)) << endmsg; @@ -97,18 +97,19 @@ Filter::finish (boost::shared_ptr region, SourceList& nsrcs, string regi for (SourceList::iterator si = nsrcs.begin(); si != nsrcs.end(); ++si) { boost::shared_ptr afs = boost::dynamic_pointer_cast(*si); if (afs) { + afs->done_with_peakfile_writes (); afs->update_header (region->position(), *now, xnow); afs->mark_immutable (); } - + boost::shared_ptr smfs = boost::dynamic_pointer_cast(*si); if (smfs) { smfs->set_timeline_position (region->position()); smfs->flush (); } - + /* now that there is data there, requeue the file for analysis */ - + Analyser::queue_source_for_analysis (*si, false); } @@ -118,9 +119,22 @@ Filter::finish (boost::shared_ptr region, SourceList& nsrcs, string regi region_name = session.new_region_name (region->name()); } results.clear (); - results.push_back (RegionFactory::create (nsrcs, 0, region->length(), region_name, 0, - Region::Flag (Region::WholeFile|Region::DefaultFlags))); - + + boost::shared_ptr r = RegionFactory::create (nsrcs, 0, region->length(), region_name, 0, + Region::Flag (Region::WholeFile|Region::DefaultFlags)); + r->set_position (region->position(), 0); + + boost::shared_ptr audio_region = boost::dynamic_pointer_cast (region); + boost::shared_ptr audio_r = boost::dynamic_pointer_cast (r); + if (audio_region && audio_r) { + audio_r->set_scale_amplitude (audio_region->scale_amplitude()); + audio_r->set_fade_in_active (audio_region->fade_in_active ()); + audio_r->set_fade_in (audio_region->fade_in ()); + audio_r->set_fade_out_active (audio_region->fade_out_active ()); + audio_r->set_fade_out (audio_region->fade_out ()); + } + results.push_back (r); + return 0; }