summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_ring_buffer.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-06-09 13:00:54 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-06-09 13:00:54 +0000
commit1e728e728a79d9b272cc18bc1c46f0c3c8831bf8 (patch)
tree6ecd938ef19be41d6489540bca740f7a67d88de1 /libs/ardour/midi_ring_buffer.cc
parent8f263c239a2090d43221d817442c8141dd439079 (diff)
basically, fix all kinds of odds and ends with MIDI playback, including missed notes and applying gain
git-svn-id: svn://localhost/ardour2/branches/3.0@7247 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/midi_ring_buffer.cc')
-rw-r--r--libs/ardour/midi_ring_buffer.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/libs/ardour/midi_ring_buffer.cc b/libs/ardour/midi_ring_buffer.cc
index e8ae9bb5d3..2999621b70 100644
--- a/libs/ardour/midi_ring_buffer.cc
+++ b/libs/ardour/midi_ring_buffer.cc
@@ -50,7 +50,7 @@ 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) {
+ if (ev_time >= end) {
DEBUG_TRACE (DEBUG::MidiDiskstreamIO, string_compose ("MRB event @ %1 past end @ %2\n", ev_time, end));
break;
} else if (ev_time < start) {
@@ -70,7 +70,7 @@ MidiRingBuffer<T>::read(MidiBuffer& dst, nframes_t start, nframes_t end, nframes
if (ev_type == LoopEventType) {
/*ev_time -= start;
ev_time += offset;*/
- // cerr << "MRB loop boundary @ " << ev_time << endl;
+ cerr << "MRB loop boundary @ " << ev_time << endl;
// Return without reading data or writing to buffer (loop events have no data)
// FIXME: This is not correct, loses events after the loop this cycle
@@ -98,7 +98,7 @@ MidiRingBuffer<T>::read(MidiBuffer& dst, nframes_t start, nframes_t end, nframes
// write the timestamp to address (write_loc - 1)
uint8_t* write_loc = dst.reserve(ev_time, ev_size);
if (write_loc == NULL) {
- // cerr << "MRB: Unable to reserve space in buffer, event skipped";
+ cerr << "MRB: Unable to reserve space in buffer, event skipped";
this->skip (ev_size); // Advance read pointer to next event
continue;
}
@@ -107,15 +107,16 @@ MidiRingBuffer<T>::read(MidiBuffer& dst, nframes_t start, nframes_t end, nframes
success = read_contents (ev_size, write_loc);
#ifndef NDEBUG
- DEBUG_TRACE (DEBUG::MidiDiskstreamIO, "wrote MidiEvent to Buffer: ");
+ 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) {
- DEBUG_STR_DECL(a);
DEBUG_STR_APPEND(a,hex);
DEBUG_STR_APPEND(a,"0x");
DEBUG_STR_APPEND(a,(int)write_loc[i]);
- DEBUG_TRACE (DEBUG::MidiDiskstreamIO, DEBUG_STR(a).str());
+ DEBUG_STR_APPEND(a,' ');
}
- DEBUG_TRACE (DEBUG::MidiDiskstreamIO, "\n");
+ DEBUG_STR_APPEND(a,'\n');
+ DEBUG_TRACE (DEBUG::MidiDiskstreamIO, DEBUG_STR(a).str());
#endif
if (success) {