summaryrefslogtreecommitdiff
path: root/libs/ardour/session_export.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2020-04-09 19:07:33 +0200
committerRobin Gareus <robin@gareus.org>2020-04-09 19:07:33 +0200
commit4f3a95a1da9245caa0055b52407d4022e00f1113 (patch)
treea6a446c3afcd29c97932903df641e7f034de2e50 /libs/ardour/session_export.cc
parent0f1b98c155762451d2951e8fe1338bf1cfe76c7e (diff)
Cont'd work on fixing export ranges
This picks up where cfd95340b1 left off. The goal is to ensure that the butler has completed all PostTransportStop related tasks and won't meddle with transport after exporting has started. Previously this could happen, because realtime_stop() queues PostTransportStop and the butler is sommoned after every export process cycle. Since 61e7f3176bf the butler keeps calling non_realtime_stop() every time it is woken up, until TFSM comes around and unsets the flag in the process callback.
Diffstat (limited to 'libs/ardour/session_export.cc')
-rw-r--r--libs/ardour/session_export.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/libs/ardour/session_export.cc b/libs/ardour/session_export.cc
index 79e0b5a51b..0c8811a969 100644
--- a/libs/ardour/session_export.cc
+++ b/libs/ardour/session_export.cc
@@ -110,9 +110,11 @@ Session::pre_export ()
int
Session::start_audio_export (samplepos_t position, bool realtime, bool region_export)
{
+ assert (!engine().in_process_thread ());
+
if (!_exporting) {
pre_export ();
- } else {
+ } else if (_transport_speed != 0) {
realtime_stop (true, true);
}
@@ -132,13 +134,21 @@ Session::start_audio_export (samplepos_t position, bool realtime, bool region_ex
_export_preroll = 1;
}
+ /* realtime_stop will have queued butler work (and TSFM),
+ * but the butler may not run immediately, so well have
+ * to wait for it to wake up and call
+ * non_realtime_stop ().
+ */
+ do {
+ Glib::usleep (engine().usecs_per_cycle ());
+ _butler->schedule_transport_work ();
+ } while (0 != post_transport_work ());
+
/* 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.
*/
- Glib::usleep (engine().usecs_per_cycle ());
- _butler->schedule_transport_work ();
_butler->wait_until_finished ();
/* get everyone to the right position */
@@ -241,7 +251,8 @@ Session::process_export (pframes_t nframes)
if (ProcessExport (nframes).value_or (0) > 0) {
/* last cycle completed */
- flush_all_inserts ();
+ assert (_export_rolling);
+ stop_audio_export ();
}
} catch (std::exception & e) {
@@ -361,6 +372,7 @@ Session::stop_audio_export ()
*/
realtime_stop (true, true);
+ flush_all_inserts ();
_export_rolling = false;
_butler->schedule_transport_work ();