13
0

Warn about skipped MIDI events

This can occur when the MIDI readahead time is too low and events get
pushed into the MidiRingBuffer after the corresponding read.  In this
case, skip_to() gets called (as it does before every read) and the
events are silently dropped.

This is a Very Bad Thing(TM), so warn about it.  I am not sure which
other scenarios can skip events that aren't problematic, but there's
probably some.  A more sophisticated detection/reporting (or maybe even
dynamic reconfiguration) scheme would be nice here, but some false
positive messages are at least better than silently failing to play
notes and the like.
This commit is contained in:
David Robillard 2016-10-17 19:47:56 -04:00
parent 94f8b7b8f2
commit 208cb967e5

View File

@ -1497,7 +1497,10 @@ MidiDiskstream::get_playback (MidiBuffer& dst, framecnt_t nframes)
events_read = _playback_buf->read (dst, effective_start, effective_start + nframes);
}
} else {
_playback_buf->skip_to (playback_sample);
const size_t n_skipped = _playback_buf->skip_to (playback_sample);
if (n_skipped > 0) {
warning << string_compose(_("MidiDiskstream %1: skipped %2 events, possible underflow"), id(), n_skipped) << endmsg;
}
DEBUG_TRACE (DEBUG::MidiDiskstreamIO, string_compose ("playback buffer read, from %1 to %2 (%3)", playback_sample, playback_sample + nframes, nframes));
events_read = _playback_buf->read (dst, playback_sample, playback_sample + nframes);
}