Update plugin classification
* dedicated API for classes (effect, instrument, util) * prepare for tags (rather than categories) * prepare removal of per-plugin in_category() API
This commit is contained in:
@@ -251,10 +251,13 @@ class LIBARDOUR_API AUPluginInfo : public PluginInfo {
|
||||
std::vector<Plugin::PresetRecord> get_presets (bool user_only) const;
|
||||
|
||||
bool needs_midi_input () const;
|
||||
bool is_effect () const;
|
||||
bool is_effect_without_midi_input () const;
|
||||
bool is_effect_with_midi_input () const;
|
||||
|
||||
/* note: AU's have an explicit way to prompt for instrument/fx category */
|
||||
bool is_effect () const;
|
||||
bool is_instrument () const;
|
||||
bool is_utility () const;
|
||||
|
||||
AUPluginCachedInfo cache;
|
||||
|
||||
|
||||
@@ -151,6 +151,13 @@ class LIBARDOUR_API LadspaPluginInfo : public PluginInfo {
|
||||
LadspaPluginInfo ();
|
||||
~LadspaPluginInfo () { };
|
||||
|
||||
bool is_instrument () const { return false; } /* ladspa's are never instruments */
|
||||
#ifdef MIXBUS
|
||||
/* for mixbus, relegate ladspa's to the Utils folder. */
|
||||
bool is_effect () const { return false; }
|
||||
bool is_utility () const { return true; }
|
||||
#endif
|
||||
|
||||
PluginPtr load (Session& session);
|
||||
std::vector<Plugin::PresetRecord> get_presets (bool user_only) const;
|
||||
};
|
||||
|
||||
@@ -208,13 +208,7 @@ class LIBARDOUR_API LuaPluginInfo : public PluginInfo
|
||||
PluginPtr load (Session& session);
|
||||
std::vector<Plugin::PresetRecord> get_presets (bool user_only) const;
|
||||
|
||||
bool in_category (const std::string &c) const {
|
||||
return (category == c);
|
||||
}
|
||||
bool is_instrument () const { return _is_instrument; }
|
||||
bool reconfigurable_io() const { return true; }
|
||||
|
||||
bool _is_instrument;
|
||||
};
|
||||
|
||||
typedef boost::shared_ptr<LuaPluginInfo> LuaPluginInfoPtr;
|
||||
|
||||
@@ -364,8 +364,6 @@ public:
|
||||
|
||||
PluginPtr load (Session& session);
|
||||
std::vector<Plugin::PresetRecord> get_presets (bool user_only) const;
|
||||
virtual bool in_category (const std::string &c) const;
|
||||
virtual bool is_instrument() const;
|
||||
|
||||
char * _plugin_uri;
|
||||
};
|
||||
|
||||
@@ -425,9 +425,17 @@ class LIBARDOUR_API PluginInfo {
|
||||
std::string unique_id;
|
||||
|
||||
virtual PluginPtr load (Session& session) = 0;
|
||||
virtual bool is_instrument() const;
|
||||
|
||||
/* NOTE: it is possible for a plugin to be an effect AND an instrument.
|
||||
* override these funcs as necessary to support that.
|
||||
*/
|
||||
virtual bool is_effect () const;
|
||||
virtual bool is_instrument () const;
|
||||
virtual bool is_utility () const; //this includes things like "generators" and "midi filters"
|
||||
virtual bool is_analyzer () const;
|
||||
|
||||
virtual bool needs_midi_input() const;
|
||||
virtual bool in_category (const std::string &) const { return false; }
|
||||
virtual bool in_category (const std::string &) const { return false; } // deprecated
|
||||
|
||||
virtual std::vector<Plugin::PresetRecord> get_presets (bool user_only) const = 0;
|
||||
|
||||
|
||||
@@ -176,7 +176,9 @@ public:
|
||||
|
||||
bool has_no_inputs() const;
|
||||
bool has_no_audio_inputs() const;
|
||||
|
||||
bool is_instrument () const;
|
||||
|
||||
bool has_output_presets (
|
||||
ChanCount in = ChanCount (DataType::MIDI, 1),
|
||||
ChanCount out = ChanCount (DataType::AUDIO, 2)
|
||||
|
||||
@@ -38,13 +38,13 @@
|
||||
#include <glibmm/miscutils.h>
|
||||
|
||||
#include "ardour/ardour.h"
|
||||
#include "ardour/audio_unit.h"
|
||||
#include "ardour/audioengine.h"
|
||||
#include "ardour/audio_buffer.h"
|
||||
#include "ardour/debug.h"
|
||||
#include "ardour/midi_buffer.h"
|
||||
#include "ardour/filesystem_paths.h"
|
||||
#include "ardour/io.h"
|
||||
#include "ardour/audio_unit.h"
|
||||
#include "ardour/midi_buffer.h"
|
||||
#include "ardour/route.h"
|
||||
#include "ardour/session.h"
|
||||
#include "ardour/tempo.h"
|
||||
@@ -2916,14 +2916,14 @@ AUPluginInfo::discover_by_description (PluginInfoList& plugs, CAComponentDescrip
|
||||
continue;
|
||||
|
||||
case kAudioUnitType_Output:
|
||||
info->category = _("AudioUnit Output");
|
||||
info->category = _("Output");
|
||||
break;
|
||||
case kAudioUnitType_MusicDevice:
|
||||
info->category = _("Instrument");
|
||||
has_midi_in = true;
|
||||
break;
|
||||
case kAudioUnitType_MusicEffect:
|
||||
info->category = _("Music Effect");
|
||||
info->category = _("Effect");
|
||||
has_midi_in = true;
|
||||
break;
|
||||
case kAudioUnitType_Effect:
|
||||
@@ -2936,7 +2936,7 @@ AUPluginInfo::discover_by_description (PluginInfoList& plugs, CAComponentDescrip
|
||||
info->category = _("Generator");
|
||||
break;
|
||||
default:
|
||||
info->category = _("AudioUnit (Unknown)");
|
||||
info->category = _("(Unknown)");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3310,6 +3310,13 @@ AUPluginInfo::is_instrument () const
|
||||
return descriptor->IsMusicDevice();
|
||||
}
|
||||
|
||||
bool
|
||||
AUPluginInfo::is_utility () const
|
||||
{
|
||||
return (descriptor->IsGenerator() || descriptor->componentType == 'aumi');
|
||||
// kAudioUnitType_MidiProcessor ..looks like we aren't even scanning for these yet?
|
||||
}
|
||||
|
||||
void
|
||||
AUPlugin::set_info (PluginInfoPtr info)
|
||||
{
|
||||
|
||||
@@ -1228,7 +1228,6 @@ LuaPluginInfo::LuaPluginInfo (LuaScriptInfoPtr lsi) {
|
||||
n_outputs.set (DataType::AUDIO, 1);
|
||||
type = Lua;
|
||||
|
||||
_is_instrument = category == "Instrument";
|
||||
}
|
||||
|
||||
PluginPtr
|
||||
|
||||
@@ -3411,31 +3411,6 @@ LV2PluginInfo::get_presets (bool /*user_only*/) const
|
||||
return p;
|
||||
}
|
||||
|
||||
bool
|
||||
LV2PluginInfo::in_category (const std::string &c) const
|
||||
{
|
||||
// TODO use untranslated lilv_plugin_get_class()
|
||||
// match gtk2_ardour/plugin_selector.cc
|
||||
return category == c;
|
||||
}
|
||||
|
||||
bool
|
||||
LV2PluginInfo::is_instrument () const
|
||||
{
|
||||
if (category == "Instrument") {
|
||||
return true;
|
||||
}
|
||||
#if 1
|
||||
/* until we make sure that category remains untranslated in the lv2.ttl spec
|
||||
* and until most instruments also classify themselves as such, there's a 2nd check:
|
||||
*/
|
||||
if (n_inputs.n_midi() > 0 && n_inputs.n_audio() == 0 && n_outputs.n_audio() > 0) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
PluginInfoList*
|
||||
LV2PluginInfo::discover()
|
||||
{
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -386,10 +386,7 @@ bool
|
||||
PluginInsert::is_instrument() const
|
||||
{
|
||||
PluginInfoPtr pip = _plugins[0]->get_info();
|
||||
if (pip->is_instrument ()) {
|
||||
return true;
|
||||
}
|
||||
return pip->n_inputs.n_midi () != 0 && pip->n_outputs.n_audio () > 0 && pip->n_inputs.n_audio () == 0;
|
||||
return (pip->is_instrument ());
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -984,7 +984,7 @@ PluginManager::windows_vst_discover (string path, bool cache_only)
|
||||
|
||||
snprintf (buf, sizeof (buf), "%d", finfo->UniqueID);
|
||||
info->unique_id = buf;
|
||||
info->category = "VST";
|
||||
info->category = finfo->category;
|
||||
info->path = path;
|
||||
info->creator = finfo->creator;
|
||||
info->index = 0;
|
||||
@@ -1121,7 +1121,7 @@ PluginManager::mac_vst_discover (string path, bool cache_only)
|
||||
|
||||
snprintf (buf, sizeof (buf), "%d", finfo->UniqueID);
|
||||
info->unique_id = buf;
|
||||
info->category = "MacVST";
|
||||
info->category = finfo->Category;
|
||||
info->path = path;
|
||||
info->creator = finfo->creator;
|
||||
info->index = 0;
|
||||
@@ -1240,7 +1240,7 @@ PluginManager::lxvst_discover (string path, bool cache_only)
|
||||
|
||||
snprintf (buf, sizeof (buf), "%d", finfo->UniqueID);
|
||||
info->unique_id = buf;
|
||||
info->category = "linuxVSTs";
|
||||
info->category = finfo->Category;
|
||||
info->path = path;
|
||||
info->creator = finfo->creator;
|
||||
info->index = 0;
|
||||
|
||||
@@ -314,7 +314,7 @@ vstfx_load_info_block (FILE* fp, VSTInfo *info)
|
||||
|
||||
// TODO read isInstrument -- effFlagsIsSynth
|
||||
info->isInstrument = info->numInputs == 0 && info->numOutputs > 0 && 1 == (info->wantMidi & 1);
|
||||
if (!strcmp (info->Category, "Synth")) {
|
||||
if (!strcmp (info->Category, "Instrument")) {
|
||||
info->isInstrument = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user