1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-17 16:40:07 +02:00

Use IdentInterfaceSymbol to identify effect families

This commit is contained in:
Paul Licameli 2018-03-29 12:28:35 -04:00
parent 915e6ead40
commit 2c19e8f81e
17 changed files with 27 additions and 91 deletions

View File

@ -105,12 +105,7 @@ public:
virtual EffectType GetType() = 0; virtual EffectType GetType() = 0;
// This string persists in configuration files virtual IdentInterfaceSymbol GetFamilyId() = 0;
// So config compatibility will break if it is changed across Audacity versions
virtual wxString GetFamilyId() = 0;
// Returns a user-visible string:
virtual wxString GetFamilyName() = 0;
// These should move to the "EffectClientInterface" class once all // These should move to the "EffectClientInterface" class once all
// effects have been converted. // effects have been converted.

View File

@ -1443,7 +1443,7 @@ const PluginID & PluginManager::RegisterPlugin(ModuleInterface *provider, Effect
plug.SetProviderID(PluginManager::GetID(provider)); plug.SetProviderID(PluginManager::GetID(provider));
plug.SetEffectType(effect->GetType()); plug.SetEffectType(effect->GetType());
plug.SetEffectFamilyId(effect->GetFamilyId()); plug.SetEffectFamilyId(effect->GetFamilyId().Internal());
plug.SetEffectInteractive(effect->IsInteractive()); plug.SetEffectInteractive(effect->IsInteractive());
plug.SetEffectDefault(effect->IsDefault()); plug.SetEffectDefault(effect->IsDefault());
plug.SetEffectRealtime(effect->SupportsRealtime()); plug.SetEffectRealtime(effect->SupportsRealtime());
@ -2414,7 +2414,7 @@ const PluginID & PluginManager::RegisterPlugin(EffectDefinitionInterface *effect
PluginDescriptor & plug = CreatePlugin(GetID(effect), effect, type); PluginDescriptor & plug = CreatePlugin(GetID(effect), effect, type);
plug.SetEffectType(effect->GetType()); plug.SetEffectType(effect->GetType());
plug.SetEffectFamilyId(effect->GetFamilyId()); plug.SetEffectFamilyId(effect->GetFamilyId().Internal());
plug.SetEffectInteractive(effect->IsInteractive()); plug.SetEffectInteractive(effect->IsInteractive());
plug.SetEffectDefault(effect->IsDefault()); plug.SetEffectDefault(effect->IsDefault());
plug.SetEffectRealtime(effect->SupportsRealtime()); plug.SetEffectRealtime(effect->SupportsRealtime());
@ -2632,7 +2632,7 @@ PluginID PluginManager::GetID(EffectDefinitionInterface *effect)
{ {
return wxString::Format(wxT("%s_%s_%s_%s_%s"), return wxString::Format(wxT("%s_%s_%s_%s_%s"),
GetPluginTypeString(PluginTypeEffect), GetPluginTypeString(PluginTypeEffect),
effect->GetFamilyId(), effect->GetFamilyId().Internal(),
effect->GetVendor(), effect->GetVendor(),
effect->GetName(), effect->GetName(),
effect->GetPath()); effect->GetPath());

View File

@ -217,33 +217,16 @@ wxString Effect::GetDescription()
return wxEmptyString; return wxEmptyString;
} }
wxString Effect::GetFamilyId() IdentInterfaceSymbol Effect::GetFamilyId()
{ {
if (mClient) if (mClient)
{ {
return mClient->GetFamilyId(); return mClient->GetFamilyId();
} }
// PRL: In 2.2.2 we wanted to change the user-visible name to // Unusually, the internal and visible strings differ for the built-in
// "Built-in" but we did not do it the obvious way by just changing this // effect family.
// string, because of problems with compatibility of pluginsettings.cfg return { wxT("Audacity"), XO("Built-in") };
// See PluginDescriptor::GetTranslatedEffectFamily and
// EffectUIHost::OnMenu
// See PluginManager::RegisterPlugin and PluginManager::GetID, where the
// return value is also (mis?)used for internal identification purposes,
// NOT as a user-visible string!
// Thereby affecting configuration file contents!
return XO("Audacity");
}
wxString Effect::GetFamilyName()
{
if (mClient)
{
return mClient->GetFamilyName();
}
return XO("Built-in");
} }
bool Effect::IsInteractive() bool Effect::IsInteractive()
@ -2516,7 +2499,7 @@ void Effect::Preview(bool dryOnly)
wxWindow *FocusDialog = wxWindow::FindFocus(); wxWindow *FocusDialog = wxWindow::FindFocus();
double previewDuration; double previewDuration;
bool isNyquist = GetFamilyId().IsSameAs(NYQUISTEFFECTS_FAMILY); bool isNyquist = GetFamilyId() == NYQUISTEFFECTS_FAMILY;
bool isGenerator = GetType() == EffectTypeGenerate; bool isGenerator = GetType() == EffectTypeGenerate;
// Mix a few seconds of audio from all of the tracks // Mix a few seconds of audio from all of the tracks
@ -3366,7 +3349,7 @@ void EffectUIHost::OnCancel(wxCommandEvent & WXUNUSED(evt))
void EffectUIHost::OnHelp(wxCommandEvent & WXUNUSED(event)) void EffectUIHost::OnHelp(wxCommandEvent & WXUNUSED(event))
{ {
if (mEffect && mEffect->GetFamilyId().IsSameAs(NYQUISTEFFECTS_FAMILY) && (mEffect->ManualPage().IsEmpty())) { if (mEffect && mEffect->GetFamilyId() == NYQUISTEFFECTS_FAMILY && (mEffect->ManualPage().IsEmpty())) {
// Old ShowHelp required when there is no on-line manual. // Old ShowHelp required when there is no on-line manual.
// Always use default web browser to allow full-featured HTML pages. // Always use default web browser to allow full-featured HTML pages.
HelpSystem::ShowHelp(FindWindow(wxID_HELP), mEffect->HelpPage(), wxEmptyString, true, true); HelpSystem::ShowHelp(FindWindow(wxID_HELP), mEffect->HelpPage(), wxEmptyString, true, true);
@ -3458,7 +3441,7 @@ void EffectUIHost::OnMenu(wxCommandEvent & WXUNUSED(evt))
auto sub = std::make_unique<wxMenu>(); auto sub = std::make_unique<wxMenu>();
sub->Append(kDummyID, wxString::Format(_("Type: %s"), sub->Append(kDummyID, wxString::Format(_("Type: %s"),
::wxGetTranslation( mEffect->GetFamilyName() ))); ::wxGetTranslation( mEffect->GetFamilyId().Translation() )));
sub->Append(kDummyID, wxString::Format(_("Name: %s"), mEffect->GetTranslatedName())); sub->Append(kDummyID, wxString::Format(_("Name: %s"), mEffect->GetTranslatedName()));
sub->Append(kDummyID, wxString::Format(_("Version: %s"), mEffect->GetVersion())); sub->Append(kDummyID, wxString::Format(_("Version: %s"), mEffect->GetVersion()));
sub->Append(kDummyID, wxString::Format(_("Vendor: %s"), GetCustomTranslation(mEffect->GetVendor()))); sub->Append(kDummyID, wxString::Format(_("Vendor: %s"), GetCustomTranslation(mEffect->GetVendor())));

View File

@ -92,8 +92,7 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler,
// EffectDefinitionInterface implementation // EffectDefinitionInterface implementation
EffectType GetType() override; EffectType GetType() override;
wxString GetFamilyId() override; IdentInterfaceSymbol GetFamilyId() override;
wxString GetFamilyName() override;
bool IsInteractive() override; bool IsInteractive() override;
bool IsDefault() override; bool IsDefault() override;
bool IsLegacy() override; bool IsLegacy() override;

View File

@ -156,7 +156,7 @@ wxString EffectManager::GetEffectFamilyName(const PluginID & ID)
{ {
auto effect = GetEffect(ID); auto effect = GetEffect(ID);
if (effect) if (effect)
return effect->GetFamilyName(); return effect->GetFamilyId().Translation();
return {}; return {};
} }

View File

@ -256,12 +256,7 @@ public:
return mDescription; return mDescription;
} }
wxString GetFamilyId() override IdentInterfaceSymbol GetFamilyId() override
{
return VSTPLUGINTYPE;
}
wxString GetFamilyName() override
{ {
return VSTPLUGINTYPE; return VSTPLUGINTYPE;
} }
@ -1270,12 +1265,7 @@ EffectType VSTEffect::GetType()
} }
wxString VSTEffect::GetFamilyId() IdentInterfaceSymbol VSTEffect::GetFamilyId()
{
return VSTPLUGINTYPE;
}
wxString VSTEffect::GetFamilyName()
{ {
return VSTPLUGINTYPE; return VSTPLUGINTYPE;
} }

View File

@ -95,8 +95,7 @@ class VSTEffect final : public wxEvtHandler,
// EffectDefinitionInterface implementation // EffectDefinitionInterface implementation
EffectType GetType() override; EffectType GetType() override;
wxString GetFamilyId() override; IdentInterfaceSymbol GetFamilyId() override;
wxString GetFamilyName() override;
bool IsInteractive() override; bool IsInteractive() override;
bool IsDefault() override; bool IsDefault() override;
bool IsLegacy() override; bool IsLegacy() override;

View File

@ -941,12 +941,7 @@ EffectType AudioUnitEffect::GetType()
return EffectTypeProcess; return EffectTypeProcess;
} }
wxString AudioUnitEffect::GetFamilyId() IdentInterfaceSymbol AudioUnitEffect::GetFamilyId()
{
return AUDIOUNITEFFECTS_FAMILY;
}
wxString AudioUnitEffect::GetFamilyName()
{ {
return AUDIOUNITEFFECTS_FAMILY; return AUDIOUNITEFFECTS_FAMILY;
} }

