From aac8040e95bbecd67156a567c67640049484ef3a Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 22 Sep 2017 03:47:38 +0200 Subject: [PATCH] Enforce disk-reader to be after the disk-writer If disk-monitoring is disabled: disk-reader position is not relevant. If Rec-arm is off: disk-writer position is not relevant. But... Play -> [plugins] -> Record is basically a bounce and best done using the bounce operation. (faster than realtime). Input + Play -> Record -> Output Ardour would need to align playback with the Input to be recorded and at the same time align it with output, so that a player can play along on the same track. That's not possible without a time-machine (or a 2nd play processor). While it can work in theory under some special circumstances, allowing the disk-reader before the disk-writer is really just confusing, error prone and valid uses cases are better handled by dedicated operations. --- libs/ardour/route.cc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 4d473eb740..00b484ca6c 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -4681,8 +4681,6 @@ Route::setup_invisible_processors () new_processors.push_front (_intreturn); } - /* EXPORT PROCESSOR */ - /* DISK READER & WRITER (for Track objects) */ if (_disk_reader || _disk_writer) { @@ -4722,6 +4720,21 @@ Route::setup_invisible_processors () } } + /* ensure dist-writer is before disk-reader */ + if (_disk_reader && _disk_writer) { + ProcessorList::iterator reader_pos = find (new_processors.begin(), new_processors.end(), _disk_reader); + ProcessorList::iterator writer_pos = find (new_processors.begin(), new_processors.end(), _disk_writer); + assert (reader_pos != new_processors.end ()); + assert (writer_pos != new_processors.end ()); + if (std::distance (new_processors.begin(), reader_pos) < std::distance (new_processors.begin(), writer_pos)) { + new_processors.erase (reader_pos); + assert (writer_pos == find (new_processors.begin(), new_processors.end(), _disk_writer)); + new_processors.insert (++writer_pos, _disk_reader); + } + } + + + /* EXPORT PROCESSOR */ if (_capturing_processor) { assert (!_capturing_processor->display_to_user ()); ProcessorList::iterator reader_pos = find (new_processors.begin(), new_processors.end(), _disk_reader);