move "needs output port selector" (from pin-dialog) to backend
authorRobin Gareus <robin@gareus.org>
Wed, 18 May 2016 23:46:11 +0000 (01:46 +0200)
committerRobin Gareus <robin@gareus.org>
Wed, 18 May 2016 23:46:11 +0000 (01:46 +0200)
libs/ardour/ardour/plugin_insert.h
libs/ardour/plugin_insert.cc

index be0c3b36e1e7d20c71f3bf88c0d052f606818096..db052f0f0d174971301ac1dd06a46667e3482a3f 100644 (file)
@@ -164,6 +164,10 @@ class LIBARDOUR_API PluginInsert : public Processor
        bool has_no_inputs() const;
        bool has_no_audio_inputs() const;
        bool needs_midi_input() const;
+       bool has_output_presets (
+                       ChanCount in = ChanCount (DataType::MIDI, 1),
+                       ChanCount out = ChanCount (DataType::AUDIO, 2)
+                       );
 
        void realtime_handle_transport_stopped ();
        void realtime_locate ();
index 79c4c5de6140e318a9bd062c8e65525d066a255f..f6f620e88350cc583ac983da610ab57d1cdecdcf 100644 (file)
@@ -375,6 +375,35 @@ PluginInsert::needs_midi_input() const
        return pip->n_inputs.n_midi() != 0 && pip->n_outputs.n_audio() != 0;
 }
 
+bool
+PluginInsert::has_output_presets (ChanCount in, ChanCount out)
+{
+       if (!_configured && _plugins[0]->get_info ()->reconfigurable_io ()) {
+               // collect possible configurations, prefer given in/out
+               _plugins[0]->can_support_io_configuration (in, out);
+       }
+
+       PluginOutputConfiguration ppc (_plugins[0]->possible_output ());
+
+       if (ppc.size () == 0) {
+               return false;
+       }
+       if (!strict_io () && ppc.size () == 1) {
+               return false;
+       }
+
+       if (strict_io () && ppc.size () == 1) {
+               // "stereo" is currently preferred default for instruments
+               if (ppc.find (2) != ppc.end ()) {
+                       return false;
+               }
+       }
+       if (!needs_midi_input ()) {
+                       return false;
+       }
+       return true;
+}
+
 void
 PluginInsert::create_automatable_parameters ()
 {