fix behavior of DiskReader when moved after an instrument
authorPaul Davis <paul@linuxaudiosystems.com>
Sun, 15 Dec 2019 02:34:13 +0000 (19:34 -0700)
committerPaul Davis <paul@linuxaudiosystems.com>
Sun, 15 Dec 2019 02:34:24 +0000 (19:34 -0700)
libs/ardour/ardour/disk_reader.h
libs/ardour/disk_reader.cc

index 725fa4b2ce365937fb1eb9622bee69480d8fb556..3116435606bb6850000abcb6cf0ebaa94d001123 100644 (file)
@@ -50,6 +50,8 @@ public:
        static samplecnt_t default_chunk_samples ();
        static void set_chunk_samples (samplecnt_t n) { _chunk_samples = n; }
 
+       bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
+
        void run (BufferSet& /*bufs*/, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double speed, pframes_t /*nframes*/, bool /*result_required*/);
        void realtime_handle_transport_stopped ();
        void realtime_locate (bool);
index ea363061d6616ecdb12a243324c2fd5f59ee73bf..fa8a063407163c933185facfffda1f8d1caaea38 100644 (file)
@@ -536,7 +536,7 @@ DiskReader::overwrite_existing_audio ()
 {
        boost::shared_ptr<ChannelList> c = channels.reader();
 
-       if (c->empty ()) {
+       if (c->empty () || !_playlists[DataType::AUDIO]) {
                return true;
        }
 
@@ -1683,3 +1683,32 @@ DiskReader::reload_loop ()
 
        }
 }
+
+bool
+DiskReader::can_support_io_configuration (const ChanCount& in, ChanCount& out)
+{
+       if (!DiskIOProcessor::can_support_io_configuration (in, out)) {
+               return false;
+       }
+
+       /* DiskIO might have done this too, but do it again anyway as a
+        * starting point.
+        */
+
+       out == in;
+
+       if (_playlists[DataType::AUDIO]) {
+               ChannelList::size_type naudio = max (ChannelList::size_type (1), channels.reader()->size());
+               if (out.n_audio() < naudio) {
+                       out.set (DataType::AUDIO, naudio);
+               }
+       }
+
+       if (_playlists[DataType::MIDI]) {
+               if (out.n_midi() != 1) {
+                       out.set (DataType::MIDI, 1);
+               }
+       }
+
+       return true;
+}