diff options
author | David Robillard <d@drobilla.net> | 2008-10-10 00:39:29 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-10-10 00:39:29 +0000 |
commit | 15cdf454ea5a1460b41cb462c35f1ffb853a0764 (patch) | |
tree | d2e2dfec11c3a661d30c18fb4a9d40c7dbcb2326 /libs/ardour/midi_buffer.cc | |
parent | c64e96b6a8f6782a5ad0bc41b7200ec94408aaa5 (diff) |
Apply MIDI looping patch from torbenh, with minor changes.
General idea: use internal events to mark loop boundaries in MIDI buffers so readers can make sense of timestamps.
git-svn-id: svn://localhost/ardour2/branches/3.0@3905 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/midi_buffer.cc')
-rw-r--r-- | libs/ardour/midi_buffer.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libs/ardour/midi_buffer.cc b/libs/ardour/midi_buffer.cc index 6f0620cae1..ae370cdef7 100644 --- a/libs/ardour/midi_buffer.cc +++ b/libs/ardour/midi_buffer.cc @@ -110,13 +110,17 @@ MidiBuffer::read_from(const Buffer& src, nframes_t nframes, nframes_t offset) assert(_capacity >= msrc.size()); - clear(); - assert(_size == 0); + if (offset == 0) { + clear(); + assert(_size == 0); + } // FIXME: slow for (size_t i=0; i < msrc.size(); ++i) { const Evoral::MIDIEvent& ev = msrc[i]; - if (ev.time() >= offset && ev.time() < offset+nframes) { + if (ev.time() < offset) + continue; + if (ev.time() < (nframes + offset)) { //cout << "MidiBuffer::read_from got event, " << int(ev.type()) << " time: " << ev.time() << " buffer size: " << _size << endl; push_back(ev); } else { |