Enforce disk-reader to be after the disk-writer
authorRobin Gareus <robin@gareus.org>
Fri, 22 Sep 2017 01:47:38 +0000 (03:47 +0200)
committerRobin Gareus <robin@gareus.org>
Fri, 22 Sep 2017 01:47:38 +0000 (03:47 +0200)
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

index 4d473eb7406d2a945c981a830e69f2a4bc49744c..00b484ca6cfb3ad87d94085a12180ff804f6d57e 100644 (file)
@@ -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);