View File

@ -61,8 +61,7 @@ public:
// EffectIdentInterface implementation // EffectIdentInterface implementation
EffectType GetType() override; EffectType GetType() override;
wxString GetFamilyId() override; IdentInterfaceSymbol GetFamilyId() override;
wxString GetFamilyName() override;
bool IsInteractive() override; bool IsInteractive() override;
bool IsDefault() override; bool IsDefault() override;
bool IsLegacy() override; bool IsLegacy() override;

View File

@ -672,12 +672,7 @@ EffectType LadspaEffect::GetType()
return EffectTypeProcess; return EffectTypeProcess;
} }
wxString LadspaEffect::GetFamilyId() IdentInterfaceSymbol LadspaEffect::GetFamilyId()
{
return LADSPAEFFECTS_FAMILY;
}
wxString LadspaEffect::GetFamilyName()
{ {
return LADSPAEFFECTS_FAMILY; return LADSPAEFFECTS_FAMILY;
} }

View File

@ -56,8 +56,7 @@ public:
// EffectDefinitionInterface implementation // EffectDefinitionInterface implementation
EffectType GetType() override; EffectType GetType() override;
wxString GetFamilyId() override; IdentInterfaceSymbol GetFamilyId() override;
wxString GetFamilyName() override;
bool IsInteractive() override; bool IsInteractive() override;
bool IsDefault() override; bool IsDefault() override;
bool IsLegacy() override; bool IsLegacy() override;

