summaryrefslogtreecommitdiff
path: root/libs/ardour/session_export.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-09-26 17:49:24 +0200
committerRobin Gareus <robin@gareus.org>2017-09-29 05:03:48 +0200
commit24ec0b974d84df061cbbe645668dc62fa7120678 (patch)
treece9274b55976d535ace89ba9e8781cef1b778b66 /libs/ardour/session_export.cc
parenta6cc58d7574ba03f0f8860e130fc4bdef305d3f3 (diff)
Properly aligned export (Stem + Session)
Delay ports being exported by their playback latency.
Diffstat (limited to 'libs/ardour/session_export.cc')
-rw-r--r--libs/ardour/session_export.cc42
1 files changed, 13 insertions, 29 deletions
diff --git a/libs/ardour/session_export.cc b/libs/ardour/session_export.cc
index 33ede3cadc..879f34020a 100644
--- a/libs/ardour/session_export.cc
+++ b/libs/ardour/session_export.cc
@@ -104,7 +104,7 @@ Session::pre_export ()
/** Called for each range that is being exported */
int
-Session::start_audio_export (samplepos_t position, bool realtime, bool region_export, bool comensate_master_latency)
+Session::start_audio_export (samplepos_t position, bool realtime, bool region_export)
{
if (!_exporting) {
pre_export ();
@@ -127,31 +127,6 @@ Session::start_audio_export (samplepos_t position, bool realtime, bool region_ex
_export_preroll = 1;
}
- /* "worst_track_latency" is the correct value for stem-exports
- * see to Route::add_export_point(),
- *
- * For master-bus export, we also need to add the master's latency.
- * (or actually longest-total-session-latency - worst-track-latency)
- * to align the export to 00:00:00:00.
- *
- * We must not use worst_playback_latency because that
- * includes external (hardware) latencies and would overcompensate
- * during file-export.
- *
- * (this is all still very [w]hacky. Individual Bus and Track outputs
- * are not aligned but one can select them in the PortExportChannelSelector)
- */
- _export_latency = worst_track_out_latency ();
-
- boost::shared_ptr<Route> master = master_out ();
- if (master && comensate_master_latency) {
- _export_latency += master->signal_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.
@@ -181,6 +156,12 @@ Session::start_audio_export (samplepos_t position, bool realtime, bool region_ex
*/
_transport_sample = position;
+
+ if (!region_export) {
+ _remaining_latency_preroll = worst_latency_preroll ();
+ } else {
+ _remaining_latency_preroll = 0;
+ }
export_status->stop = false;
/* get transport ready. note how this is calling butler functions
@@ -277,18 +258,21 @@ Session::process_export_fw (pframes_t nframes)
return;
}
- if (_export_latency > 0) {
- samplepos_t remain = std::min ((samplepos_t)nframes, _export_latency);
+ if (_remaining_latency_preroll > 0) {
+ samplepos_t remain = std::min ((samplepos_t)nframes, _remaining_latency_preroll);
if (need_buffers) {
_engine.main_thread()->get_buffers ();
}
+
process_without_events (remain);
+
if (need_buffers) {
_engine.main_thread()->drop_buffers ();
}
- _export_latency -= remain;
+ _remaining_latency_preroll -= remain;
+ _transport_sample -= remain;
nframes -= remain;
if (nframes == 0) {