fast region export -- don't call process()

This commit is contained in:
Robin Gareus 2016-10-17 21:34:40 +02:00
parent 551eea452b
commit 3e32a00a52
4 changed files with 46 additions and 16 deletions

View file

@ -725,7 +725,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
boost::shared_ptr<ExportHandler> get_export_handler ();
boost::shared_ptr<ExportStatus> 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<int, framecnt_t> ProcessExport;
static PBD::Signal2<void,std::string, std::string> 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;

View file

@ -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

View file

@ -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)

View file

@ -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 */
process_without_events (nframes);
} else if (_realtime_export) {
fail_roll (nframes); // somehow we need to silence _ALL_ output buffers
}
/* do the usual stuff */
process_without_events (nframes);
} else if (_realtime_export) {
fail_roll (nframes); // somehow we need to silence _ALL_ output buffers
}
try {