From f8a0de5928f353e5e92948cfb5c7b0199cfdeeab Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 23 Apr 2022 22:59:20 +0200 Subject: [PATCH] Debug async MIDI port (M1 builds) --- libs/ardour/async_midi_port.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libs/ardour/async_midi_port.cc b/libs/ardour/async_midi_port.cc index 8c227c50dc..101312ad71 100644 --- a/libs/ardour/async_midi_port.cc +++ b/libs/ardour/async_midi_port.cc @@ -105,6 +105,11 @@ AsyncMIDIPort::flush_output_fifo (MIDI::pframes_t nframes) /* do this "atomically" after we're done pushing events into the * MidiBuffer */ +#ifndef NDEBUG + if (written > 0) { + cout << "AsyncMIDIPort::flush_output_fifo '" << MIDI::Port::name () << "' written " << written << " events\n"; + } +#endif output_fifo.increment_read_idx (written); } @@ -156,7 +161,10 @@ AsyncMIDIPort::cycle_start (MIDI::pframes_t nframes) when = AudioEngine::instance()->sample_time_at_cycle_start() + timestamp; } - input_fifo.write (when, Evoral::NO_EVENT, size, buf); + uint32_t rv = input_fifo.write (when, Evoral::NO_EVENT, size, buf); +#ifndef NDEBUG + cout << "AsyncMIDIPort::cycle_start '" << MIDI::Port::name () << "' add event, written " << rv << " / " << size << " bytes\n"; +#endif } if (event_count) { @@ -332,6 +340,9 @@ AsyncMIDIPort::read (MIDI::byte *, size_t) while (input_fifo.read (&time, &type, &size, &buffer[0])) { _parser->set_timestamp (time); +#ifndef NDEBUG + cout << "AsyncMIDIPort::read '" << MIDI::Port::name () << "' bytes = " << size << "\n"; +#endif for (uint32_t i = 0; i < size; ++i) { _parser->scanner (buffer[i]); }