diff options
author | Robin Gareus <robin@gareus.org> | 2020-04-09 19:07:33 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2020-04-09 19:07:33 +0200 |
commit | 4f3a95a1da9245caa0055b52407d4022e00f1113 (patch) | |
tree | a6a446c3afcd29c97932903df641e7f034de2e50 /libs | |
parent | 0f1b98c155762451d2951e8fe1338bf1cfe76c7e (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')
-rw-r--r-- | libs/ardour/session_export.cc | 20 | ||||
-rw-r--r-- | libs/ardour/session_transport.cc | 7 |
2 files changed, 23 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 (); diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index f136eebc5d..64dc5b3a7e 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -1568,6 +1568,13 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished) DEBUG_TRACE (DEBUG::Transport, string_compose ("send TSC with speed = %1\n", _transport_speed)); TransportStateChange (); /* EMIT SIGNAL */ AutomationWatch::instance().transport_stop_automation_watches (_transport_sample); + +#if 0 + if (_exporting && !_realtime_export) { + ptw = PostTransportWork (ptw & ~(PostTransportStop)); + set_post_transport_work (ptw); + } +#endif } void |