From 3fe87b9fa1417cfcf6636ff9bf4c8c2abcb6f796 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 18 Jan 2020 15:52:28 +0100 Subject: [PATCH] Fix MIDI capture alignment This fixes Audio/MIDI alignment when recording normally. Loop and/or Punch-in recording is still not aligned properly (both audio and MIDI). _accumulated_capture_offset is initialized once, accumulated offsets (rec_nframes) are kept, even when ::check_record_status() is called multiple times. --- libs/ardour/disk_writer.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/ardour/disk_writer.cc b/libs/ardour/disk_writer.cc index a7ab0fd0c8..cb62f932b6 100644 --- a/libs/ardour/disk_writer.cc +++ b/libs/ardour/disk_writer.cc @@ -150,6 +150,9 @@ DiskWriter::check_record_status (samplepos_t transport_sample, double speed, boo if (_alignment_style == ExistingMaterial) { _first_recordable_sample += _capture_offset + _playback_offset; + if (_accumulated_capture_offset == 0) { + _accumulated_capture_offset = _playback_offset; + } } if (_session.config.get_punch_out () && 0 != (loc = _session.locations()->auto_punch_location ())) {