1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-01-13 16:15:48 +01:00

Initialize tables of effect and command names properly

This commit is contained in:
Paul Licameli
2018-04-12 16:45:40 -04:00
parent effab49a6f
commit 0c99501bfb
2 changed files with 32 additions and 23 deletions

View File

@@ -164,23 +164,25 @@ enum
// Redefine EFFECT() to add the effect's name to an array
//
#undef EFFECT
#define EFFECT(n, i, args) (n ## _PLUGIN_SYMBOL).Internal(),
#define EFFECT(n, i, args) results.push_back((n ## _PLUGIN_SYMBOL).Internal());
//
// Create the effect name array
//
static const wxChar *kEffectNames[] =
{
EFFECT_LIST
};
static const std::vector<wxString> kEffectNames() {
std::vector<wxString> results;
EFFECT_LIST;
return results;
}
//
// Create the effect name array of excluded effects
//
static const wxChar *kExcludedNames[] =
{
EXCLUDE_LIST
};
static const std::vector<wxString> kExcludedNames() {
std::vector<wxString> results;
EXCLUDE_LIST;
return results;
}
//
// Redefine EFFECT() to generate a case statement for the lookup switch
@@ -266,14 +268,16 @@ wxString BuiltinEffectsModule::GetDescription()
bool BuiltinEffectsModule::Initialize()
{
for (size_t i = 0; i < WXSIZEOF(kEffectNames); i++)
const auto &names = kEffectNames();
for (const auto &name : names)
{
mNames.Add(wxString(BUILTIN_EFFECT_PREFIX) + kEffectNames[i]);
mNames.Add(wxString(BUILTIN_EFFECT_PREFIX) + name);
}
for (size_t i = 0; i < WXSIZEOF(kExcludedNames); i++)
const auto &excluded = kExcludedNames();
for (const auto &name : excluded)
{
mNames.Add(wxString(BUILTIN_EFFECT_PREFIX) + kExcludedNames[i]);
mNames.Add(wxString(BUILTIN_EFFECT_PREFIX) + name);
}
return true;
@@ -288,9 +292,10 @@ void BuiltinEffectsModule::Terminate()
bool BuiltinEffectsModule::AutoRegisterPlugins(PluginManagerInterface & pm)
{
wxString ignoredErrMsg;
for (size_t i = 0; i < WXSIZEOF(kEffectNames); i++)
const auto &names = kEffectNames();
for (const auto &name : names)
{
wxString path(wxString(BUILTIN_EFFECT_PREFIX) + kEffectNames[i]);
wxString path(wxString(BUILTIN_EFFECT_PREFIX) + name);
if (!pm.IsPluginRegistered(path))
{