provide plugins with all available buffers.
authorRobin Gareus <robin@gareus.org>
Tue, 6 May 2014 21:34:04 +0000 (23:34 +0200)
committerRobin Gareus <robin@gareus.org>
Tue, 6 May 2014 21:34:34 +0000 (23:34 +0200)
e.g. Audio in -> Midi out plugins (on an audio-track).
Midi-buffers do exist in the route but no corresponding
(physical) Input port-buffer exists and ardour crashed.

Now, the plugin itself still only accesses the mapped ports
(ChanMapping), but the mapped buffers are at most
"processor_max_streams" and at least the required
in+out buffers for the plugin.

libs/ardour/plugin_insert.cc
libs/ardour/port_set.cc

index 13ac7b375a96510426e15074e32d850b98c5f5d2..6fbb5cb67908de7f318ecc46d087b034bdff5bab 100644 (file)
@@ -352,6 +352,9 @@ PluginInsert::connect_and_run (BufferSet& bufs, pframes_t nframes, framecnt_t of
                }
        }
 
+       bufs.set_count(ChanCount::max(bufs.count(), in_streams));
+       bufs.set_count(ChanCount::max(bufs.count(), out_streams));
+
        /* Note that we've already required that plugins
           be able to handle in-place processing.
        */
index c7f5e2e674e7557cc1ca7eb3ce33a38dc0ce6a3e..3489ae4e449a9fe43e527828b72b4a4ae7a57509 100644 (file)
@@ -145,9 +145,11 @@ PortSet::port(DataType type, size_t n) const
                return port(n);
        } else {
                const PortVec& v = _ports[type];
-               assert(n < v.size());
-               return v[n];
+               if (n < v.size()) {
+                       return v[n];
+               }
        }
+       return boost::shared_ptr<Port>();
 }
 
 boost::shared_ptr<AudioPort>