summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-02-20 01:20:03 +0000
committerDavid Robillard <d@drobilla.net>2009-02-20 01:20:03 +0000
commitdf4e6f2341040f37c1da58576eae4f9d0e55f80c (patch)
tree4c0f29334c54b37f890379310aa117a2d375b36c /libs
parentc9582da23371bfd40f3087f5a9112d081ef012da (diff)
Fix recording of the last disk chunk's worth of MIDI data.
git-svn-id: svn://localhost/ardour2/branches/3.0@4645 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/midi_diskstream.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc
index 4e124425b9..9015979810 100644
--- a/libs/ardour/midi_diskstream.cc
+++ b/libs/ardour/midi_diskstream.cc
@@ -873,14 +873,15 @@ MidiDiskstream::do_flush (RunContext context, bool force_flush)
_write_data_count = 0;
+ total = _session.transport_frame() - _last_flush_frame;
+
if (_last_flush_frame > _session.transport_frame()
|| _last_flush_frame < capture_start_frame) {
_last_flush_frame = _session.transport_frame();
}
- total = _session.transport_frame() - _last_flush_frame;
-
- if (total == 0 || (_capture_buf->read_space() == 0 && _session.transport_speed() == 0) || (total < disk_io_chunk_frames && !force_flush && was_recording)) {
+ if (total == 0 || _capture_buf->read_space() == 0
+ || (!force_flush && (total < disk_io_chunk_frames && was_recording))) {
goto out;
}
@@ -903,7 +904,9 @@ MidiDiskstream::do_flush (RunContext context, bool force_flush)
assert(!destructive());
- if (record_enabled() && _session.transport_frame() - _last_flush_frame > disk_io_chunk_frames) {
+ if (record_enabled()
+ && ( (_session.transport_frame() - _last_flush_frame > disk_io_chunk_frames)
+ || force_flush)) {
if ((!_write_source) || _write_source->midi_write (*_capture_buf, capture_start_frame, to_write) != to_write) {
error << string_compose(_("MidiDiskstream %1: cannot write to disk"), _id) << endmsg;
return -1;