View File

@ -386,12 +386,7 @@ EffectType LV2Effect::GetType()
return EffectTypeProcess; return EffectTypeProcess;
} }
wxString LV2Effect::GetFamilyId() IdentInterfaceSymbol LV2Effect::GetFamilyId()
{
return LV2EFFECTS_FAMILY;
}
wxString LV2Effect::GetFamilyName()
{ {
return LV2EFFECTS_FAMILY; return LV2EFFECTS_FAMILY;
} }

View File

@ -119,8 +119,7 @@ public:
// EffectDefinitionInterface implementation // EffectDefinitionInterface implementation
EffectType GetType() override; EffectType GetType() override;
wxString GetFamilyId() override; IdentInterfaceSymbol GetFamilyId() override;
wxString GetFamilyName() override;
bool IsInteractive() override; bool IsInteractive() override;
bool IsDefault() override; bool IsDefault() override;
bool IsLegacy() override; bool IsLegacy() override;

View File

@ -260,12 +260,7 @@ EffectType NyquistEffect::GetType()
return mType; return mType;
} }
wxString NyquistEffect::GetFamilyId() IdentInterfaceSymbol NyquistEffect::GetFamilyId()
{
return NYQUISTEFFECTS_FAMILY;
}
wxString NyquistEffect::GetFamilyName()
{ {
return NYQUISTEFFECTS_FAMILY; return NYQUISTEFFECTS_FAMILY;
} }

View File

@ -28,7 +28,7 @@
#include "nyx.h" #include "nyx.h"
#define NYQUISTEFFECTS_VERSION wxT("1.0.0.0") #define NYQUISTEFFECTS_VERSION wxT("1.0.0.0")
#define NYQUISTEFFECTS_FAMILY wxT("Nyquist") #define NYQUISTEFFECTS_FAMILY ( IdentInterfaceSymbol{ wxT("Nyquist") } )
#define NYQUIST_PROMPT_ID wxT("Nyquist Prompt") #define NYQUIST_PROMPT_ID wxT("Nyquist Prompt")
#define NYQUIST_TOOLS_PROMPT_ID wxT("Nyquist Tools Prompt") #define NYQUIST_TOOLS_PROMPT_ID wxT("Nyquist Tools Prompt")
@ -92,8 +92,7 @@ public:
// EffectDefinitionInterface implementation // EffectDefinitionInterface implementation
EffectType GetType() override; EffectType GetType() override;
wxString GetFamilyId() override; IdentInterfaceSymbol GetFamilyId() override;
wxString GetFamilyName() override;
bool IsInteractive() override; bool IsInteractive() override;
bool IsDefault() override; bool IsDefault() override;

View File

@ -130,12 +130,7 @@ EffectType VampEffect::GetType()
return EffectTypeAnalyze; return EffectTypeAnalyze;
} }
wxString VampEffect::GetFamilyId() IdentInterfaceSymbol VampEffect::GetFamilyId()
{
return VAMPEFFECTS_FAMILY;
}
wxString VampEffect::GetFamilyName()
{ {
return VAMPEFFECTS_FAMILY; return VAMPEFFECTS_FAMILY;
} }

View File

@ -54,8 +54,7 @@ public:
// EffectDefinitionInterface implementation // EffectDefinitionInterface implementation
EffectType GetType() override; EffectType GetType() override;
wxString GetFamilyId() override; IdentInterfaceSymbol GetFamilyId() override;
wxString GetFamilyName() override;
bool IsInteractive() override; bool IsInteractive() override;
bool IsDefault() override; bool IsDefault() override;