summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_source.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-10-24 13:26:56 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-10-24 13:26:56 +0000
commitf8fe64a91e7ae7f6ac761e8ae16a485ed70fb994 (patch)
tree7b2942e9bdbb4f1b52d53640b62411c8da9d4e0b /libs/ardour/midi_source.cc
parentdbc75e074912fc3647899711e838d4e5b675e175 (diff)
(FULL commit) start of a nominal debug tracing system, with 64 bits available for flags; track notes by region in MidiPlaylist, and resolve them if they are left hanging at region boundaries. note: MIDI playback is still not working 100% though its better now.
git-svn-id: svn://localhost/ardour2/branches/3.0@5903 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/midi_source.cc')
-rw-r--r--libs/ardour/midi_source.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/libs/ardour/midi_source.cc b/libs/ardour/midi_source.cc
index 9f7c1e3baa..81282c5313 100644
--- a/libs/ardour/midi_source.cc
+++ b/libs/ardour/midi_source.cc
@@ -33,6 +33,7 @@
#include "pbd/basename.h"
#include "ardour/audioengine.h"
+#include "ardour/debug.h"
#include "ardour/midi_model.h"
#include "ardour/midi_ring_buffer.h"
#include "ardour/midi_state_tracker.h"
@@ -129,7 +130,7 @@ MidiSource::invalidate ()
}
nframes_t
-MidiSource::midi_read (MidiRingBuffer<nframes_t>& dst, sframes_t source_start,
+MidiSource::midi_read (Evoral::EventSink<nframes_t>& dst, sframes_t source_start,
sframes_t start, nframes_t cnt,
sframes_t stamp_offset, sframes_t negative_stamp_offset,
MidiStateTracker* tracker) const
@@ -139,18 +140,19 @@ MidiSource::midi_read (MidiRingBuffer<nframes_t>& dst, sframes_t source_start,
BeatsFramesConverter converter(_session, source_start);
if (_model) {
-#define BEATS_TO_FRAMES(t) (converter.to(t) + stamp_offset - negative_stamp_offset)
-
Evoral::Sequence<double>::const_iterator& i = _model_iter;
// If the cached iterator is invalid, search for the first event past start
if (_last_read_end == 0 || start != _last_read_end || !_model_iter_valid) {
+ DEBUG_TRACE (DEBUG::MidiSourceIO, string_compose ("****!!!!**** search for relevant iterator for %1 / %2\n", source_start, start));
for (i = _model->begin(); i != _model->end(); ++i) {
if (converter.to(i->time()) >= start) {
break;
}
}
_model_iter_valid = true;
+ } else {
+ DEBUG_TRACE (DEBUG::MidiSourceIO, string_compose ("============ use cached iterator for %1 / %2\n", source_start, start));
}
_last_read_end = start + cnt;
@@ -164,8 +166,10 @@ MidiSource::midi_read (MidiRingBuffer<nframes_t>& dst, sframes_t source_start,
if (tracker) {
Evoral::MIDIEvent<Evoral::MusicalTime>& ev (*(Evoral::MIDIEvent<Evoral::MusicalTime>*) (&(*i)));
if (ev.is_note_on()) {
+ DEBUG_TRACE (DEBUG::MidiSourceIO, string_compose ("\t%1 Added note on %2 @ %3\n", _name, ev.note(), time_frames));
tracker->add (ev.note(), ev.channel());
} else if (ev.is_note_off()) {
+ DEBUG_TRACE (DEBUG::MidiSourceIO, string_compose ("\t%1 Added note OFF %2 @ %3\n", _name, ev.note(), time_frames));
tracker->remove (ev.note(), ev.channel());
}
}