From 22a903171347cc8f3776e4c539ca5f1172ec449c Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 12 Sep 2016 10:08:01 -0400 Subject: [PATCH] add a new DEBUG enum for MidiRingBuffer --- libs/ardour/ardour/debug.h | 1 + libs/ardour/debug.cc | 1 + libs/ardour/midi_ring_buffer.cc | 14 +++++++------- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/libs/ardour/ardour/debug.h b/libs/ardour/ardour/debug.h index 41935087bd..d2a258fb56 100644 --- a/libs/ardour/ardour/debug.h +++ b/libs/ardour/ardour/debug.h @@ -32,6 +32,7 @@ namespace PBD { LIBARDOUR_API extern DebugBits MidiSourceIO; LIBARDOUR_API extern DebugBits MidiPlaylistIO; LIBARDOUR_API extern DebugBits MidiDiskstreamIO; + LIBARDOUR_API extern DebugBits MidiRingBuffer; LIBARDOUR_API extern DebugBits SnapBBT; LIBARDOUR_API extern DebugBits Latency; LIBARDOUR_API extern DebugBits LatencyCompensation; diff --git a/libs/ardour/debug.cc b/libs/ardour/debug.cc index 4dd7714812..0aa9216c53 100644 --- a/libs/ardour/debug.cc +++ b/libs/ardour/debug.cc @@ -28,6 +28,7 @@ using namespace std; PBD::DebugBits PBD::DEBUG::MidiSourceIO = PBD::new_debug_bit ("midisourceio"); PBD::DebugBits PBD::DEBUG::MidiPlaylistIO = PBD::new_debug_bit ("midiplaylistio"); PBD::DebugBits PBD::DEBUG::MidiDiskstreamIO = PBD::new_debug_bit ("mididiskstreamio"); +PBD::DebugBits PBD::DEBUG::MidiRingBuffer = PBD::new_debug_bit ("midiringbuffer"); PBD::DebugBits PBD::DEBUG::SnapBBT = PBD::new_debug_bit ("snapbbt"); PBD::DebugBits PBD::DEBUG::Latency = PBD::new_debug_bit ("latency"); PBD::DebugBits PBD::DEBUG::LatencyCompensation = PBD::new_debug_bit ("latencycompensation"); diff --git a/libs/ardour/midi_ring_buffer.cc b/libs/ardour/midi_ring_buffer.cc index 9258b2f7dc..414d803bfe 100644 --- a/libs/ardour/midi_ring_buffer.cc +++ b/libs/ardour/midi_ring_buffer.cc @@ -65,17 +65,17 @@ MidiRingBuffer::read(MidiBuffer& dst, framepos_t start, framepos_t end, frame } if (ev_time >= end) { - DEBUG_TRACE (DEBUG::MidiDiskstreamIO, string_compose ("MRB event @ %1 past end @ %2\n", ev_time, end)); + DEBUG_TRACE (DEBUG::MidiRingBuffer, string_compose ("MRB event @ %1 past end @ %2\n", ev_time, end)); break; } else if (ev_time < start) { - DEBUG_TRACE (DEBUG::MidiDiskstreamIO, string_compose ("MRB event @ %1 before start @ %2\n", ev_time, start)); + DEBUG_TRACE (DEBUG::MidiRingBuffer, string_compose ("MRB event @ %1 before start @ %2\n", ev_time, start)); break; } else { - DEBUG_TRACE (DEBUG::MidiDiskstreamIO, string_compose ("MRB event @ %1 in range %2 .. %3\n", ev_time, start, end)); + DEBUG_TRACE (DEBUG::MidiRingBuffer, string_compose ("MRB event @ %1 in range %2 .. %3\n", ev_time, start, end)); } ev_time -= start; - ev_time += offset; + //ev_time += offset; /* we're good to go ahead and read the data now but since we * have the prefix data already, just skip over that @@ -91,7 +91,7 @@ MidiRingBuffer::read(MidiBuffer& dst, framepos_t start, framepos_t end, frame uint8_t* write_loc = dst.reserve (ev_time, ev_size); if (write_loc == 0) { if (stop_on_overflow_in_dst) { - DEBUG_TRACE (DEBUG::MidiDiskstreamIO, string_compose ("MidiRingBuffer: overflow in destination MIDI buffer, stopped after %1 events\n", count)); + DEBUG_TRACE (DEBUG::MidiRingBuffer, string_compose ("MidiRingBuffer: overflow in destination MIDI buffer, stopped after %1 events\n", count)); break; } error << "MRB: Unable to reserve space in buffer, event skipped" << endmsg; @@ -103,7 +103,7 @@ MidiRingBuffer::read(MidiBuffer& dst, framepos_t start, framepos_t end, frame bool success = read_contents (ev_size, write_loc); #ifndef NDEBUG - if (DEBUG_ENABLED (DEBUG::MidiDiskstreamIO)) { + if (DEBUG_ENABLED (DEBUG::MidiRingBuffer)) { DEBUG_STR_DECL(a); DEBUG_STR_APPEND(a, string_compose ("wrote MidiEvent to Buffer (time=%1, start=%2 offset=%3)", ev_time, start, offset)); for (size_t i=0; i < ev_size; ++i) { @@ -113,7 +113,7 @@ MidiRingBuffer::read(MidiBuffer& dst, framepos_t start, framepos_t end, frame DEBUG_STR_APPEND(a,' '); } DEBUG_STR_APPEND(a,'\n'); - DEBUG_TRACE (DEBUG::MidiDiskstreamIO, DEBUG_STR(a).str()); + DEBUG_TRACE (DEBUG::MidiRingBuffer, DEBUG_STR(a).str()); } #endif