diff options
author | David Robillard <d@drobilla.net> | 2016-10-17 19:47:56 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2016-10-17 20:22:26 -0400 |
commit | 208cb967e579d9177dce92086103c50f00b45b34 (patch) | |
tree | af15f90bfef97c15918643f3f4e5aa5f1698dd26 /libs/ardour/midi_diskstream.cc | |
parent | 94f8b7b8f2a708063529785c77d1a123ea0f0d7c (diff) |
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.
Diffstat (limited to 'libs/ardour/midi_diskstream.cc')
-rw-r--r-- | libs/ardour/midi_diskstream.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc index 732b51c17b..359dd573cf 100644 --- a/libs/ardour/midi_diskstream.cc +++ b/libs/ardour/midi_diskstream.cc @@ -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); } |