From 0c4869dc35a15757915ebbddcdd7077d788ca91e Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 20 Nov 2014 02:46:30 +0100 Subject: [PATCH] debug trace lost midi-messages --- libs/ardour/midi_port.cc | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/libs/ardour/midi_port.cc b/libs/ardour/midi_port.cc index 82dabc4cba..1377938f2e 100644 --- a/libs/ardour/midi_port.cc +++ b/libs/ardour/midi_port.cc @@ -19,12 +19,17 @@ #include #include +#include "pbd/compose.h" +#include "pbd/debug.h" + #include "ardour/midi_port.h" #include "ardour/data_type.h" #include "ardour/audioengine.h" +#include "ardour/debug.h" -using namespace ARDOUR; using namespace std; +using namespace ARDOUR; +using namespace PBD; #define port_engine AudioEngine::instance()->port_engine() @@ -197,6 +202,21 @@ MidiPort::flush_buffers (pframes_t nframes) // event times are in frames, relative to cycle start +#ifndef NDEBUG + if (DEBUG::MidiIO & PBD::debug_bits) { + DEBUG_STR_DECL(a); + DEBUG_STR_APPEND(a, string_compose ("MidiPort %1 pop event @ %2 sz %3 ", this, ev.time(), ev.size())); + for (size_t i=0; i < ev.size(); ++i) { + DEBUG_STR_APPEND(a,hex); + DEBUG_STR_APPEND(a,"0x"); + DEBUG_STR_APPEND(a,(int)(ev.buffer()[i])); + DEBUG_STR_APPEND(a,' '); + } + DEBUG_STR_APPEND(a,'\n'); + DEBUG_TRACE (DEBUG::MidiIO, DEBUG_STR(a).str()); + } +#endif + assert (ev.time() < (nframes + _global_port_buffer_offset + _port_buffer_offset)); if (ev.time() >= _global_port_buffer_offset + _port_buffer_offset) {