1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-17 00:20:06 +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;
// This string persists in configuration files
// 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;
virtual IdentInterfaceSymbol GetFamilyId() = 0;
// These should move to the "EffectClientInterface" class once all
// effects have been converted.

View File

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

View File

@ -217,33 +217,16 @@ wxString Effect::GetDescription()
return wxEmptyString;
}
wxString Effect::GetFamilyId()
IdentInterfaceSymbol Effect::GetFamilyId()
{
if (mClient)
{
return mClient->GetFamilyId();
}
// PRL: In 2.2.2 we wanted to change the user-visible name to
// "Built-in" but we did not do it the obvious way by just changing this
// string, because of problems with compatibility of pluginsettings.cfg
// 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");
// Unusually, the internal and visible strings differ for the built-in
// effect family.
return { wxT("Audacity"), XO("Built-in") };
}
bool Effect::IsInteractive()
@ -2516,7 +2499,7 @@ void Effect::Preview(bool dryOnly)
wxWindow *FocusDialog = wxWindow::FindFocus();
double previewDuration;
bool isNyquist = GetFamilyId().IsSameAs(NYQUISTEFFECTS_FAMILY);
bool isNyquist = GetFamilyId() == NYQUISTEFFECTS_FAMILY;
bool isGenerator = GetType() == EffectTypeGenerate;
// 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))
{
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.
// Always use default web browser to allow full-featured HTML pages.
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>();
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(_("Version: %s"), mEffect->GetVersion()));
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
EffectType GetType() override;
wxString GetFamilyId() override;
wxString GetFamilyName() override;
IdentInterfaceSymbol GetFamilyId() override;
bool IsInteractive() override;
bool IsDefault() override;
bool IsLegacy() override;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -28,7 +28,7 @@
#include "nyx.h"
#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_TOOLS_PROMPT_ID wxT("Nyquist Tools Prompt")
@ -92,8 +92,7 @@ public:
// EffectDefinitionInterface implementation
EffectType GetType() override;
wxString GetFamilyId() override;
wxString GetFamilyName() override;
IdentInterfaceSymbol GetFamilyId() override;
bool IsInteractive() override;
bool IsDefault() override;

View File

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

View File

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