summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_ring_buffer.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-10-25 14:42:46 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-10-25 14:42:46 +0000
commitde5e463904de7b58218a5bb1e9080ba5353bb985 (patch)
tree73088a0660bf521b57c784da47e7bff4e5a1084b /libs/ardour/midi_ring_buffer.cc
parente0a2d498696eac65380eee8ff1ca0e29ec4c0783 (diff)
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
Diffstat (limited to 'libs/ardour/midi_ring_buffer.cc')
-rw-r--r--libs/ardour/midi_ring_buffer.cc24
1 files changed, 14 insertions, 10 deletions
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<T>::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<T>::read(MidiBuffer& dst, nframes_t start, nframes_t end, nframes
// write MIDI buffer contents
success = Evoral::EventRingBuffer<T>::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<T>::dump(ostream& str)
template class MidiRingBuffer<nframes_t>;
-} // namespace ARDOUR
-