API to count max multi-channel plugin outputs
This commit is contained in:
@@ -245,7 +245,7 @@ struct LIBARDOUR_API AUPluginCachedInfo {
|
||||
class LIBARDOUR_API AUPluginInfo : public PluginInfo {
|
||||
public:
|
||||
AUPluginInfo (boost::shared_ptr<CAComponentDescription>);
|
||||
~AUPluginInfo ();
|
||||
~AUPluginInfo () {}
|
||||
|
||||
PluginPtr load (Session& session);
|
||||
|
||||
@@ -263,6 +263,7 @@ class LIBARDOUR_API AUPluginInfo : public PluginInfo {
|
||||
AUPluginCachedInfo cache;
|
||||
|
||||
bool reconfigurable_io() const { return true; }
|
||||
uint32_t max_configurable_ouputs () const { return max_outputs; }
|
||||
|
||||
static void clear_cache ();
|
||||
static PluginInfoList* discover (bool scan_only);
|
||||
@@ -274,6 +275,7 @@ class LIBARDOUR_API AUPluginInfo : public PluginInfo {
|
||||
private:
|
||||
boost::shared_ptr<CAComponentDescription> descriptor;
|
||||
UInt32 version;
|
||||
uint32_t max_outputs;
|
||||
static FILE * _crashlog_fd;
|
||||
static bool _scan_only;
|
||||
|
||||
|
||||
@@ -211,6 +211,12 @@ class LIBARDOUR_API LuaPluginInfo : public PluginInfo
|
||||
std::vector<Plugin::PresetRecord> get_presets (bool user_only) const;
|
||||
|
||||
bool reconfigurable_io() const { return true; }
|
||||
uint32_t max_configurable_ouputs () const {
|
||||
return _max_outputs;
|
||||
}
|
||||
|
||||
private:
|
||||
uint32_t _max_outputs;
|
||||
};
|
||||
|
||||
typedef boost::shared_ptr<LuaPluginInfo> LuaPluginInfoPtr;
|
||||
|
||||
@@ -496,6 +496,12 @@ public:
|
||||
/* @return true if the plugin can change its inputs or outputs on demand. */
|
||||
virtual bool reconfigurable_io () const { return false; }
|
||||
|
||||
/* max [re]configurable outputs (if finite, 0 otherwise) */
|
||||
virtual uint32_t max_configurable_ouputs () const
|
||||
{
|
||||
return n_outputs.n_audio();
|
||||
}
|
||||
|
||||
protected:
|
||||
friend class PluginManager;
|
||||
uint32_t index; //< used for LADSPA, index in module
|
||||
|
||||
@@ -2549,11 +2549,7 @@ AUPlugin::has_editor () const
|
||||
AUPluginInfo::AUPluginInfo (boost::shared_ptr<CAComponentDescription> d)
|
||||
: descriptor (d)
|
||||
, version (0)
|
||||
{
|
||||
type = ARDOUR::AudioUnit;
|
||||
}
|
||||
|
||||
AUPluginInfo::~AUPluginInfo ()
|
||||
, max_outputs (0)
|
||||
{
|
||||
type = ARDOUR::AudioUnit;
|
||||
}
|
||||
@@ -2922,6 +2918,8 @@ AUPluginInfo::discover_by_description (PluginInfoList& plugs, CAComponentDescrip
|
||||
|
||||
const int rv = cached_io_configuration (info->unique_id, info->version, cacomp, info->cache, info->name);
|
||||
|
||||
info.max_outputs = 0;
|
||||
|
||||
if (rv == 0) {
|
||||
/* here we have to map apple's wildcard system to a simple pair
|
||||
of values. in ::can_do() we use the whole system, but here
|
||||
@@ -2936,8 +2934,18 @@ AUPluginInfo::discover_by_description (PluginInfoList& plugs, CAComponentDescrip
|
||||
info to the user, which should perhaps be revisited.
|
||||
*/
|
||||
|
||||
int32_t possible_in = info->cache.io_configs.front().first;
|
||||
int32_t possible_out = info->cache.io_configs.front().second;
|
||||
const vector<pair<int,int> >& ioc (info->cache.io_configs);
|
||||
for (vector<pair<int,int> >::const_iterator i = ioc.begin(); i != ioc.end(); ++i) {
|
||||
int32_t possible_out = i->second;
|
||||
if (possible_out < 0) {
|
||||
continue;
|
||||
} else if (possible_out > info.max_outputs) {
|
||||
info.max_outputs = possible_out;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t possible_in = ioc.front().first;
|
||||
int32_t possible_out = ioc.font().second;
|
||||
|
||||
if (possible_in > 0) {
|
||||
info->n_inputs.set (DataType::AUDIO, possible_in);
|
||||
|
||||
@@ -1232,6 +1232,8 @@ LuaPluginInfo::LuaPluginInfo (LuaScriptInfoPtr lsi) {
|
||||
n_outputs.set (DataType::AUDIO, 1);
|
||||
type = Lua;
|
||||
|
||||
// TODO, parse script, get 'dsp_ioconfig', see can_support_io_configuration()
|
||||
_max_outputs = 0;
|
||||
}
|
||||
|
||||
PluginPtr
|
||||
|
||||
@@ -286,7 +286,7 @@ PluginManager::detect_name_ambiguities (PluginInfoList* pil)
|
||||
* by listing number of audio outputs.
|
||||
* This is used in the instrument selector.
|
||||
*/
|
||||
bool r = p->n_outputs.n_audio() != (*i)->n_outputs.n_audio();
|
||||
bool r = p->max_configurable_ouputs () != (*i)->max_configurable_ouputs ();
|
||||
p->multichannel_name_ambiguity = r;
|
||||
(*i)->multichannel_name_ambiguity = r;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user