From 3e32a00a52908ab034c55ec4adb705165e3a54d8 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 17 Oct 2016 21:34:40 +0200 Subject: fast region export -- don't call process() --- libs/ardour/ardour/session.h | 3 ++- libs/ardour/export_handler.cc | 15 ++++++++++++++- libs/ardour/session.cc | 1 + libs/ardour/session_export.cc | 41 ++++++++++++++++++++++++++++------------- 4 files changed, 45 insertions(+), 15 deletions(-) diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index a156a4243c..d76c65c675 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -725,7 +725,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop boost::shared_ptr get_export_handler (); boost::shared_ptr get_export_status (); - int start_audio_export (framepos_t position, bool realtime = false); + int start_audio_export (framepos_t position, bool realtime = false, bool region_export = false); PBD::Signal1 ProcessExport; static PBD::Signal2 Exported; @@ -1283,6 +1283,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop bool _exporting; bool _export_rolling; bool _realtime_export; + bool _region_export; framepos_t _export_preroll; framepos_t _export_latency; diff --git a/libs/ardour/export_handler.cc b/libs/ardour/export_handler.cc index ac2f7b0bd3..3bdfdc9090 100644 --- a/libs/ardour/export_handler.cc +++ b/libs/ardour/export_handler.cc @@ -191,19 +191,32 @@ ExportHandler::start_timespan () graph_builder->set_current_timespan (current_timespan); handle_duplicate_format_extensions(); bool realtime = current_timespan->realtime (); + bool region_export = true; for (ConfigMap::iterator it = timespan_bounds.first; it != timespan_bounds.second; ++it) { // Filenames can be shared across timespans FileSpec & spec = it->second; spec.filename->set_timespan (it->first); + switch (spec.channel_config->region_processing_type ()) { + case RegionExportChannelFactory::None: + case RegionExportChannelFactory::Processed: + region_export = false; + break; + default: + break; + } graph_builder->add_config (spec, realtime); } + // ExportDialog::update_realtime_selection does not allow this + assert (!region_export || !realtime); + /* start export */ post_processing = false; session.ProcessExport.connect_same_thread (process_connection, boost::bind (&ExportHandler::process, this, _1)); process_position = current_timespan->get_start(); - session.start_audio_export (process_position, realtime); + // TODO check if it's a RegionExport.. set flag to skip process_without_events() + session.start_audio_export (process_position, realtime, region_export); } void diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index ce86483d75..f89440b86a 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -213,6 +213,7 @@ Session::Session (AudioEngine &eng, , _exporting (false) , _export_rolling (false) , _realtime_export (false) + , _region_export (false) , _export_preroll (0) , _export_latency (0) , _pre_export_mmc_enabled (false) diff --git a/libs/ardour/session_export.cc b/libs/ardour/session_export.cc index 463f504411..23172838d0 100644 --- a/libs/ardour/session_export.cc +++ b/libs/ardour/session_export.cc @@ -104,15 +104,19 @@ Session::pre_export () /** Called for each range that is being exported */ int -Session::start_audio_export (framepos_t position, bool realtime) +Session::start_audio_export (framepos_t position, bool realtime, bool region_export) { if (!_exporting) { pre_export (); } _realtime_export = realtime; + _region_export = region_export; - if (realtime) { + if (region_export) { + _export_preroll = 0; + } + else if (realtime) { _export_preroll = nominal_frame_rate (); } else { _export_preroll = Config->get_export_preroll() * nominal_frame_rate (); @@ -134,6 +138,10 @@ Session::start_audio_export (framepos_t position, bool realtime) */ _export_latency = worst_track_latency (); + if (region_export) { + _export_latency = 0; + } + /* We're about to call Track::seek, so the butler must have finished everything up otherwise it could be doing do_refill in its thread while we are doing it here. @@ -197,19 +205,26 @@ Session::process_export (pframes_t nframes) stop_audio_export (); } - if (_export_rolling) { - if (!_realtime_export) { - /* make sure we've caught up with disk i/o, since - * we're running faster than realtime c/o JACK. - */ - _butler->wait_until_finished (); - } + /* for Region Raw or Fades, we can skip this + * RegionExportChannelFactory::update_buffers() does not care + * about anything done here + */ + if (!_region_export) { + if (_export_rolling) { + if (!_realtime_export) { + /* make sure we've caught up with disk i/o, since + * we're running faster than realtime c/o JACK. + */ + _butler->wait_until_finished (); + } - /* do the usual stuff */ + /* do the usual stuff */ - process_without_events (nframes); - } else if (_realtime_export) { - fail_roll (nframes); // somehow we need to silence _ALL_ output buffers + process_without_events (nframes); + + } else if (_realtime_export) { + fail_roll (nframes); // somehow we need to silence _ALL_ output buffers + } } try { -- cgit v1.2.3