From 8d05ed8e8a487e98ed182ae5b6c98e2160250bf8 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 21 Dec 2011 17:30:08 +0000 Subject: merge-in-place debugging (to be removed later) git-svn-id: svn://localhost/ardour2/branches/3.0@11050 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/midi_buffer.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'libs/ardour/midi_buffer.cc') diff --git a/libs/ardour/midi_buffer.cc b/libs/ardour/midi_buffer.cc index 403f0a86ac..6e07a1bedd 100644 --- a/libs/ardour/midi_buffer.cc +++ b/libs/ardour/midi_buffer.cc @@ -407,6 +407,16 @@ MidiBuffer::merge_in_place(const MidiBuffer &other) return false; } + cerr << "MERGING\nUS: "; + for (MidiBuffer::iterator i = begin(); i != end(); ++i) { + cerr << *i << " ; "; + } + cerr << "\nTHEM: "; + for (MidiBuffer::const_iterator i = other.begin(); i != other.end(); ++i) { + cerr << *i << " ; "; + } + cerr << endl; + #ifndef NDEBUG #ifdef TEST_MIDI_MERGE size_t test_orig_us_size = _size; @@ -445,14 +455,21 @@ MidiBuffer::merge_in_place(const MidiBuffer &other) src = -1; sz = 0; + cerr << "Start merge skip with them = " << *them << endl; + while (them != other.end() && (*them).time() < (*us).time()) { if (src == -1) { src = them.offset; } sz += sizeof (TimeType) + (*them).size(); + cerr << " move through other event " << *them << endl; ++them; } + cerr << "merge skip done, sz = " << sz << " us @ end ? " << (us == end()) + << " them @ end ? " << (them == other.end()) + << endl; + if (sz) { assert(src >= 0); /* move existing */ @@ -471,12 +488,15 @@ MidiBuffer::merge_in_place(const MidiBuffer &other) */ while (us != end() && (*us).time() < (*them).time()) { + cerr << "skip by our own event " << (*us) << endl; ++us; } } if (us == end()) { + cerr << " append rest of other to us\n"; + /* just append the rest of other */ memcpy (_data + us.offset, other._data + them.offset, other._size - them.offset); -- cgit v1.2.3