From 4a99efe588656788bebeb5d124ca0002c2251aa9 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 3 Nov 2019 09:20:50 -0700 Subject: [PATCH] another notable cleanup/simplification of DiskReader's MIDI handling Note that we resolve notes from the tracker directly into the output buffer. This happens after an edit causes a buffer overwrite --- libs/ardour/disk_reader.cc | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/libs/ardour/disk_reader.cc b/libs/ardour/disk_reader.cc index 3a051582d8..bb1717c8d7 100644 --- a/libs/ardour/disk_reader.cc +++ b/libs/ardour/disk_reader.cc @@ -251,14 +251,6 @@ DiskReader::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp sampleoffset_t disk_samples_to_consume; MonitorState ms = _track->monitoring_state (); - if (run_must_resolve) { - boost::shared_ptr mt = boost::dynamic_pointer_cast (_track); - if (mt) { - resolve_tracker (mt->immediate_events(), 0); - } - run_must_resolve = false; - } - if (_active) { if (!_pending_active) { _active = false; @@ -387,23 +379,25 @@ DiskReader::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp } } + midi: /* MIDI data handling */ - midi: - if (!declick_in_progress() && bufs.count().n_midi()) { - MidiBuffer* dst; + if (bufs.count().n_midi()) { - if (_no_disk_output) { - dst = &scratch_bufs.get_midi(0); - } else { - dst = &bufs.get_midi (0); + MidiBuffer& dst (bufs.get_midi (0)); + + if (run_must_resolve) { + resolve_tracker (dst, 0); + run_must_resolve = false; } - if ((ms & MonitoringDisk) && !still_locating && speed) { - get_midi_playback (*dst, start_sample, end_sample, ms, scratch_bufs, speed, disk_samples_to_consume); + if (!_no_disk_output && !declick_in_progress() && (ms & MonitoringDisk) && !still_locating && speed) { + get_midi_playback (dst, start_sample, end_sample, ms, scratch_bufs, speed, disk_samples_to_consume); } } + /* decide if we need the butler */ + if (!still_locating) { bool butler_required = false;