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

Distinguish Effect Family Id from Effect Family Name...

... and the distinction makes a difference only for built-in effects.

"Id" is meant to persist in pluginregistry.cfg, and is constrained by how
previous versions of Audacity were written.

"Name" is not persistent, so we have the liberty to change it, as done here
for the built-ins.
This commit is contained in:
Paul Licameli 2018-01-15 23:40:42 -05:00
parent d1d78fd56e
commit 097764d94c
17 changed files with 91 additions and 44 deletions

View File

@ -64,7 +64,10 @@ public:
virtual ~EffectIdentInterface() {};
virtual EffectType GetType() = 0;
virtual wxString GetFamily() = 0;
// Returns a string for internal uses only that may persist in config files:
virtual wxString GetFamilyId() = 0;
// Returns a user-visible string:
virtual wxString GetFamilyName() = 0;
// These should move to the "EffectClientInterface" class once all
// effects have been converted.

View File

@ -1221,7 +1221,7 @@ void PluginDescriptor::SetValid(bool valid)
// Effects
wxString PluginDescriptor::GetUntranslatedEffectFamily() const
wxString PluginDescriptor::GetEffectFamilyId() const
{
return mEffectFamily;
}
@ -1290,7 +1290,7 @@ bool PluginDescriptor::IsEffectAutomatable() const
return mEffectAutomatable;
}
void PluginDescriptor::SetEffectFamily(const wxString & family)
void PluginDescriptor::SetEffectFamilyId(const wxString & family)
{
mEffectFamily = family;
}
@ -1439,7 +1439,7 @@ const PluginID & PluginManager::RegisterPlugin(ModuleInterface *provider, Effect
plug.SetProviderID(PluginManager::GetID(provider));
plug.SetEffectType(effect->GetType());
plug.SetEffectFamily(effect->GetFamily());
plug.SetEffectFamilyId(effect->GetFamilyId());
plug.SetEffectInteractive(effect->IsInteractive());
plug.SetEffectDefault(effect->IsDefault());
plug.SetEffectRealtime(effect->SupportsRealtime());
@ -2105,7 +2105,7 @@ void PluginManager::LoadGroup(wxFileConfig *pRegistry, PluginType type)
{
continue;
}
plug.SetEffectFamily(strVal);
plug.SetEffectFamilyId(strVal);
// Is it a default (above the line) effect and bypass group if not found
if (!pRegistry->Read(KEY_EFFECTDEFAULT, &boolVal))
@ -2277,7 +2277,7 @@ void PluginManager::SaveGroup(wxFileConfig *pRegistry, PluginType type)
stype = KEY_EFFECTTYPE_HIDDEN;
}
pRegistry->Write(KEY_EFFECTTYPE, stype);
pRegistry->Write(KEY_EFFECTFAMILY, plug.GetUntranslatedEffectFamily());
pRegistry->Write(KEY_EFFECTFAMILY, plug.GetEffectFamilyId());
pRegistry->Write(KEY_EFFECTDEFAULT, plug.IsEffectDefault());
pRegistry->Write(KEY_EFFECTINTERACTIVE, plug.IsEffectInteractive());
pRegistry->Write(KEY_EFFECTREALTIME, plug.IsEffectRealtime());
@ -2354,7 +2354,7 @@ void PluginManager::CheckForUpdates(bool bFast)
continue;
}
if ( (plugType == PluginTypeModule) )
if ( plugType == PluginTypeModule )
{
if( bFast )
{
@ -2416,7 +2416,7 @@ const PluginID & PluginManager::RegisterPlugin(EffectIdentInterface *effect)
PluginDescriptor & plug = CreatePlugin(GetID(effect), effect, PluginTypeEffect);
plug.SetEffectType(effect->GetType());
plug.SetEffectFamily(effect->GetFamily());
plug.SetEffectFamilyId(effect->GetFamilyId());
plug.SetEffectInteractive(effect->IsInteractive());
plug.SetEffectDefault(effect->IsDefault());
plug.SetEffectRealtime(effect->SupportsRealtime());
@ -2476,7 +2476,7 @@ const PluginDescriptor *PluginManager::GetFirstPlugin(PluginType type)
if (type == PluginTypeEffect)
{
// This preference may be written by EffectsPrefs
gPrefs->Read(plug.GetUntranslatedEffectFamily() + wxT("/Enable"), &familyEnabled, true);
gPrefs->Read(plug.GetEffectFamilyId() + wxT("/Enable"), &familyEnabled, true);
}
if (plug.IsValid() && plug.IsEnabled() && plug.GetPluginType() == type && familyEnabled)
{
@ -2496,7 +2496,7 @@ const PluginDescriptor *PluginManager::GetNextPlugin(PluginType type)
if (type == PluginTypeEffect)
{
// This preference may be written by EffectsPrefs
gPrefs->Read(plug.GetUntranslatedEffectFamily() + wxT("/Enable"), &familyEnabled, true);
gPrefs->Read(plug.GetEffectFamilyId() + wxT("/Enable"), &familyEnabled, true);
}
if (plug.IsValid() && plug.IsEnabled() && plug.GetPluginType() == type && familyEnabled)
{
@ -2517,7 +2517,7 @@ const PluginDescriptor *PluginManager::GetFirstPluginForEffectType(EffectType ty
bool familyEnabled;
// This preference may be written by EffectsPrefs
gPrefs->Read(plug.GetUntranslatedEffectFamily() + wxT("/Enable"), &familyEnabled, true);
gPrefs->Read(plug.GetEffectFamilyId() + wxT("/Enable"), &familyEnabled, true);
if (plug.IsValid() && plug.IsEnabled() && plug.GetEffectType() == type && familyEnabled)
{
if (plug.IsInstantiated() && em.IsHidden(plug.GetID()))
@ -2541,7 +2541,7 @@ const PluginDescriptor *PluginManager::GetNextPluginForEffectType(EffectType typ
PluginDescriptor & plug = mPluginsIter->second;
bool familyEnabled;
// This preference may be written by EffectsPrefs
gPrefs->Read(plug.GetUntranslatedEffectFamily() + wxT("/Enable"), &familyEnabled, true);
gPrefs->Read(plug.GetEffectFamilyId() + wxT("/Enable"), &familyEnabled, true);
if (plug.IsValid() && plug.IsEnabled() && plug.GetEffectType() == type && familyEnabled)
{
if (plug.IsInstantiated() && em.IsHidden(plug.GetID()))
@ -2634,7 +2634,7 @@ PluginID PluginManager::GetID(EffectIdentInterface *effect)
{
return wxString::Format(wxT("%s_%s_%s_%s_%s"),
GetPluginTypeString(PluginTypeEffect),
effect->GetFamily(),
effect->GetFamilyId(),
effect->GetVendor(),
effect->GetName(),
effect->GetPath());
@ -2931,7 +2931,7 @@ wxString PluginManager::SettingsPath(const PluginID & ID, bool shared)
wxString id = GetPluginTypeString(plug.GetPluginType()) +
wxT("_") +
plug.GetUntranslatedEffectFamily() + // is empty for non-Effects
plug.GetEffectFamilyId() + // is empty for non-Effects
wxT("_") +
plug.GetUntranslatedVendor() +
wxT("_") +

View File

@ -89,7 +89,7 @@ public:
// Effect plugins only
wxString GetUntranslatedEffectFamily() const;
wxString GetEffectFamilyId() const;
wxString GetTranslatedEffectFamily() const;
EffectType GetEffectType() const;
bool IsEffectDefault() const;
@ -99,7 +99,7 @@ public:
bool IsEffectAutomatable() const;
// "family" should be an untranslated string wrapped in wxT()
void SetEffectFamily(const wxString & family);
void SetEffectFamilyId(const wxString & family);
void SetEffectType(EffectType type);
void SetEffectDefault(bool dflt);
void SetEffectInteractive(bool interactive);

View File

@ -213,11 +213,11 @@ wxString Effect::GetDescription()
return wxEmptyString;
}
wxString Effect::GetFamily()
wxString Effect::GetFamilyId()
{
if (mClient)
{
return mClient->GetFamily();
return mClient->GetFamilyId();
}
// PRL: In 2.2.2 we wanted to change the user-visible name to
@ -232,6 +232,16 @@ wxString Effect::GetFamily()
return XO("Audacity");
}
wxString Effect::GetFamilyName()
{
if (mClient)
{
return mClient->GetFamilyName();
}
return XO("Built-in");
}
bool Effect::IsInteractive()
{
if (mClient)
@ -2480,7 +2490,7 @@ void Effect::Preview(bool dryOnly)
wxWindow *FocusDialog = wxWindow::FindFocus();
double previewDuration;
bool isNyquist = (GetFamily().IsSameAs(NYQUISTEFFECTS_FAMILY))? true : false;
bool isNyquist = GetFamilyId().IsSameAs(NYQUISTEFFECTS_FAMILY);
bool isGenerator = GetType() == EffectTypeGenerate;
// Mix a few seconds of audio from all of the tracks
@ -3271,7 +3281,7 @@ void EffectUIHost::OnCancel(wxCommandEvent & WXUNUSED(evt))
void EffectUIHost::OnHelp(wxCommandEvent & WXUNUSED(event))
{
if (mEffect->GetFamily().IsSameAs(NYQUISTEFFECTS_FAMILY) && (mEffect->ManualPage().IsEmpty())) {
if (mEffect->GetFamilyId().IsSameAs(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);
@ -3358,16 +3368,8 @@ void EffectUIHost::OnMenu(wxCommandEvent & WXUNUSED(evt))
{
auto sub = std::make_unique<wxMenu>();
auto type = mEffect->GetFamily();
// PRL: 2.2.2 hack to change the visible name without breaking
// compatibility of pluginsettings.cfg; redo this better
// See also PluginDescriptor::GetTranslatedEffectFamily
if (type == wxT("Audacity"))
type = XO("Built-in");
// And now, also, translate this (what 2.2.1 neglected)
type = wxGetTranslation(type);
sub->Append(kDummyID, wxString::Format(_("Type: %s"), type));
sub->Append(kDummyID, wxString::Format(_("Type: %s"),
::wxGetTranslation( mEffect->GetFamilyName() )));
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"), mEffect->GetVendor()));

View File

@ -87,7 +87,8 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler,
// EffectIdentInterface implementation
EffectType GetType() override;
wxString GetFamily() override; // returns UNTRANSLATED
wxString GetFamilyId() override;
wxString GetFamilyName() override;
bool IsInteractive() override;
bool IsDefault() override;
bool IsLegacy() override;

View File

@ -234,7 +234,12 @@ public:
return mDescription;
}
wxString GetFamily() override
wxString GetFamilyId() override
{
return VSTPLUGINTYPE;
}
wxString GetFamilyName() override
{
return VSTPLUGINTYPE;
}
@ -1246,7 +1251,12 @@ EffectType VSTEffect::GetType()
}
wxString VSTEffect::GetFamily()
wxString VSTEffect::GetFamilyId()
{
return VSTPLUGINTYPE;
}
wxString VSTEffect::GetFamilyName()
{
return VSTPLUGINTYPE;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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