13
0

Fix transport master crash when switching backends

Port registration happens asynchronously. During the first process
callbacks the timecode/clock input ports may not have been
re-established.
This commit is contained in:
Robin Gareus 2021-06-27 16:36:59 +02:00
parent db0691d236
commit 7b5d61b7a5
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 19 additions and 0 deletions

View File

@ -525,6 +525,11 @@ LTC_TransportMaster::process_ltc(samplepos_t const now)
void
LTC_TransportMaster::pre_process (ARDOUR::pframes_t nframes, samplepos_t now, boost::optional<samplepos_t> session_pos)
{
if (!_port) {
reset (true);
return;
}
Sample* in = (Sample*) AudioEngine::instance()->port_engine().get_buffer (_port->port_handle(), nframes);
sampleoffset_t skip;

View File

@ -119,6 +119,14 @@ void
MIDIClock_TransportMaster::pre_process (MIDI::pframes_t nframes, samplepos_t now, boost::optional<samplepos_t> session_pos)
{
/* Read and parse incoming MIDI */
if (!_midi_port) {
_bpm = 0.0;
_running = false;
_current_delta = 0;
midi_clock_count = 0;
DEBUG_TRACE (DEBUG::MidiClock, "No MIDI Clock port registered");
return;
}
DEBUG_TRACE (DEBUG::MidiClock, string_compose ("preprocess with lt = %1 @ %2, running ? %3\n", current.timestamp, now, _running));

View File

@ -131,6 +131,12 @@ MTC_TransportMaster::pre_process (MIDI::pframes_t nframes, samplepos_t now, boos
maybe_reset ();
if (!_midi_port) {
_current_delta = 0;
DEBUG_TRACE (DEBUG::MTC, "No MTC port registered");
return;
}
_midi_port->read_and_parse_entire_midi_buffer_with_no_speed_adjustment (nframes, parser, now);
if (session_pos) {