move ::reconfigurable_io() from Plugin to PluginInfo so that the GUI can offer correc...
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 7 May 2012 22:00:42 +0000 (22:00 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 7 May 2012 22:00:42 +0000 (22:00 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@12200 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/ardour/audio_unit.h
libs/ardour/ardour/plugin.h
libs/ardour/plugin_insert.cc

index 14665da30199c141972bc0a493fff157f67f8a4d..36e82da802ebbe9ea08748d944172e4e814e9fe9 100644 (file)
@@ -104,7 +104,6 @@ class AUPlugin : public ARDOUR::Plugin
 
        bool has_editor () const;
 
-       bool reconfigurable_io() const { return true; }
        bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const;
        ChanCount output_streams() const;
        ChanCount input_streams() const;
@@ -241,6 +240,8 @@ class AUPluginInfo : public PluginInfo {
 
        AUPluginCachedInfo cache;
 
+       bool reconfigurable_io() const { return true; }
+
        static PluginInfoList* discover ();
        static void get_names (CAComponentDescription&, std::string& name, std::string& maker);
        static std::string stringify_descriptor (const CAComponentDescription&);
index 90982bf0b5549c9ebdb93614f28426b2a4d4409a..cfdf0e81217c73a9d8d4fe06d8c78379e78be534 100644 (file)
@@ -67,6 +67,18 @@ class PluginInfo {
        virtual PluginPtr load (Session& session) = 0;
        virtual bool is_instrument() const; 
 
+       /* NOTE: this block of virtual methods looks like the interface
+          to a Processor, but Plugin does not inherit from Processor.
+          It is therefore not required that these precisely match
+          the interface, but it is likely that they will evolve together.
+       */
+
+       /* this returns true if the plugin can change its inputs or outputs on demand.
+          LADSPA, LV2 and VST plugins cannot do this. AudioUnits can.
+       */
+
+       virtual bool reconfigurable_io() const { return false; }
+
   protected:
        friend class PluginManager;
        uint32_t index;
@@ -203,19 +215,6 @@ class Plugin : public PBD::StatefulDestructible, public Latent
        /** Emitted when any parameter changes */
        PBD::Signal2<void, uint32_t, float> ParameterChanged;
 
-       /* NOTE: this block of virtual methods looks like the interface
-          to a Processor, but Plugin does not inherit from Processor.
-          It is therefore not required that these precisely match
-          the interface, but it is likely that they will evolve together.
-       */
-
-       /* this returns true if the plugin can change its inputs or outputs on demand.
-          LADSPA, LV2 and VST plugins cannot do this. AudioUnits can.
-       */
-
-       virtual bool reconfigurable_io() const { return false; }
-
-       /* this is only called if reconfigurable_io() returns true */
        virtual bool configure_io (ChanCount /*in*/, ChanCount /*out*/) { return true; }
 
        /* specific types of plugins can overload this. As of September 2008, only
index 796ec9420cc6d565a344c900de3c6ff147084b20..20180b285b960eb2288e13c931208b522003c559 100644 (file)
@@ -138,12 +138,14 @@ PluginInsert::output_streams() const
 {
        assert (!_plugins.empty());
 
-       if (_plugins.front()->reconfigurable_io()) {
+       PluginInfoPtr info = _plugins.front()->get_info();
+
+       if (info->reconfigurable_io()) {
                ChanCount out = _plugins.front()->output_streams ();
                // DEBUG_TRACE (DEBUG::Processors, string_compose ("Plugin insert, reconfigur(able) output streams = %1\n", out));
                return out;
        } else {
-               ChanCount out = _plugins.front()->get_info()->n_outputs;
+               ChanCount out = info->n_outputs;
                // DEBUG_TRACE (DEBUG::Processors, string_compose ("Plugin insert, static output streams = %1 for %2 plugins\n", out, _plugins.size()));
                out.set_audio (out.n_audio() * _plugins.size());
                out.set_midi (out.n_midi() * _plugins.size());
@@ -158,11 +160,13 @@ PluginInsert::input_streams() const
 
        ChanCount in;
 
-       if (_plugins.front()->reconfigurable_io()) {
+       PluginInfoPtr info = _plugins.front()->get_info();
+
+       if (info->reconfigurable_io()) {
                assert (_plugins.size() == 1);
                in = _plugins.front()->input_streams();
        } else {
-               in = _plugins[0]->get_info()->n_inputs;
+               in = info->n_inputs;
        }
 
        DEBUG_TRACE (DEBUG::Processors, string_compose ("Plugin insert, input streams = %1, match using %2\n", in, _match.method));
@@ -712,7 +716,9 @@ PluginInsert::can_support_io_configuration (const ChanCount& in, ChanCount& out)
 PluginInsert::Match
 PluginInsert::private_can_support_io_configuration (ChanCount const & in, ChanCount& out) const
 {
-       if (_plugins.front()->reconfigurable_io()) {
+       PluginInfoPtr info = _plugins.front()->get_info();
+
+       if (info->reconfigurable_io()) {
                /* Plugin has flexible I/O, so delegate to it */
                bool const r = _plugins.front()->can_support_io_configuration (in, out);
                if (!r) {
@@ -722,8 +728,8 @@ PluginInsert::private_can_support_io_configuration (ChanCount const & in, ChanCo
                return Match (Delegate, 1);
        }
 
-       ChanCount inputs  = _plugins[0]->get_info()->n_inputs;
-       ChanCount outputs = _plugins[0]->get_info()->n_outputs;
+       ChanCount inputs  = info->n_inputs;
+       ChanCount outputs = info->n_outputs;
 
        bool no_inputs = true;
        for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {