13
0

Disambiguate instrument plugin names:

* use cached ambiguity information from backend
* combine extra info in single bracket
This commit is contained in:
Robin Gareus 2019-10-15 14:09:02 +02:00
parent 0b377fc393
commit 59d074bcfd
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -122,24 +122,27 @@ InstrumentSelector::build_instrument_list()
uint32_t n = 1; uint32_t n = 1;
std::string prev; std::string prev;
for (PluginInfoList::const_iterator i = all_plugs.begin(); i != all_plugs.end();) { for (PluginInfoList::const_iterator i = all_plugs.begin(); i != all_plugs.end(); ++i, ++n) {
PluginInfoPtr p = *i; PluginInfoPtr p = *i;
++i;
std::string name = p->name; std::string suffix;
/* in the instrument menu,we need to differentiate the different output configs here*/ #ifdef MIXBUS
int n_outs = p->n_outputs.n_audio();
if (n_outs > 2) { if (n_outs > 2) {
name += string_compose( " (%1 outs)", n_outs); suffix = string_compose(_("%1 outs"), n_outs);
} }
#else
/*if a plugin appears in multiple types, we need to differentiate the different types here */ if (p->multichannel_name_ambiguity) {
bool suffix_type = prev == p->name; int n_outs = p->n_outputs.n_audio();
if (!suffix_type && i != all_plugs.end() && (*i)->name == p->name) { if (n_outs > 2) {
suffix_type = true; suffix = string_compose(_("%1 outs"), n_outs);
} else if (n_outs == 2) {
suffix = _("stereo");
}
} }
if (suffix_type) { #endif
if (p->plugintype_name_ambiguity) {
std::string pt; std::string pt;
switch (p->type) { switch (p->type) {
case AudioUnit: case AudioUnit:
@ -153,7 +156,15 @@ InstrumentSelector::build_instrument_list()
default: default:
pt = enum_2_string (p->type); pt = enum_2_string (p->type);
} }
name += " (" + pt + ")"; if (!suffix.empty ()) {
suffix += ", ";
}
suffix += pt;
}
std::string name = p->name;
if (!suffix.empty ()) {
name += " (" + suffix + ")";
} }
row = *(_instrument_list->append()); row = *(_instrument_list->append());
@ -167,7 +178,6 @@ InstrumentSelector::build_instrument_list()
_gmsynth_id = n; _gmsynth_id = n;
} }
prev = p->name; prev = p->name;
n++;
} }
} }