From de5e463904de7b58218a5bb1e9080ba5353bb985 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 25 Oct 2009 14:42:46 +0000 Subject: make per-region note-tracking in MidiPlaylist work correctly, or something very close to it. note that locking isssues remain when regions (and thus note trackers) are removed git-svn-id: svn://localhost/ardour2/branches/3.0@5912 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/midi_ring_buffer.cc | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'libs/ardour/midi_ring_buffer.cc') diff --git a/libs/ardour/midi_ring_buffer.cc b/libs/ardour/midi_ring_buffer.cc index f886eb8443..df49b570c7 100644 --- a/libs/ardour/midi_ring_buffer.cc +++ b/libs/ardour/midi_ring_buffer.cc @@ -16,13 +16,15 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "pbd/compose.h" + +#include "ardour/debug.h" #include "ardour/midi_ring_buffer.h" #include "ardour/midi_buffer.h" #include "ardour/event_type_map.h" using namespace std; - -namespace ARDOUR { +using namespace ARDOUR; /** Read a block of MIDI events from buffer into a MidiBuffer. * @@ -48,11 +50,13 @@ MidiRingBuffer::read(MidiBuffer& dst, nframes_t start, nframes_t end, nframes this->full_peek(sizeof(T), (uint8_t*)&ev_time); if (ev_time > end) { - // cerr << "MRB event @ " << ev_time << " past end @ " << end << endl; + DEBUG_TRACE (DEBUG::MidiDiskstreamIO, string_compose ("MRB event @ %1 past end @ %2\n", ev_time, end)); break; } else if (ev_time < start) { - // cerr << "MRB event @ " << ev_time << " before start @ " << start << endl; + DEBUG_TRACE (DEBUG::MidiDiskstreamIO, 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)); } bool success = read_prefix(&ev_time, &ev_type, &ev_size); @@ -100,12 +104,14 @@ MidiRingBuffer::read(MidiBuffer& dst, nframes_t start, nframes_t end, nframes // write MIDI buffer contents success = Evoral::EventRingBuffer::full_read(ev_size, write_loc); -#if 0 - cerr << "wrote MidiEvent to Buffer: " << hex; +#ifndef NDEBUG + DEBUG_TRACE (DEBUG::MidiDiskstreamIO, "wrote MidiEvent to Buffer: "); for (size_t i=0; i < ev_size; ++i) { - cerr << (int) write_loc[i] << ' '; + DEBUG_STR_SET(a, hex); + DEBUG_STR(a) << "0x" << (int)write_loc[i] << ' '; + DEBUG_TRACE (DEBUG::MidiDiskstreamIO, DEBUG_STR(a).str()); } - cerr << dec << endl; + DEBUG_TRACE (DEBUG::MidiDiskstreamIO, "\n"); #endif if (success) { @@ -201,5 +207,3 @@ MidiRingBuffer::dump(ostream& str) template class MidiRingBuffer; -} // namespace ARDOUR - -- cgit v1.2.3