13
0

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  61e7f3176b 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.
This commit is contained in:
Robin Gareus 2020-04-09 19:07:33 +02:00
parent 0f1b98c155
commit 4f3a95a1da
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 23 additions and 4 deletions

View File

@ -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 ();

View File

@ -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