summaryrefslogtreecommitdiff
path: root/libs/ardour/session_export.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2020-03-05 20:18:54 +0100
committerRobin Gareus <robin@gareus.org>2020-03-06 01:49:44 +0100
commit18514408637c9b49a1858443a4f1a37023244599 (patch)
treeb640ccf40bc2ed28fd011eb4fb4a2808850f2c78 /libs/ardour/session_export.cc
parent128a45954cfbfeaa0fd70c626a5d0c3c86e2ff7a (diff)
Fix realtime export of multiple time-spans
After exporting a time-span, the next time-span was started directly from the rt-callback. This had various issues. In particular with realtime export. Post-processing of a realtime-export enables freewheeling and is driven by freewheel callbacks. Freewheeling needs to be safely disabled for an upcoming realtime export. A similar issues existed when mixing realtime and non-realtime exports.
Diffstat (limited to 'libs/ardour/session_export.cc')
-rw-r--r--libs/ardour/session_export.cc25
1 files changed, 21 insertions, 4 deletions
diff --git a/libs/ardour/session_export.cc b/libs/ardour/session_export.cc
index c4ef004550..93ca0d5afe 100644
--- a/libs/ardour/session_export.cc
+++ b/libs/ardour/session_export.cc
@@ -111,9 +111,10 @@ Session::start_audio_export (samplepos_t position, bool realtime, bool region_ex
{
if (!_exporting) {
pre_export ();
+ } else {
+ realtime_stop (true, true);
}
- _realtime_export = realtime;
_region_export = region_export;
if (region_export) {
@@ -165,7 +166,6 @@ Session::start_audio_export (samplepos_t position, bool realtime, bool region_ex
} else {
_remaining_latency_preroll = 0;
}
- export_status->stop = false;
/* get transport ready. note how this is calling butler functions
from a non-butler thread. we waited for the butler to stop
@@ -179,15 +179,27 @@ Session::start_audio_export (samplepos_t position, bool realtime, bool region_ex
return -1;
}
- _engine.Freewheel.connect_same_thread (export_freewheel_connection, boost::bind (&Session::process_export_fw, this, _1));
+ assert (!_engine.freewheeling ());
+ assert (!_engine.in_process_thread ());
- if (_realtime_export) {
+ if (realtime) {
Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
_export_rolling = true;
+ _realtime_export = true;
+ export_status->stop = false;
process_function = &Session::process_export_fw;
+ /* this is required for ExportGraphBuilder::Intermediate::start_post_processing */
+ _engine.Freewheel.connect_same_thread (export_freewheel_connection, boost::bind (&Session::process_export_fw, this, _1));
return 0;
} else {
+ if (_realtime_export) {
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
+ process_function = &Session::process_with_events;
+ }
+ _realtime_export = false;
_export_rolling = true;
+ export_status->stop = false;
+ _engine.Freewheel.connect_same_thread (export_freewheel_connection, boost::bind (&Session::process_export_fw, this, _1));
return _engine.freewheel (true);
}
}
@@ -235,6 +247,11 @@ Session::process_export (pframes_t nframes)
void
Session::process_export_fw (pframes_t nframes)
{
+ if (!_export_rolling) {
+ ProcessExport (0);
+ return;
+ }
+
const bool need_buffers = _engine.freewheeling ();
if (_export_preroll > 0) {