diff options
author | Carl Hetherington <carl@carlh.net> | 2011-11-15 18:04:47 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2011-11-15 18:04:47 +0000 |
commit | 6822b37c7fda7e3ce8e1c2977923ce9de72659f8 (patch) | |
tree | cccdb39a325295ba4027992e0d01b622ad54ffa2 /libs | |
parent | 4770fea0a2b9b71850de9764868b53f85bfd594c (diff) |
Slightly fudged but basically reasonable fix for reports of
playback buffer problems when playing an empty MIDI track
(#4388).
git-svn-id: svn://localhost/ardour2/branches/3.0@10619 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/midi_diskstream.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc index 81217b179a..4f7778e09e 100644 --- a/libs/ardour/midi_diskstream.cc +++ b/libs/ardour/midi_diskstream.cc @@ -1400,15 +1400,25 @@ MidiDiskstream::set_align_style_from_io () float MidiDiskstream::playback_buffer_load () const { - return (float) ((double) _playback_buf->read_space()/ - (double) _playback_buf->capacity()); + /* For MIDI it's not trivial to differentiate the following two cases: + + 1. The playback buffer is empty because the system has run out of time to fill it. + 2. The playback buffer is empty because there is no more data on the playlist. + + If we use a simple buffer load computation, we will report that the MIDI diskstream + cannot keep up when #2 happens, when in fact it can. Since MIDI data rates + are so low compared to audio, just give a pretend answer here. + */ + + return 1; } float MidiDiskstream::capture_buffer_load () const { - return (float) ((double) _capture_buf->write_space()/ - (double) _capture_buf->capacity()); + /* We don't report playback buffer load, so don't report capture load either */ + + return 1; } int |