Consolidate PluginInsert Match, move to parent class

This commit is contained in:
Robin Gareus 2024-03-21 23:05:01 +01:00
parent 2da3141706
commit f5b53a6d14
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
4 changed files with 51 additions and 52 deletions

View File

@ -103,6 +103,33 @@ public:
Variant _value;
};
/** Enumeration of the ways in which we can match our insert's
* IO to that of the plugin(s).
*/
enum MatchingMethod {
Impossible, ///< we can't
Delegate, ///< we are delegating to the plugin, and it can handle it
NoInputs, ///< plugin has no inputs, so anything goes
ExactMatch, ///< our insert's inputs are the same as the plugin's
Replicate, ///< we have multiple instances of the plugin
Split, ///< we copy one of our insert's inputs to multiple plugin inputs
Hide, ///< we `hide' some of the plugin's inputs by feeding them silence
};
/** Description of how we can match our plugin's IO to our own insert IO */
struct Match {
Match () : method (Impossible), plugins (0), strict_io (false), custom_cfg (false) {}
Match (MatchingMethod m, int32_t p,
bool strict = false, bool custom = false, ChanCount h = ChanCount ())
: method (m), plugins (p), hide (h), strict_io (strict), custom_cfg (custom) {}
MatchingMethod method; ///< method to employ
int32_t plugins; ///< number of copies of the plugin that we need
ChanCount hide; ///< number of channels to hide
bool strict_io; ///< force in == out
bool custom_cfg; ///< custom config (if not strict)
};
protected:
static std::shared_ptr<Plugin> plugin_factory (std::shared_ptr<Plugin>);
@ -115,4 +142,6 @@ protected:
} // namespace ARDOUR
std::ostream& operator<<(std::ostream& o, const ARDOUR::PlugInsertBase::Match& m);
#endif

View File

@ -270,34 +270,6 @@ public:
PBD::Signal0<void> PluginIoReConfigure;
PBD::Signal0<void> PluginMapChanged;
PBD::Signal0<void> PluginConfigChanged;
/** Enumeration of the ways in which we can match our insert's
* IO to that of the plugin(s).
*/
enum MatchingMethod {
Impossible, ///< we can't
Delegate, ///< we are delegating to the plugin, and it can handle it
NoInputs, ///< plugin has no inputs, so anything goes
ExactMatch, ///< our insert's inputs are the same as the plugin's
Replicate, ///< we have multiple instances of the plugin
Split, ///< we copy one of our insert's inputs to multiple plugin inputs
Hide, ///< we `hide' some of the plugin's inputs by feeding them silence
};
/** Description of how we can match our plugin's IO to our own insert IO */
struct Match {
Match () : method (Impossible), plugins (0), strict_io (false), custom_cfg (false) {}
Match (MatchingMethod m, int32_t p,
bool strict = false, bool custom = false, ChanCount h = ChanCount ())
: method (m), plugins (p), hide (h), strict_io (strict), custom_cfg (custom) {}
MatchingMethod method; ///< method to employ
int32_t plugins; ///< number of copies of the plugin that we need
ChanCount hide; ///< number of channels to hide
bool strict_io; ///< force in == out
bool custom_cfg; ///< custom config (if not strict)
};
protected:
XMLNode& state () const;
@ -427,6 +399,4 @@ private:
} // namespace ARDOUR
std::ostream& operator<<(std::ostream& o, const ARDOUR::PluginInsert::Match& m);
#endif /* __ardour_plugin_insert_h__ */

View File

@ -400,3 +400,24 @@ PlugInsertBase::PluginPropertyControl::get_value () const
{
return _value.to_double ();
}
std::ostream& operator<<(std::ostream& o, const ARDOUR::PlugInsertBase::Match& m)
{
switch (m.method) {
case PlugInsertBase::Impossible: o << "Impossible"; break;
case PlugInsertBase::Delegate: o << "Delegate"; break;
case PlugInsertBase::NoInputs: o << "NoInputs"; break;
case PlugInsertBase::ExactMatch: o << "ExactMatch"; break;
case PlugInsertBase::Replicate: o << "Replicate"; break;
case PlugInsertBase::Split: o << "Split"; break;
case PlugInsertBase::Hide: o << "Hide"; break;
}
o << " cnt: " << m.plugins
<< (m.strict_io ? " strict-io" : "")
<< (m.custom_cfg ? " custom-cfg" : "");
if (m.method == PlugInsertBase::Hide) {
o << " hide: " << m.hide;
}
o << "\n";
return o;
}

View File

@ -2259,7 +2259,7 @@ PluginInsert::can_support_io_configuration (const ChanCount& in, ChanCount& out)
return private_can_support_io_configuration (in, out).method != Impossible;
}
PluginInsert::Match
PlugInsertBase::Match
PluginInsert::private_can_support_io_configuration (ChanCount const& in, ChanCount& out) const
{
if (!_custom_cfg && _preset_out.n_audio () > 0) {
@ -3236,24 +3236,3 @@ PluginInsert::clear_stats ()
{
_stat_reset.store (1);
}
std::ostream& operator<<(std::ostream& o, const ARDOUR::PluginInsert::Match& m)
{
switch (m.method) {
case PluginInsert::Impossible: o << "Impossible"; break;
case PluginInsert::Delegate: o << "Delegate"; break;
case PluginInsert::NoInputs: o << "NoInputs"; break;
case PluginInsert::ExactMatch: o << "ExactMatch"; break;
case PluginInsert::Replicate: o << "Replicate"; break;
case PluginInsert::Split: o << "Split"; break;
case PluginInsert::Hide: o << "Hide"; break;
}
o << " cnt: " << m.plugins
<< (m.strict_io ? " strict-io" : "")
<< (m.custom_cfg ? " custom-cfg" : "");
if (m.method == PluginInsert::Hide) {
o << " hide: " << m.hide;
}
o << "\n";
return o;
}