Lv2Manager: Print issues uniq-ed
This commit is contained in:
committed by
Johannes Lorenz
parent
f7128700b4
commit
7a85b4d547
@@ -70,7 +70,7 @@ class LMMS_EXPORT Lv2ControlBase : public LinkedModelGroups
|
||||
{
|
||||
public:
|
||||
static Plugin::PluginTypes check(const LilvPlugin* m_plugin,
|
||||
std::vector<PluginIssue> &issues, bool printIssues = false);
|
||||
std::vector<PluginIssue> &issues);
|
||||
|
||||
const LilvPlugin* getPlugin() const { return m_plugin; }
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ class Lv2Proc : public LinkedModelGroup
|
||||
{
|
||||
public:
|
||||
static Plugin::PluginTypes check(const LilvPlugin* plugin,
|
||||
std::vector<PluginIssue> &issues, bool printIssues = false);
|
||||
std::vector<PluginIssue> &issues);
|
||||
|
||||
/*
|
||||
ctor/dtor
|
||||
|
||||
@@ -63,6 +63,8 @@ public:
|
||||
{
|
||||
}
|
||||
PluginIssueType type() const { return m_issueType; }
|
||||
bool operator==(const PluginIssue& other) const;
|
||||
bool operator<(const PluginIssue& other) const;
|
||||
friend QDebug operator<<(QDebug stream, const PluginIssue& iss);
|
||||
};
|
||||
|
||||
|
||||
@@ -67,6 +67,24 @@ const char *PluginIssue::msgFor(const PluginIssueType &it)
|
||||
|
||||
|
||||
|
||||
bool PluginIssue::operator==(const PluginIssue &other) const
|
||||
{
|
||||
return (m_issueType == other.m_issueType) && (m_info == other.m_info);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool PluginIssue::operator<(const PluginIssue &other) const
|
||||
{
|
||||
return (m_issueType != other.m_issueType)
|
||||
? m_issueType < other.m_issueType
|
||||
: m_info < other.m_info;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
QDebug operator<<(QDebug stream, const PluginIssue &iss)
|
||||
{
|
||||
stream << PluginIssue::msgFor(iss.m_issueType);
|
||||
|
||||
@@ -37,10 +37,10 @@
|
||||
|
||||
|
||||
Plugin::PluginTypes Lv2ControlBase::check(const LilvPlugin *plugin,
|
||||
std::vector<PluginIssue> &issues, bool printIssues)
|
||||
std::vector<PluginIssue> &issues)
|
||||
{
|
||||
// for some reason, all checks can be done by one processor...
|
||||
return Lv2Proc::check(plugin, issues, printIssues);
|
||||
return Lv2Proc::check(plugin, issues);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -118,7 +118,20 @@ void Lv2Manager::initPlugins()
|
||||
const LilvPlugin* curPlug = lilv_plugins_get(plugins, itr);
|
||||
|
||||
std::vector<PluginIssue> issues;
|
||||
Plugin::PluginTypes type = Lv2ControlBase::check(curPlug, issues, m_debug);
|
||||
Plugin::PluginTypes type = Lv2ControlBase::check(curPlug, issues);
|
||||
std::sort(issues.begin(), issues.end());
|
||||
auto last = std::unique(issues.begin(), issues.end());
|
||||
issues.erase(last, issues.end());
|
||||
if (m_debug && issues.size())
|
||||
{
|
||||
qDebug() << "Lv2 plugin"
|
||||
<< qStringFromPluginNode(curPlug, lilv_plugin_get_name)
|
||||
<< "(URI:"
|
||||
<< lilv_node_as_uri(lilv_plugin_get_uri(curPlug))
|
||||
<< ") can not be loaded:";
|
||||
for (const PluginIssue& iss : issues) { qDebug() << " - " << iss; }
|
||||
}
|
||||
|
||||
Lv2Info info(curPlug, type, issues.empty());
|
||||
|
||||
m_lv2InfoMap[lilv_node_as_uri(lilv_plugin_get_uri(curPlug))]
|
||||
|
||||
@@ -58,7 +58,7 @@ struct MidiInputEvent
|
||||
|
||||
|
||||
Plugin::PluginTypes Lv2Proc::check(const LilvPlugin *plugin,
|
||||
std::vector<PluginIssue>& issues, bool printIssues)
|
||||
std::vector<PluginIssue>& issues)
|
||||
{
|
||||
unsigned maxPorts = lilv_plugin_get_num_ports(plugin);
|
||||
enum { inCount, outCount, maxCount };
|
||||
@@ -128,16 +128,6 @@ Plugin::PluginTypes Lv2Proc::check(const LilvPlugin *plugin,
|
||||
}
|
||||
}
|
||||
|
||||
if (printIssues && issues.size())
|
||||
{
|
||||
qDebug() << "Lv2 plugin"
|
||||
<< qStringFromPluginNode(plugin, lilv_plugin_get_name)
|
||||
<< "(URI:"
|
||||
<< lilv_node_as_uri(lilv_plugin_get_uri(plugin))
|
||||
<< ") can not be loaded:";
|
||||
for (const PluginIssue& iss : issues) { qDebug() << " - " << iss; }
|
||||
}
|
||||
|
||||
return (audioChannels[inCount] > 2 || audioChannels[outCount] > 2)
|
||||
? Plugin::Undefined
|
||||
: (audioChannels[inCount] > 0)
|
||||
|
||||
Reference in New Issue
Block a user