summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour/midi_ring_buffer.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-10-12 17:40:37 +0000
committerDavid Robillard <d@drobilla.net>2008-10-12 17:40:37 +0000
commit2c4a08bc5752d1453248af564ca3303c2c6e341c (patch)
treeb4b3a70298a515eb7f7d16a98f3e63c0d3542e50 /libs/ardour/ardour/midi_ring_buffer.h
parent61b3131303e02c3d45737125abfd08445c3964f3 (diff)
MIDI looping fixes from torbenh.
git-svn-id: svn://localhost/ardour2/branches/3.0@3932 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour/midi_ring_buffer.h')
-rw-r--r--libs/ardour/ardour/midi_ring_buffer.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/libs/ardour/ardour/midi_ring_buffer.h b/libs/ardour/ardour/midi_ring_buffer.h
index 6e827d2852..72bf7a0fe5 100644
--- a/libs/ardour/ardour/midi_ring_buffer.h
+++ b/libs/ardour/ardour/midi_ring_buffer.h
@@ -131,7 +131,7 @@ MidiRingBuffer::read(MidiBuffer& dst, nframes_t start, nframes_t end, nframes_t
//std::cerr << "MRB read " << start << " .. " << end << " + " << offset << std::endl;
- while (read_space() > sizeof(EventTime) + sizeof(EventType) + sizeof(uint32_t)) {
+ while (read_space() >= sizeof(EventTime) + sizeof(EventType) + sizeof(uint32_t)) {
full_peek(sizeof(EventTime), (uint8_t*)&ev_time);
@@ -153,8 +153,10 @@ MidiRingBuffer::read(MidiBuffer& dst, nframes_t start, nframes_t end, nframes_t
// the next events timestamp will be non-monotonic.
if (ev_type == LoopEventType) {
ev_time -= start;
+ ev_time += offset;
Evoral::MIDIEvent loopevent(LoopEventType, ev_time);
dst.push_back(loopevent);
+
// We can safely return, without reading the data, because
// a LoopEvent does not have data.