diff options
author | Robin Gareus <robin@gareus.org> | 2018-01-29 23:55:20 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2018-01-30 01:33:48 +0100 |
commit | b8491014a53e236255f5803fc876f848cfc82750 (patch) | |
tree | 346bbc463e0121f3866d2aa819e2761b1c621e70 /libs/ardour/plugin.cc | |
parent | 4d173d604896c80c99f7e4cdaa3908b55b0fdb81 (diff) |
Update plugin classification
* dedicated API for classes (effect, instrument, util)
* prepare for tags (rather than categories)
* prepare removal of per-plugin in_category() API
Diffstat (limited to 'libs/ardour/plugin.cc')
-rw-r--r-- | libs/ardour/plugin.cc | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/libs/ardour/plugin.cc b/libs/ardour/plugin.cc index e0ba0f00f7..2d1ffbed74 100644 --- a/libs/ardour/plugin.cc +++ b/libs/ardour/plugin.cc @@ -87,12 +87,6 @@ PluginInfo::needs_midi_input () const return (n_inputs.n_midi() != 0); } -bool -PluginInfo::is_instrument () const -{ - return (n_inputs.n_midi() != 0) && (n_outputs.n_audio() > 0) && (n_inputs.n_audio() == 0); -} - Plugin::Plugin (AudioEngine& e, Session& s) : _engine (e) , _session (s) @@ -526,3 +520,33 @@ Plugin::parameter_label (uint32_t which) const get_parameter_descriptor (which, pd); return pd.label; } + +bool +PluginInfo::is_effect () const +{ + return (!is_instrument () && !is_utility () && !is_analyzer ()); +} + +bool +PluginInfo::is_instrument () const +{ + if (category == "Instrument") { + return true; + } + + // second check: if we have midi input and audio output, we're likely an instrument + return (n_inputs.n_midi() != 0) && (n_outputs.n_audio() > 0) && (n_inputs.n_audio() == 0); +} + +bool +PluginInfo::is_utility () const +{ + /* XXX beware of translations, e.g. LV2 categories */ + return (category == "Utility" || category == "MIDI" || category == "Generator"); +} + +bool +PluginInfo::is_analyzer () const +{ + return (category == "Analyser" || category == "Anaylsis" || category == "Analyzer"); +} |