X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fsession_export.cc;h=7276d631ddd4d53f4cccf59b0ed1d6b4f23dbb61;hb=1399ef391de5b05888ea2e13e6ff80f14b6e84d9;hp=23172838d075c7726dcfd8d02f413c5c2927a1db;hpb=3e32a00a52908ab034c55ec4adb705165e3a54d8;p=ardour.git diff --git a/libs/ardour/session_export.cc b/libs/ardour/session_export.cc index 23172838d0..7276d631dd 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 (framepos_t position, bool realtime, bool region_export) +Session::start_audio_export (framepos_t position, bool realtime, bool region_export, bool comensate_master_latency) { if (!_exporting) { pre_export (); @@ -130,14 +130,24 @@ Session::start_audio_export (framepos_t position, bool realtime, bool region_exp /* "worst_track_latency" is the correct value for stem-exports * see to Route::add_export_point(), * - * for master-bus export, we'd need to add the master's latency. - * or actually longest-total-session-latency. + * 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 can't use worst_playback_latency because that includes - * includes external latencies and would overcompensate. + * 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_latency (); + boost::shared_ptr master = master_out (); + if (master && comensate_master_latency) { + _export_latency += master->signal_latency (); + } + if (region_export) { _export_latency = 0; }