Fix for bug #833
This allows duplicate items in the effects menus and provides a means to uniquely identify each item.
This commit is contained in:
parent
e5d2ef6ecd
commit
10f62cdae5
|
@ -50,7 +50,6 @@ public:
|
|||
virtual ~IdentInterface() {};
|
||||
|
||||
// These should return an untranslated value
|
||||
virtual PluginID GetID() = 0;
|
||||
virtual wxString GetPath() = 0;
|
||||
virtual wxString GetSymbol() = 0;
|
||||
|
||||
|
|
|
@ -91,10 +91,10 @@ public:
|
|||
|
||||
// For modules providing an interface to other dynamically loaded plugins,
|
||||
// the module returns true if the plugin is still valid, otherwise false.
|
||||
virtual bool IsPluginValid(const PluginID & ID, const wxString & path) = 0;
|
||||
virtual bool IsPluginValid(const wxString & path) = 0;
|
||||
|
||||
// When appropriate, CreateInstance() will be called to instantiate the plugin.
|
||||
virtual IdentInterface *CreateInstance(const PluginID & ID, const wxString & path) = 0;
|
||||
virtual IdentInterface *CreateInstance(const wxString & path) = 0;
|
||||
|
||||
// When appropriate, DeleteInstance() will be called to delete the plugin.
|
||||
virtual void DeleteInstance(IdentInterface *instance) = 0;
|
||||
|
|
|
@ -47,15 +47,18 @@
|
|||
#include "audacity/EffectInterface.h"
|
||||
#include "audacity/IdentInterface.h"
|
||||
#include "audacity/ImporterInterface.h"
|
||||
#include "audacity/ModuleInterface.h"
|
||||
|
||||
class ModuleInterface;
|
||||
|
||||
class PluginManagerInterface
|
||||
{
|
||||
public:
|
||||
virtual ~PluginManagerInterface() {};
|
||||
|
||||
virtual void RegisterModulePlugin(IdentInterface *module) = 0;
|
||||
virtual void RegisterEffectPlugin(IdentInterface *provider, EffectIdentInterface *effect) = 0;
|
||||
virtual void RegisterImporterPlugin(IdentInterface *provider, ImporterInterface *importer) = 0;
|
||||
virtual const PluginID & RegisterModulePlugin(ModuleInterface *module) = 0;
|
||||
virtual const PluginID & RegisterEffectPlugin(ModuleInterface *provider, EffectIdentInterface *effect) = 0;
|
||||
virtual const PluginID & RegisterImporterPlugin(ModuleInterface *provider, ImporterInterface *importer) = 0;
|
||||
|
||||
virtual void FindFilesInPathList(const wxString & pattern,
|
||||
const wxArrayString & pathList,
|
||||
|
|
|
@ -221,6 +221,9 @@ static int SortEffectsByName(const PluginDescriptor **a, const PluginDescriptor
|
|||
wxString akey = (*a)->GetName();
|
||||
wxString bkey = (*b)->GetName();
|
||||
|
||||
akey += (*a)->GetPath();
|
||||
bkey += (*b)->GetPath();
|
||||
|
||||
return akey.CmpNoCase(bkey);
|
||||
}
|
||||
|
||||
|
@ -241,6 +244,9 @@ static int SortEffectsByPublisher(const PluginDescriptor **a, const PluginDescri
|
|||
akey += (*a)->GetName();
|
||||
bkey += (*b)->GetName();
|
||||
|
||||
akey += (*a)->GetPath();
|
||||
bkey += (*b)->GetPath();
|
||||
|
||||
return akey.CmpNoCase(bkey);
|
||||
}
|
||||
|
||||
|
@ -261,6 +267,9 @@ static int SortEffectsByPublisherAndName(const PluginDescriptor **a, const Plugi
|
|||
akey += (*a)->GetName();
|
||||
bkey += (*b)->GetName();
|
||||
|
||||
akey += (*a)->GetPath();
|
||||
bkey += (*b)->GetPath();
|
||||
|
||||
return akey.CmpNoCase(bkey);
|
||||
}
|
||||
|
||||
|
@ -290,6 +299,9 @@ static int SortEffectsByTypeAndName(const PluginDescriptor **a, const PluginDesc
|
|||
akey += (*a)->GetName();
|
||||
bkey += (*b)->GetName();
|
||||
|
||||
akey += (*a)->GetPath();
|
||||
bkey += (*b)->GetPath();
|
||||
|
||||
return akey.CmpNoCase(bkey);
|
||||
}
|
||||
|
||||
|
@ -310,6 +322,9 @@ static int SortEffectsByType(const PluginDescriptor **a, const PluginDescriptor
|
|||
akey += (*a)->GetName();
|
||||
bkey += (*b)->GetName();
|
||||
|
||||
akey += (*a)->GetPath();
|
||||
bkey += (*b)->GetPath();
|
||||
|
||||
return akey.CmpNoCase(bkey);
|
||||
}
|
||||
|
||||
|
@ -1509,6 +1524,7 @@ void AudacityProject::AddEffectMenuItems(CommandManager *c,
|
|||
groupPlugs.Add(plug->GetID());
|
||||
groupFlags.Add(plug->IsEffectRealtime() ? realflags : batchflags);
|
||||
}
|
||||
|
||||
if (groupNames.GetCount() > 0)
|
||||
{
|
||||
AddEffectMenuItemGroup(c, groupNames, groupPlugs, groupFlags, isDefault);
|
||||
|
@ -1525,7 +1541,7 @@ void AudacityProject::AddEffectMenuItemGroup(CommandManager *c,
|
|||
const wxArrayInt & flags,
|
||||
bool isDefault)
|
||||
{
|
||||
int groupCnt = (int) names.GetCount();
|
||||
int namesCnt = (int) names.GetCount();
|
||||
int perGroup;
|
||||
|
||||
#if defined(__WXGTK__)
|
||||
|
@ -1534,8 +1550,18 @@ void AudacityProject::AddEffectMenuItemGroup(CommandManager *c,
|
|||
gPrefs->Read(wxT("/Effects/MaxPerGroup"), &perGroup, 0);
|
||||
#endif
|
||||
|
||||
int groupCnt = namesCnt;
|
||||
for (int i = 0; i < namesCnt; i++)
|
||||
{
|
||||
while (i + 1 < namesCnt && names[i].IsSameAs(names[i + 1]))
|
||||
{
|
||||
i++;
|
||||
groupCnt--;
|
||||
}
|
||||
}
|
||||
|
||||
// The "default" effects shouldn't be broken into subgroups
|
||||
if (groupCnt > 0 && isDefault)
|
||||
if (namesCnt > 0 && isDefault)
|
||||
{
|
||||
perGroup = 0;
|
||||
}
|
||||
|
@ -1548,30 +1574,53 @@ void AudacityProject::AddEffectMenuItemGroup(CommandManager *c,
|
|||
max = 0;
|
||||
}
|
||||
|
||||
for (int j = 0; j < groupCnt; j++)
|
||||
int groupNdx = 0;
|
||||
for (int i = 0; i < namesCnt; i++)
|
||||
{
|
||||
if (max > 0 && items == max)
|
||||
{
|
||||
int end = j + max;
|
||||
int end = groupNdx + max;
|
||||
if (end + 1 > groupCnt)
|
||||
{
|
||||
end = groupCnt;
|
||||
}
|
||||
c->BeginSubMenu(wxString::Format(_("Plug-ins %d to %d"),
|
||||
j + 1,
|
||||
groupNdx + 1,
|
||||
end));
|
||||
}
|
||||
|
||||
c->AddItem(names[j],
|
||||
names[j],
|
||||
FNS(OnEffect, plugs[j]),
|
||||
flags[j],
|
||||
flags[j]);
|
||||
if (i + 1 < namesCnt && names[i].IsSameAs(names[i + 1]))
|
||||
{
|
||||
wxString name = names[i];
|
||||
c->BeginSubMenu(name);
|
||||
while (i < namesCnt && names[i].IsSameAs(name))
|
||||
{
|
||||
wxString item = PluginManager::Get().GetPlugin(plugs[i])->GetPath();
|
||||
c->AddItem(item,
|
||||
item,
|
||||
FNS(OnEffect, plugs[i]),
|
||||
flags[i],
|
||||
flags[i]);
|
||||
|
||||
i++;
|
||||
}
|
||||
c->EndSubMenu();
|
||||
i--;
|
||||
}
|
||||
else
|
||||
{
|
||||
c->AddItem(names[i],
|
||||
names[i],
|
||||
FNS(OnEffect, plugs[i]),
|
||||
flags[i],
|
||||
flags[i]);
|
||||
}
|
||||
|
||||
if (max > 0)
|
||||
{
|
||||
groupNdx++;
|
||||
items--;
|
||||
if (items == 0 || j + 1 == groupCnt)
|
||||
if (items == 0 || i + 1 == namesCnt)
|
||||
{
|
||||
c->EndSubMenu();
|
||||
items = max;
|
||||
|
|
|
@ -395,7 +395,7 @@ bool ModuleManager::DiscoverProviders()
|
|||
ModuleInterface *module = LoadModule(provList[i]);
|
||||
if (module)
|
||||
{
|
||||
// First, we need to remember it
|
||||
// Register the provider
|
||||
pm.RegisterModulePlugin(module);
|
||||
|
||||
// Now, allow the module to auto-register children
|
||||
|
@ -416,12 +416,13 @@ void ModuleManager::InitializeBuiltins()
|
|||
|
||||
if (module->Initialize())
|
||||
{
|
||||
mDynModules[module->GetID()] = module;
|
||||
// Register the provider
|
||||
const PluginID & id = pm.RegisterModulePlugin(module);
|
||||
|
||||
// First, we need to remember it
|
||||
pm.RegisterModulePlugin(module);
|
||||
// Need to remember it
|
||||
mDynModules[id] = module;
|
||||
|
||||
// Now, allow the module to auto-register children
|
||||
// Allow the module to auto-register children
|
||||
module->AutoRegisterPlugins(pm);
|
||||
}
|
||||
}
|
||||
|
@ -444,7 +445,7 @@ ModuleInterface *ModuleManager::LoadModule(const wxString & path)
|
|||
if (module->Initialize())
|
||||
{
|
||||
|
||||
mDynModules[module->GetID()] = module;
|
||||
mDynModules[PluginManager::GetID(module)] = module;
|
||||
mLibs[module] = lib;
|
||||
|
||||
return module;
|
||||
|
@ -466,7 +467,7 @@ void ModuleManager::UnloadModule(ModuleInterface *module)
|
|||
{
|
||||
if (module)
|
||||
{
|
||||
const PluginID & modID = module->GetID();
|
||||
PluginID modID = PluginManager::GetID(module);
|
||||
|
||||
module->Terminate();
|
||||
|
||||
|
@ -484,7 +485,7 @@ void ModuleManager::UnloadModule(ModuleInterface *module)
|
|||
|
||||
void ModuleManager::RegisterModule(ModuleInterface *module)
|
||||
{
|
||||
wxString id = module->GetID();
|
||||
PluginID id = PluginManager::GetID(module);
|
||||
|
||||
if (mDynModules.find(id) != mDynModules.end())
|
||||
{
|
||||
|
@ -565,7 +566,6 @@ IdentInterface *ModuleManager::CreateProviderInstance(const PluginID & providerI
|
|||
}
|
||||
|
||||
IdentInterface *ModuleManager::CreateInstance(const PluginID & providerID,
|
||||
const PluginID & ID,
|
||||
const wxString & path)
|
||||
{
|
||||
if (mDynModules.find(providerID) == mDynModules.end())
|
||||
|
@ -573,7 +573,7 @@ IdentInterface *ModuleManager::CreateInstance(const PluginID & providerID,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return mDynModules[providerID]->CreateInstance(ID, path);
|
||||
return mDynModules[providerID]->CreateInstance(path);
|
||||
}
|
||||
|
||||
void ModuleManager::DeleteInstance(const PluginID & providerID,
|
||||
|
@ -606,7 +606,6 @@ bool ModuleManager::IsProviderValid(const PluginID & WXUNUSED(providerID),
|
|||
}
|
||||
|
||||
bool ModuleManager::IsPluginValid(const PluginID & providerID,
|
||||
const PluginID & ID,
|
||||
const wxString & path)
|
||||
{
|
||||
if (mDynModules.find(providerID) == mDynModules.end())
|
||||
|
@ -614,6 +613,6 @@ bool ModuleManager::IsPluginValid(const PluginID & providerID,
|
|||
return false;
|
||||
}
|
||||
|
||||
return mDynModules[providerID]->IsPluginValid(ID, path);
|
||||
return mDynModules[providerID]->IsPluginValid(path);
|
||||
}
|
||||
|
||||
|
|
|
@ -93,12 +93,12 @@ public:
|
|||
wxArrayString FindPluginsForProvider(const PluginID & provider, const wxString & path);
|
||||
bool RegisterPlugin(const PluginID & provider, const wxString & path);
|
||||
|
||||
IdentInterface *CreateProviderInstance(const PluginID & ID, const wxString & path);
|
||||
IdentInterface *CreateInstance(const PluginID & provider, const PluginID & ID, const wxString & path);
|
||||
IdentInterface *CreateProviderInstance(const PluginID & provider, const wxString & path);
|
||||
IdentInterface *CreateInstance(const PluginID & provider, const wxString & path);
|
||||
void DeleteInstance(const PluginID & provider, IdentInterface *instance);
|
||||
|
||||
bool IsProviderValid(const PluginID & provider, const wxString & path);
|
||||
bool IsPluginValid(const PluginID & provider, const PluginID & ID, const wxString & path);
|
||||
bool IsPluginValid(const PluginID & provider, const wxString & path);
|
||||
|
||||
private:
|
||||
void InitializeBuiltins();
|
||||
|
|
|
@ -805,7 +805,7 @@ IdentInterface *PluginDescriptor::GetInstance()
|
|||
}
|
||||
else
|
||||
{
|
||||
mInstance = ModuleManager::Get().CreateInstance(GetProviderID(), GetID(), GetPath());
|
||||
mInstance = ModuleManager::Get().CreateInstance(GetProviderID(), GetPath());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1083,19 +1083,21 @@ void PluginDescriptor::SetImporterExtensions(const wxArrayString & extensions)
|
|||
//
|
||||
// ============================================================================
|
||||
|
||||
void PluginManager::RegisterModulePlugin(IdentInterface *module)
|
||||
const PluginID & PluginManager::RegisterModulePlugin(ModuleInterface *module)
|
||||
{
|
||||
PluginDescriptor & plug = CreatePlugin(module, PluginTypeModule);
|
||||
PluginDescriptor & plug = CreatePlugin(GetID(module), module, PluginTypeModule);
|
||||
|
||||
plug.SetEnabled(true);
|
||||
plug.SetValid(true);
|
||||
|
||||
return plug.GetID();
|
||||
}
|
||||
|
||||
void PluginManager::RegisterEffectPlugin(IdentInterface *provider, EffectIdentInterface *effect)
|
||||
const PluginID & PluginManager::RegisterEffectPlugin(ModuleInterface *provider, EffectIdentInterface *effect)
|
||||
{
|
||||
PluginDescriptor & plug = CreatePlugin(effect, PluginTypeEffect);
|
||||
PluginDescriptor & plug = CreatePlugin(GetID(effect), effect, PluginTypeEffect);
|
||||
|
||||
plug.SetProviderID(provider->GetID());
|
||||
plug.SetProviderID(PluginManager::GetID(provider));
|
||||
|
||||
plug.SetEffectType(effect->GetType());
|
||||
plug.SetEffectFamily(effect->GetFamily());
|
||||
|
@ -1106,17 +1108,21 @@ void PluginManager::RegisterEffectPlugin(IdentInterface *provider, EffectIdentIn
|
|||
|
||||
plug.SetEnabled(true);
|
||||
plug.SetValid(true);
|
||||
|
||||
return plug.GetID();
|
||||
}
|
||||
|
||||
void PluginManager::RegisterImporterPlugin(IdentInterface *provider, ImporterInterface *importer)
|
||||
const PluginID & PluginManager::RegisterImporterPlugin(ModuleInterface *provider, ImporterInterface *importer)
|
||||
{
|
||||
PluginDescriptor & plug = CreatePlugin(importer, PluginTypeImporter);
|
||||
PluginDescriptor & plug = CreatePlugin(GetID(importer), importer, PluginTypeImporter);
|
||||
|
||||
plug.SetProviderID(provider->GetID());
|
||||
plug.SetProviderID(PluginManager::GetID(provider));
|
||||
|
||||
plug.SetImporterIdentifier(importer->GetPluginStringID());
|
||||
plug.SetImporterFilterDescription(importer->GetPluginFormatDescription());
|
||||
plug.SetImporterExtensions(importer->GetSupportedExtensions());
|
||||
|
||||
return plug.GetID();
|
||||
}
|
||||
|
||||
void PluginManager::FindFilesInPathList(const wxString & pattern,
|
||||
|
@ -1432,26 +1438,27 @@ void PluginManager::Load()
|
|||
}
|
||||
|
||||
// Load all provider plugins first
|
||||
LoadGroup(wxT("modules"), PluginTypeModule);
|
||||
LoadGroup(PluginTypeModule);
|
||||
|
||||
// Now the rest
|
||||
LoadGroup(wxT("effects"), PluginTypeEffect);
|
||||
LoadGroup(wxT("exporters"), PluginTypeExporter);
|
||||
LoadGroup(wxT("importers"), PluginTypeImporter);
|
||||
LoadGroup(PluginTypeEffect);
|
||||
LoadGroup(PluginTypeExporter);
|
||||
LoadGroup(PluginTypeImporter);
|
||||
|
||||
LoadGroup(wxT("placeholders"), PluginTypeNone);
|
||||
LoadGroup(PluginTypeNone);
|
||||
|
||||
delete mRegistry;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void PluginManager::LoadGroup(const wxChar * group, PluginType type)
|
||||
void PluginManager::LoadGroup(PluginType type)
|
||||
{
|
||||
wxString strVal;
|
||||
bool boolVal;
|
||||
wxString groupName;
|
||||
long groupIndex;
|
||||
wxString group = GetPluginTypeString(type);
|
||||
wxString cfgPath = REGROOT + group + wxCONFIG_PATH_SEPARATOR;
|
||||
|
||||
mRegistry->SetPath(cfgPath);
|
||||
|
@ -1669,13 +1676,13 @@ void PluginManager::Save()
|
|||
mRegistry->Write(REGVERKEY, REGVERCUR);
|
||||
|
||||
// Save the individual groups
|
||||
SaveGroup(wxT("effects"), PluginTypeEffect);
|
||||
SaveGroup(wxT("exporters"), PluginTypeExporter);
|
||||
SaveGroup(wxT("importers"), PluginTypeImporter);
|
||||
SaveGroup(wxT("placeholders"), PluginTypeNone);
|
||||
SaveGroup(PluginTypeEffect);
|
||||
SaveGroup(PluginTypeExporter);
|
||||
SaveGroup(PluginTypeImporter);
|
||||
SaveGroup(PluginTypeNone);
|
||||
|
||||
// And now the providers
|
||||
SaveGroup(wxT("modules"), PluginTypeModule);
|
||||
SaveGroup(PluginTypeModule);
|
||||
|
||||
// Just to be safe
|
||||
mRegistry->Flush();
|
||||
|
@ -1683,8 +1690,9 @@ void PluginManager::Save()
|
|||
delete mRegistry;
|
||||
}
|
||||
|
||||
void PluginManager::SaveGroup(const wxChar *group, PluginType type)
|
||||
void PluginManager::SaveGroup(PluginType type)
|
||||
{
|
||||
wxString group = GetPluginTypeString(type);
|
||||
for (PluginMap::iterator iter = mPlugins.begin(); iter != mPlugins.end(); iter++)
|
||||
{
|
||||
PluginDescriptor & plug = iter->second;
|
||||
|
@ -1809,7 +1817,7 @@ void PluginManager::CheckForUpdates()
|
|||
}
|
||||
else
|
||||
{
|
||||
plug.SetValid(mm.IsPluginValid(plug.GetProviderID(), plugID, plugPath));
|
||||
plug.SetValid(mm.IsPluginValid(plug.GetProviderID(), plugPath));
|
||||
}
|
||||
|
||||
iter++;
|
||||
|
@ -1913,6 +1921,7 @@ const PluginDescriptor *PluginManager::GetFirstPluginForEffectType(EffectType ty
|
|||
for (mPluginsIter = mPlugins.begin(); mPluginsIter != mPlugins.end(); mPluginsIter++)
|
||||
{
|
||||
PluginDescriptor & plug = mPluginsIter->second;
|
||||
|
||||
bool familyEnabled;
|
||||
if (type == PluginTypeEffect)
|
||||
{
|
||||
|
@ -1956,7 +1965,7 @@ bool PluginManager::IsRegistered(const PluginID & ID)
|
|||
|
||||
const PluginID & PluginManager::RegisterLegacyEffectPlugin(EffectIdentInterface *effect)
|
||||
{
|
||||
PluginDescriptor & plug = CreatePlugin(effect, PluginTypeEffect);
|
||||
PluginDescriptor & plug = CreatePlugin(GetID(effect), effect, PluginTypeEffect);
|
||||
|
||||
plug.SetEffectType(effect->GetType());
|
||||
plug.SetEffectFamily(effect->GetFamily());
|
||||
|
@ -2048,14 +2057,72 @@ void PluginManager::SetInstance(const PluginID & ID, IdentInterface *instance)
|
|||
return mPlugins[ID].SetInstance(instance);
|
||||
}
|
||||
|
||||
PluginDescriptor & PluginManager::CreatePlugin(IdentInterface *ident, PluginType type)
|
||||
PluginID PluginManager::GetID(ModuleInterface *module)
|
||||
{
|
||||
return wxString::Format(wxT("%s_%s_%s_%s_%s"),
|
||||
GetPluginTypeString(PluginTypeModule),
|
||||
wxEmptyString,
|
||||
module->GetVendor().c_str(),
|
||||
module->GetName().c_str(),
|
||||
module->GetPath().c_str());
|
||||
}
|
||||
|
||||
PluginID PluginManager::GetID(EffectIdentInterface *effect)
|
||||
{
|
||||
return wxString::Format(wxT("%s_%s_%s_%s_%s"),
|
||||
GetPluginTypeString(PluginTypeEffect),
|
||||
effect->GetFamily().c_str(),
|
||||
effect->GetVendor().c_str(),
|
||||
effect->GetName().c_str(),
|
||||
effect->GetPath().c_str());
|
||||
}
|
||||
|
||||
PluginID PluginManager::GetID(ImporterInterface *importer)
|
||||
{
|
||||
return wxString::Format(wxT("%s_%s_%s_%s_%s"),
|
||||
GetPluginTypeString(PluginTypeImporter),
|
||||
wxEmptyString,
|
||||
importer->GetVendor().c_str(),
|
||||
importer->GetName().c_str(),
|
||||
importer->GetPath().c_str());
|
||||
}
|
||||
|
||||
wxString PluginManager::GetPluginTypeString(PluginType type)
|
||||
{
|
||||
wxString str;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case PluginTypeNone:
|
||||
str = wxT("Placeholder");
|
||||
break;
|
||||
case PluginTypeEffect:
|
||||
str = wxT("Effect");
|
||||
break;
|
||||
case PluginTypeExporter:
|
||||
str = wxT("Exporter");
|
||||
break;
|
||||
case PluginTypeImporter:
|
||||
str = wxT("Importer");
|
||||
break;
|
||||
case PluginTypeModule:
|
||||
str = wxT("Module");
|
||||
break;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
PluginDescriptor & PluginManager::CreatePlugin(const PluginID & id,
|
||||
IdentInterface *ident,
|
||||
PluginType type)
|
||||
{
|
||||
// This will either create a new entry or replace an existing entry
|
||||
PluginDescriptor & plug = mPlugins[ident->GetID()];
|
||||
PluginDescriptor & plug = mPlugins[id];
|
||||
|
||||
plug.SetPluginType(type);
|
||||
|
||||
plug.SetID(ident->GetID());
|
||||
plug.SetID(id);
|
||||
plug.SetPath(ident->GetPath());
|
||||
plug.SetName(ident->GetName());
|
||||
plug.SetVendor(ident->GetVendor());
|
||||
|
@ -2303,15 +2370,28 @@ bool PluginManager::SetConfig(const wxString & key, const sampleCount & value)
|
|||
return result;
|
||||
}
|
||||
|
||||
wxString PluginManager::SharedGroup(const PluginID & ID, const wxString & group)
|
||||
wxString PluginManager::SettingsID(const PluginID & ID)
|
||||
{
|
||||
if (mPlugins.find(ID) == mPlugins.end())
|
||||
{
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
const PluginDescriptor & plug = mPlugins[ID];
|
||||
|
||||
return wxString::Format(wxT("%s_%s_%s_%s"),
|
||||
GetPluginTypeString(plug.GetPluginType()),
|
||||
plug.GetEffectFamily().c_str(), // is empty for non-Effects
|
||||
plug.GetVendor().c_str(),
|
||||
plug.GetName().c_str());
|
||||
}
|
||||
|
||||
wxString PluginManager::SharedGroup(const PluginID & ID, const wxString & group)
|
||||
{
|
||||
wxString settingsID = SettingsID(ID);
|
||||
|
||||
wxString path = SETROOT +
|
||||
ConvertID(mPlugins[ID].GetProviderID()) +
|
||||
ConvertID(settingsID) +
|
||||
wxCONFIG_PATH_SEPARATOR +
|
||||
wxT("shared") +
|
||||
wxCONFIG_PATH_SEPARATOR;
|
||||
|
@ -2338,13 +2418,10 @@ wxString PluginManager::SharedKey(const PluginID & ID, const wxString & group, c
|
|||
|
||||
wxString PluginManager::PrivateGroup(const PluginID & ID, const wxString & group)
|
||||
{
|
||||
if (mPlugins.find(ID) == mPlugins.end())
|
||||
{
|
||||
return wxEmptyString;
|
||||
}
|
||||
wxString settingsID = SettingsID(ID);
|
||||
|
||||
wxString path = SETROOT +
|
||||
ConvertID(ID) +
|
||||
ConvertID(settingsID) +
|
||||
wxCONFIG_PATH_SEPARATOR +
|
||||
wxT("private") +
|
||||
wxCONFIG_PATH_SEPARATOR;
|
||||
|
|
|
@ -55,11 +55,12 @@ public:
|
|||
// All plugins
|
||||
|
||||
// These return untranslated strings
|
||||
const wxString & GetID() const;
|
||||
const wxString & GetProviderID() const;
|
||||
const wxString & GetPath() const;
|
||||
const wxString & GetSymbol() const;
|
||||
|
||||
// These return translated strings (if available)
|
||||
const wxString & GetID() const;
|
||||
wxString GetName() const;
|
||||
wxString GetVersion() const;
|
||||
wxString GetVendor() const;
|
||||
|
@ -172,9 +173,9 @@ public:
|
|||
|
||||
// PluginManagerInterface implementation
|
||||
|
||||
void RegisterModulePlugin(IdentInterface *module);
|
||||
void RegisterEffectPlugin(IdentInterface *provider, EffectIdentInterface *effect);
|
||||
void RegisterImporterPlugin(IdentInterface *provider, ImporterInterface *importer);
|
||||
const PluginID & RegisterModulePlugin(ModuleInterface *module);
|
||||
const PluginID & RegisterEffectPlugin(ModuleInterface *provider, EffectIdentInterface *effect);
|
||||
const PluginID & RegisterImporterPlugin(ModuleInterface *provider, ImporterInterface *importer);
|
||||
|
||||
void FindFilesInPathList(const wxString & pattern,
|
||||
const wxArrayString & pathList,
|
||||
|
@ -226,8 +227,11 @@ public:
|
|||
|
||||
static PluginManager & Get();
|
||||
|
||||
bool HasType(PluginType type);
|
||||
void PurgeType(PluginType type);
|
||||
static PluginID GetID(ModuleInterface *module);
|
||||
static PluginID GetID(EffectIdentInterface *effect);
|
||||
static PluginID GetID(ImporterInterface *importer);
|
||||
|
||||
static wxString GetPluginTypeString(PluginType type);
|
||||
|
||||
int GetPluginCount(PluginType type);
|
||||
const PluginDescriptor *GetPlugin(const PluginID & ID);
|
||||
|
@ -256,15 +260,15 @@ public:
|
|||
|
||||
private:
|
||||
void Load();
|
||||
void LoadGroup(const wxChar *group, PluginType type);
|
||||
void LoadGroup(PluginType type);
|
||||
void Save();
|
||||
void SaveGroup(const wxChar *group, PluginType type);
|
||||
void SaveGroup(PluginType type);
|
||||
|
||||
void CheckForUpdates();
|
||||
void DisableMissing();
|
||||
wxArrayString IsNewOrUpdated(const wxArrayString & paths);
|
||||
|
||||
PluginDescriptor & CreatePlugin(IdentInterface *ident, PluginType type);
|
||||
PluginDescriptor & CreatePlugin(const PluginID & id, IdentInterface *ident, PluginType type);
|
||||
|
||||
wxFileConfig *GetSettings();
|
||||
|
||||
|
@ -284,6 +288,7 @@ private:
|
|||
bool SetConfig(const wxString & key, const double & value);
|
||||
bool SetConfig(const wxString & key, const sampleCount & value);
|
||||
|
||||
wxString SettingsID(const PluginID & ID);
|
||||
wxString SharedGroup(const PluginID & ID, const wxString & group);
|
||||
wxString SharedKey(const PluginID & ID, const wxString & group, const wxString & key);
|
||||
wxString PrivateGroup(const PluginID & ID, const wxString & group);
|
||||
|
|
|
@ -153,16 +153,6 @@ EffectType Effect::GetType()
|
|||
return EffectTypeNone;
|
||||
}
|
||||
|
||||
PluginID Effect::GetID()
|
||||
{
|
||||
if (mClient)
|
||||
{
|
||||
return mClient->GetID();
|
||||
}
|
||||
|
||||
return wxString::Format(wxT("LEGACY_EFFECT_ID_%d"), GetEffectID());
|
||||
}
|
||||
|
||||
wxString Effect::GetPath()
|
||||
{
|
||||
if (mClient)
|
||||
|
@ -513,6 +503,16 @@ bool Effect::RemovePrivateConfig(const wxString & group, const wxString & key)
|
|||
|
||||
// Effect implementation
|
||||
|
||||
PluginID Effect::GetID()
|
||||
{
|
||||
if (mClient)
|
||||
{
|
||||
return PluginManager::GetID(mClient);
|
||||
}
|
||||
|
||||
return wxString::Format(wxT("LEGACY_EFFECT_ID_%d"), GetEffectID());
|
||||
}
|
||||
|
||||
bool Effect::Startup(EffectClientInterface *client)
|
||||
{
|
||||
// Let destructor know we need to be shutdown
|
||||
|
|
|
@ -82,7 +82,6 @@ class AUDACITY_DLL_API Effect : public EffectHostInterface
|
|||
|
||||
// IdentInterface implementation
|
||||
|
||||
virtual PluginID GetID();
|
||||
virtual wxString GetPath();
|
||||
virtual wxString GetSymbol();
|
||||
virtual wxString GetName();
|
||||
|
@ -156,6 +155,7 @@ class AUDACITY_DLL_API Effect : public EffectHostInterface
|
|||
|
||||
// Effect implementation
|
||||
|
||||
virtual PluginID GetID();
|
||||
virtual bool Startup(EffectClientInterface *client);
|
||||
virtual bool GetAutomationParameters(wxString & parms);
|
||||
virtual bool SetAutomationParameters(const wxString & parms);
|
||||
|
|
|
@ -215,7 +215,7 @@ EffectManager::~EffectManager()
|
|||
}
|
||||
}
|
||||
|
||||
void EffectManager::RegisterEffect(IdentInterface *p, Effect *f, int NewFlags)
|
||||
void EffectManager::RegisterEffect(ModuleInterface *p, Effect *f, int NewFlags)
|
||||
{
|
||||
f->SetEffectID(mNumEffects++);
|
||||
|
||||
|
@ -224,9 +224,7 @@ void EffectManager::RegisterEffect(IdentInterface *p, Effect *f, int NewFlags)
|
|||
f->SetEffectFlags( NewFlags );
|
||||
}
|
||||
|
||||
PluginManager::Get().RegisterEffectPlugin(p, f);
|
||||
|
||||
mEffects[f->GetID()] = f;
|
||||
mEffects[PluginManager::Get().RegisterEffectPlugin(p, f)] = f;
|
||||
}
|
||||
|
||||
void EffectManager::RegisterEffect(Effect *f, int NewFlags)
|
||||
|
@ -779,11 +777,20 @@ Effect *EffectManager::GetEffect(const PluginID & ID)
|
|||
// TODO: This is temporary and should be redone when all effects are converted
|
||||
if (mEffects.find(ID) == mEffects.end())
|
||||
{
|
||||
EffectIdentInterface *ident = dynamic_cast<EffectIdentInterface *>(PluginManager::Get().GetInstance(ID));
|
||||
if (ident && ident->IsLegacy())
|
||||
{
|
||||
effect = dynamic_cast<Effect *>(ident);
|
||||
effect->SetEffectID(mNumEffects++);
|
||||
mEffects[ID] = effect;
|
||||
return effect;
|
||||
}
|
||||
|
||||
effect = new Effect();
|
||||
if (effect)
|
||||
{
|
||||
// This will instantiate the effect client if it hasn't already been done
|
||||
EffectClientInterface *client = dynamic_cast<EffectClientInterface *>(PluginManager::Get().GetInstance(ID));
|
||||
EffectClientInterface *client = dynamic_cast<EffectClientInterface *>(ident);
|
||||
if (client && effect->Startup(client))
|
||||
{
|
||||
effect->SetEffectID(mNumEffects++);
|
||||
|
|
|
@ -67,7 +67,7 @@ class AUDACITY_DLL_API EffectManager
|
|||
|
||||
/** Register an effect so it will appear in the menu. */
|
||||
void RegisterEffect(Effect *f, int AdditionalFlags=0);
|
||||
void RegisterEffect(IdentInterface *p, Effect *f, int AdditionalFlags=0);
|
||||
void RegisterEffect(ModuleInterface *p, Effect *f, int AdditionalFlags=0);
|
||||
|
||||
/** Unregister all effects. */
|
||||
void UnregisterEffects();
|
||||
|
|
|
@ -178,7 +178,6 @@ enum InfoKeys
|
|||
{
|
||||
kKeySubIDs,
|
||||
kKeyBegin,
|
||||
kKeyID,
|
||||
kKeyName,
|
||||
kKeyPath,
|
||||
kKeyVendor,
|
||||
|
@ -201,11 +200,6 @@ public:
|
|||
|
||||
// EffectClientInterface implementation
|
||||
|
||||
PluginID GetID()
|
||||
{
|
||||
return mID;
|
||||
}
|
||||
|
||||
wxString GetPath()
|
||||
{
|
||||
return mPath;
|
||||
|
@ -272,7 +266,6 @@ public:
|
|||
}
|
||||
|
||||
public:
|
||||
PluginID mID;
|
||||
wxString mPath;
|
||||
wxString mName;
|
||||
wxString mVendor;
|
||||
|
@ -307,12 +300,6 @@ VSTEffectsModule::~VSTEffectsModule()
|
|||
// IdentInterface implementation
|
||||
// ============================================================================
|
||||
|
||||
wxString VSTEffectsModule::GetID()
|
||||
{
|
||||
// Can be anything, but this is a v4 UUID
|
||||
return wxT("c5520489-0253-418e-bdcd-daba3a227b28");
|
||||
}
|
||||
|
||||
wxString VSTEffectsModule::GetPath()
|
||||
{
|
||||
return mPath;
|
||||
|
@ -560,11 +547,6 @@ bool VSTEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxStrin
|
|||
keycount++;
|
||||
break;
|
||||
|
||||
case kKeyID:
|
||||
proc->mID = val;
|
||||
keycount++;
|
||||
break;
|
||||
|
||||
case kKeyName:
|
||||
proc->mName = val;
|
||||
keycount++;
|
||||
|
@ -650,15 +632,13 @@ bool VSTEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxStrin
|
|||
return valid;
|
||||
}
|
||||
|
||||
bool VSTEffectsModule::IsPluginValid(const PluginID & WXUNUSED(ID),
|
||||
const wxString & path)
|
||||
bool VSTEffectsModule::IsPluginValid(const wxString & path)
|
||||
{
|
||||
wxString realPath = path.BeforeFirst(wxT(';'));
|
||||
return wxFileName::FileExists(realPath) || wxFileName::DirExists(realPath);
|
||||
}
|
||||
|
||||
IdentInterface *VSTEffectsModule::CreateInstance(const PluginID & WXUNUSED(ID),
|
||||
const wxString & path)
|
||||
IdentInterface *VSTEffectsModule::CreateInstance(const wxString & path)
|
||||
{
|
||||
// For us, the ID is simply the path to the effect
|
||||
return new VSTEffect(path);
|
||||
|
@ -708,7 +688,6 @@ void VSTEffectsModule::Check(const wxChar *path)
|
|||
else
|
||||
{
|
||||
out += wxString::Format(wxT("%s%d=%s\n"), OUTPUTKEY, kKeyBegin, wxEmptyString);
|
||||
out += wxString::Format(wxT("%s%d=%s\n"), OUTPUTKEY, kKeyID, effect->GetID().c_str());
|
||||
out += wxString::Format(wxT("%s%d=%s\n"), OUTPUTKEY, kKeyPath, effect->GetPath().c_str());
|
||||
out += wxString::Format(wxT("%s%d=%s\n"), OUTPUTKEY, kKeyName, effect->GetName().c_str());
|
||||
out += wxString::Format(wxT("%s%d=%s\n"), OUTPUTKEY, kKeyVendor, effect->GetVendor().c_str());
|
||||
|
@ -1664,11 +1643,6 @@ VSTEffect::~VSTEffect()
|
|||
// IdentInterface Implementation
|
||||
// ============================================================================
|
||||
|
||||
wxString VSTEffect::GetID()
|
||||
{
|
||||
return wxString(wxT("VST_") + GetVendor() + wxT("_") + GetName() + wxT("_") + GetVersion());
|
||||
}
|
||||
|
||||
wxString VSTEffect::GetPath()
|
||||
{
|
||||
return mPath;
|
||||
|
|
|
@ -74,7 +74,6 @@ class VSTEffect : public EffectClientInterface,
|
|||
|
||||
// IdentInterface implementation
|
||||
|
||||
virtual PluginID GetID();
|
||||
virtual wxString GetPath();
|
||||
virtual wxString GetSymbol();
|
||||
virtual wxString GetName();
|
||||
|
@ -403,7 +402,6 @@ public:
|
|||
|
||||
// IdentInterface implementatino
|
||||
|
||||
virtual wxString GetID();
|
||||
virtual wxString GetPath();
|
||||
virtual wxString GetSymbol();
|
||||
virtual wxString GetName();
|
||||
|
@ -420,9 +418,9 @@ public:
|
|||
virtual wxArrayString FindPlugins(PluginManagerInterface & pm);
|
||||
virtual bool RegisterPlugin(PluginManagerInterface & pm, const wxString & path);
|
||||
|
||||
virtual bool IsPluginValid(const PluginID & ID, const wxString & path);
|
||||
virtual bool IsPluginValid(const wxString & path);
|
||||
|
||||
virtual IdentInterface *CreateInstance(const PluginID & ID, const wxString & path);
|
||||
virtual IdentInterface *CreateInstance(const wxString & path);
|
||||
virtual void DeleteInstance(IdentInterface *instance);
|
||||
|
||||
// VSTEffectModule implementation
|
||||
|
|
|
@ -79,12 +79,6 @@ AudioUnitEffectsModule::~AudioUnitEffectsModule()
|
|||
// IdentInterface implementation
|
||||
// ============================================================================
|
||||
|
||||
wxString AudioUnitEffectsModule::GetID()
|
||||
{
|
||||
// Can be anything, but this is a v4 UUID
|
||||
return wxT("1e767ec4-6f78-4c94-b6b8-c50b5780093b");
|
||||
}
|
||||
|
||||
wxString AudioUnitEffectsModule::GetPath()
|
||||
{
|
||||
return mPath;
|
||||
|
@ -171,15 +165,13 @@ bool AudioUnitEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const w
|
|||
return true;
|
||||
}
|
||||
|
||||
bool AudioUnitEffectsModule::IsPluginValid(const PluginID & ID,
|
||||
const wxString & path)
|
||||
bool AudioUnitEffectsModule::IsPluginValid(const wxString & path)
|
||||
{
|
||||
wxString name;
|
||||
return FindAudioUnit(path, name) != NULL;
|
||||
}
|
||||
|
||||
IdentInterface *AudioUnitEffectsModule::CreateInstance(const PluginID & ID,
|
||||
const wxString & path)
|
||||
IdentInterface *AudioUnitEffectsModule::CreateInstance(const wxString & path)
|
||||
{
|
||||
wxString name;
|
||||
Component component = FindAudioUnit(path, name);
|
||||
|
@ -495,7 +487,7 @@ void AudioUnitEffectExportDialog::OnOk(wxCommandEvent & WXUNUSED(evt))
|
|||
fn.Normalize();
|
||||
fn.Mkdir(0755, wxPATH_MKDIR_FULL);
|
||||
path = fn.GetFullPath();
|
||||
wxPrintf(wxT("path %s\n"), path.c_str());
|
||||
|
||||
// First set the name of the preset
|
||||
wxMacCFStringHolder cfname;
|
||||
cfname.Assign(name);
|
||||
|
@ -966,11 +958,6 @@ AudioUnitEffect::~AudioUnitEffect()
|
|||
// IdentInterface implementation
|
||||
// ============================================================================
|
||||
|
||||
wxString AudioUnitEffect::GetID()
|
||||
{
|
||||
return mPath;
|
||||
}
|
||||
|
||||
wxString AudioUnitEffect::GetPath()
|
||||
{
|
||||
return mPath;
|
||||
|
|
|
@ -48,7 +48,6 @@ public:
|
|||
|
||||
// IdentInterface implementation
|
||||
|
||||
virtual PluginID GetID();
|
||||
virtual wxString GetPath();
|
||||
virtual wxString GetSymbol();
|
||||
virtual wxString GetName();
|
||||
|
@ -258,7 +257,6 @@ public:
|
|||
|
||||
// IdentInterface implementatino
|
||||
|
||||
virtual wxString GetID();
|
||||
virtual wxString GetPath();
|
||||
virtual wxString GetSymbol();
|
||||
virtual wxString GetName();
|
||||
|
@ -275,9 +273,9 @@ public:
|
|||
virtual wxArrayString FindPlugins(PluginManagerInterface & pm);
|
||||
virtual bool RegisterPlugin(PluginManagerInterface & pm, const wxString & path);
|
||||
|
||||
virtual bool IsPluginValid(const PluginID & ID, const wxString & path);
|
||||
virtual bool IsPluginValid(const wxString & path);
|
||||
|
||||
virtual IdentInterface *CreateInstance(const PluginID & ID, const wxString & path);
|
||||
virtual IdentInterface *CreateInstance(const wxString & path);
|
||||
virtual void DeleteInstance(IdentInterface *instance);
|
||||
|
||||
// AudioUnitEffectModule implementation
|
||||
|
|
|
@ -95,12 +95,6 @@ LadspaEffectsModule::~LadspaEffectsModule()
|
|||
// IdentInterface implementation
|
||||
// ============================================================================
|
||||
|
||||
wxString LadspaEffectsModule::GetID()
|
||||
{
|
||||
// Can be anything, but this is a v4 UUID
|
||||
return wxT("3ebd9fb9-c020-4c0d-a786-d6a914e55e31");
|
||||
}
|
||||
|
||||
wxString LadspaEffectsModule::GetPath()
|
||||
{
|
||||
return mPath;
|
||||
|
@ -352,22 +346,22 @@ bool LadspaEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxSt
|
|||
return index > 0;
|
||||
}
|
||||
|
||||
bool LadspaEffectsModule::IsPluginValid(const PluginID & WXUNUSED(ID),
|
||||
const wxString & path)
|
||||
bool LadspaEffectsModule::IsPluginValid(const wxString & path)
|
||||
{
|
||||
return wxFileName::FileExists(path);
|
||||
wxString realPath = path.BeforeFirst(wxT(';'));
|
||||
return wxFileName::FileExists(realPath);
|
||||
}
|
||||
|
||||
IdentInterface *LadspaEffectsModule::CreateInstance(const PluginID & ID,
|
||||
const wxString & path)
|
||||
IdentInterface *LadspaEffectsModule::CreateInstance(const wxString & path)
|
||||
{
|
||||
// For us, the ID is two words.
|
||||
// 1) The LADSPA descriptor index
|
||||
// 2) The library's path
|
||||
// For us, the path is two words.
|
||||
// 1) The library's path
|
||||
// 2) The LADSPA descriptor index
|
||||
long index;
|
||||
ID.BeforeFirst(wxT(' ')).ToLong(&index);
|
||||
wxString realPath = path.BeforeFirst(wxT(';'));
|
||||
path.AfterFirst(wxT(';')).ToLong(&index);
|
||||
|
||||
return new LadspaEffect(path, (int) index);
|
||||
return new LadspaEffect(realPath, (int) index);
|
||||
}
|
||||
|
||||
void LadspaEffectsModule::DeleteInstance(IdentInterface *instance)
|
||||
|
@ -607,14 +601,9 @@ LadspaEffect::~LadspaEffect()
|
|||
// IdentInterface implementation
|
||||
// ============================================================================
|
||||
|
||||
wxString LadspaEffect::GetID()
|
||||
{
|
||||
return wxString::Format(wxT("%d %s"), mIndex, mPath.c_str());
|
||||
}
|
||||
|
||||
wxString LadspaEffect::GetPath()
|
||||
{
|
||||
return mPath;
|
||||
return wxString::Format(wxT("%s;%d"), mPath.c_str(), mIndex);
|
||||
}
|
||||
|
||||
wxString LadspaEffect::GetSymbol()
|
||||
|
@ -1489,6 +1478,7 @@ bool LadspaEffect::Load()
|
|||
}
|
||||
|
||||
LADSPA_Descriptor_Function mainFn = NULL;
|
||||
|
||||
if (mLib.Load(mPath, wxDL_NOW))
|
||||
{
|
||||
wxLogNull logNo;
|
||||
|
|
|
@ -45,7 +45,6 @@ public:
|
|||
|
||||
// IdentInterface implementation
|
||||
|
||||
virtual PluginID GetID();
|
||||
virtual wxString GetPath();
|
||||
virtual wxString GetSymbol();
|
||||
virtual wxString GetName();
|
||||
|
@ -234,7 +233,6 @@ public:
|
|||
|
||||
// IdentInterface implementatino
|
||||
|
||||
virtual wxString GetID();
|
||||
virtual wxString GetPath();
|
||||
virtual wxString GetSymbol();
|
||||
virtual wxString GetName();
|
||||
|
@ -251,9 +249,9 @@ public:
|
|||
virtual wxArrayString FindPlugins(PluginManagerInterface & pm);
|
||||
virtual bool RegisterPlugin(PluginManagerInterface & pm, const wxString & path);
|
||||
|
||||
virtual bool IsPluginValid(const PluginID & ID, const wxString & path);
|
||||
virtual bool IsPluginValid(const wxString & path);
|
||||
|
||||
virtual IdentInterface *CreateInstance(const PluginID & ID, const wxString & path);
|
||||
virtual IdentInterface *CreateInstance(const wxString & path);
|
||||
virtual void DeleteInstance(IdentInterface *instance);
|
||||
|
||||
// LadspaEffectModule implementation
|
||||
|
|
|
@ -302,14 +302,9 @@ LV2Effect::~LV2Effect()
|
|||
// IdentInterface implementation
|
||||
// ============================================================================
|
||||
|
||||
wxString LV2Effect::GetID()
|
||||
{
|
||||
return GetString(lilv_plugin_get_uri(mData));
|
||||
}
|
||||
|
||||
wxString LV2Effect::GetPath()
|
||||
{
|
||||
return GetString(lilv_plugin_get_bundle_uri(mData));
|
||||
return GetString(lilv_plugin_get_uri(mData));
|
||||
}
|
||||
|
||||
wxString LV2Effect::GetSymbol()
|
||||
|
|
|
@ -70,7 +70,6 @@ public:
|
|||
|
||||
// IdentInterface implementation
|
||||
|
||||
virtual PluginID GetID();
|
||||
virtual wxString GetPath();
|
||||
virtual wxString GetSymbol();
|
||||
virtual wxString GetName();
|
||||
|
|
|
@ -140,12 +140,6 @@ LV2EffectsModule::~LV2EffectsModule()
|
|||
// IdentInterface implementation
|
||||
// ============================================================================
|
||||
|
||||
wxString LV2EffectsModule::GetID()
|
||||
{
|
||||
// Can be anything, but this is a v4 UUID
|
||||
return wxT("5d03b6ad-ca64-41b2-a3f2-785ff5b279d9");
|
||||
}
|
||||
|
||||
wxString LV2EffectsModule::GetPath()
|
||||
{
|
||||
return mPath;
|
||||
|
@ -322,18 +316,16 @@ bool LV2EffectsModule::RegisterPlugin(PluginManagerInterface & WXUNUSED(pm), con
|
|||
return false;
|
||||
}
|
||||
|
||||
bool LV2EffectsModule::IsPluginValid(const PluginID & ID,
|
||||
const wxString & WXUNUSED(path))
|
||||
bool LV2EffectsModule::IsPluginValid(const wxString & path)
|
||||
{
|
||||
LilvNode *uri = lilv_new_uri(gWorld, ID.ToUTF8());
|
||||
LilvNode *uri = lilv_new_uri(gWorld, path.ToUTF8());
|
||||
const LilvPlugin *plugin = lilv_plugins_get_by_uri(lilv_world_get_all_plugins(gWorld), uri);
|
||||
lilv_node_free(uri);
|
||||
|
||||
return plugin != NULL;
|
||||
}
|
||||
|
||||
IdentInterface *LV2EffectsModule::CreateInstance(const PluginID & WXUNUSED(ID),
|
||||
const wxString & WXUNUSED(path))
|
||||
IdentInterface *LV2EffectsModule::CreateInstance(const wxString & WXUNUSED(path))
|
||||
{
|
||||
// Nothing to do here yet since we are autoregistering (and creating legacy
|
||||
// effects anyway).
|
||||
|
|
|
@ -29,7 +29,6 @@ public:
|
|||
|
||||
// IdentInterface implementatino
|
||||
|
||||
virtual wxString GetID();
|
||||
virtual wxString GetPath();
|
||||
virtual wxString GetSymbol();
|
||||
virtual wxString GetName();
|
||||
|
@ -46,9 +45,9 @@ public:
|
|||
virtual wxArrayString FindPlugins(PluginManagerInterface & pm);
|
||||
virtual bool RegisterPlugin(PluginManagerInterface & pm, const wxString & path);
|
||||
|
||||
virtual bool IsPluginValid(const PluginID & ID, const wxString & path);
|
||||
virtual bool IsPluginValid(const wxString & path);
|
||||
|
||||
virtual IdentInterface *CreateInstance(const PluginID & ID, const wxString & path);
|
||||
virtual IdentInterface *CreateInstance(const wxString & path);
|
||||
virtual void DeleteInstance(IdentInterface *instance);
|
||||
|
||||
// LV2EffectModule implementation
|
||||
|
|
|
@ -57,12 +57,6 @@ NyquistEffectsModule::~NyquistEffectsModule()
|
|||
// IdentInterface implementation
|
||||
// ============================================================================
|
||||
|
||||
wxString NyquistEffectsModule::GetID()
|
||||
{
|
||||
// Can be anything, but this is a v4 UUID
|
||||
return wxT("42a58b1e-cc24-4b55-861a-4b2008a7cf7b");
|
||||
}
|
||||
|
||||
wxString NyquistEffectsModule::GetPath()
|
||||
{
|
||||
return mPath;
|
||||
|
@ -156,10 +150,9 @@ bool NyquistEffectsModule::RegisterPlugin(PluginManagerInterface & WXUNUSED(pm),
|
|||
return false;
|
||||
}
|
||||
|
||||
bool NyquistEffectsModule::IsPluginValid(const PluginID & ID,
|
||||
const wxString & path)
|
||||
bool NyquistEffectsModule::IsPluginValid(const wxString & path)
|
||||
{
|
||||
if (ID == wxT("nyquist prompt"))
|
||||
if (path == wxT("nyquist prompt"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -167,17 +160,25 @@ bool NyquistEffectsModule::IsPluginValid(const PluginID & ID,
|
|||
return wxFileName::FileExists(path);
|
||||
}
|
||||
|
||||
IdentInterface *NyquistEffectsModule::CreateInstance(const PluginID & WXUNUSED(ID),
|
||||
const wxString & WXUNUSED(path))
|
||||
IdentInterface *NyquistEffectsModule::CreateInstance(const wxString & path)
|
||||
{
|
||||
// Nothing to do here yet since we are autoregistering (and creating legacy
|
||||
// effects anyway).
|
||||
// Normally, we wouldn't have anything to do here since we're autoregistering, but
|
||||
// if we have Nyquist effects in directories we didn't scan.
|
||||
|
||||
EffectNyquist *effect = new EffectNyquist(path);
|
||||
if (effect->LoadedNyFile())
|
||||
{
|
||||
return effect;
|
||||
}
|
||||
|
||||
delete effect;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void NyquistEffectsModule::DeleteInstance(IdentInterface *WXUNUSED(instance))
|
||||
void NyquistEffectsModule::DeleteInstance(IdentInterface *instance)
|
||||
{
|
||||
// Nothing to do here yet
|
||||
// Nothing to do here
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
|
|
@ -26,7 +26,6 @@ public:
|
|||
|
||||
// IdentInterface implementatino
|
||||
|
||||
virtual wxString GetID();
|
||||
virtual wxString GetPath();
|
||||
virtual wxString GetSymbol();
|
||||
virtual wxString GetName();
|
||||
|
@ -43,9 +42,9 @@ public:
|
|||
virtual wxArrayString FindPlugins(PluginManagerInterface & pm);
|
||||
virtual bool RegisterPlugin(PluginManagerInterface & pm, const wxString & path);
|
||||
|
||||
virtual bool IsPluginValid(const PluginID & ID, const wxString & path);
|
||||
virtual bool IsPluginValid(const wxString & path);
|
||||
|
||||
virtual IdentInterface *CreateInstance(const PluginID & ID, const wxString & path);
|
||||
virtual IdentInterface *CreateInstance(const wxString & path);
|
||||
virtual void DeleteInstance(IdentInterface *instance);
|
||||
|
||||
// NyquistEffectModule implementation
|
||||
|
|
|
@ -145,11 +145,6 @@ EffectNyquist::~EffectNyquist()
|
|||
// IdentInterface implementation
|
||||
// ============================================================================
|
||||
|
||||
wxString EffectNyquist::GetID()
|
||||
{
|
||||
return GetPath();
|
||||
}
|
||||
|
||||
wxString EffectNyquist::GetPath()
|
||||
{
|
||||
if (mFileName.GetFullPath().IsEmpty())
|
||||
|
@ -172,7 +167,7 @@ wxString EffectNyquist::GetName()
|
|||
|
||||
wxString EffectNyquist::GetVendor()
|
||||
{
|
||||
if (GetID() == wxT("nyquist prompt"))
|
||||
if (GetPath() == wxT("nyquist prompt"))
|
||||
{
|
||||
return _("Audacity");
|
||||
}
|
||||
|
@ -213,7 +208,7 @@ bool EffectNyquist::IsInteractive()
|
|||
|
||||
bool EffectNyquist::IsDefault()
|
||||
{
|
||||
if (GetID() == wxT("nyquist prompt"))
|
||||
if (GetPath() == wxT("nyquist prompt"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,6 @@ class AUDACITY_DLL_API EffectNyquist:public Effect
|
|||
|
||||
// IdentInterface implementation
|
||||
|
||||
virtual PluginID GetID();
|
||||
virtual wxString GetPath();
|
||||
virtual wxString GetSymbol();
|
||||
virtual wxString GetName();
|
||||
|
|
|
@ -65,12 +65,6 @@ VampEffectsModule::~VampEffectsModule()
|
|||
// IdentInterface implementation
|
||||
// ============================================================================
|
||||
|
||||
wxString VampEffectsModule::GetID()
|
||||
{
|
||||
// Can be anything, but this is a v4 UUID
|
||||
return wxT("33a86140-7310-4bdf-ad8e-a4af29079f61");
|
||||
}
|
||||
|
||||
wxString VampEffectsModule::GetPath()
|
||||
{
|
||||
return mPath;
|
||||
|
@ -225,14 +219,12 @@ bool VampEffectsModule::RegisterPlugin(PluginManagerInterface & WXUNUSED(pm), co
|
|||
return false;
|
||||
}
|
||||
|
||||
bool VampEffectsModule::IsPluginValid(const PluginID & WXUNUSED(ID),
|
||||
const wxString & path)
|
||||
bool VampEffectsModule::IsPluginValid(const wxString & path)
|
||||
{
|
||||
return wxFileName::FileExists(path);
|
||||
}
|
||||
|
||||
IdentInterface *VampEffectsModule::CreateInstance(const PluginID & WXUNUSED(ID),
|
||||
const wxString & WXUNUSED(path))
|
||||
IdentInterface *VampEffectsModule::CreateInstance(const wxString & WXUNUSED(path))
|
||||
{
|
||||
// Nothing to do here yet since we are autoregistering (and creating legacy
|
||||
// effects anyway).
|
||||
|
|
|
@ -26,7 +26,6 @@ public:
|
|||
|
||||
// IdentInterface implementatino
|
||||
|
||||
virtual wxString GetID();
|
||||
virtual wxString GetPath();
|
||||
virtual wxString GetSymbol();
|
||||
virtual wxString GetName();
|
||||
|
@ -43,9 +42,9 @@ public:
|
|||
virtual wxArrayString FindPlugins(PluginManagerInterface & pm);
|
||||
virtual bool RegisterPlugin(PluginManagerInterface & pm, const wxString & path);
|
||||
|
||||
virtual bool IsPluginValid(const PluginID & ID, const wxString & path);
|
||||
virtual bool IsPluginValid(const wxString & path);
|
||||
|
||||
virtual IdentInterface *CreateInstance(const PluginID & ID, const wxString & path);
|
||||
virtual IdentInterface *CreateInstance(const wxString & path);
|
||||
virtual void DeleteInstance(IdentInterface *instance);
|
||||
|
||||
// VampEffectModule implementation
|
||||
|
|
|
@ -68,11 +68,6 @@ VampEffect::~VampEffect()
|
|||
// IdentInterface implementation
|
||||
// ============================================================================
|
||||
|
||||
wxString VampEffect::GetID()
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
|
||||
wxString VampEffect::GetPath()
|
||||
{
|
||||
Vamp::HostExt::PluginLoader *loader = Vamp::HostExt::PluginLoader::getInstance();
|
||||
|
|
|
@ -40,7 +40,6 @@ class VampEffect : public Effect {
|
|||
|
||||
// IdentInterface implementation
|
||||
|
||||
virtual PluginID GetID();
|
||||
virtual wxString GetPath();
|
||||
virtual wxString GetSymbol();
|
||||
virtual wxString GetName();
|
||||
|
|
Loading…
Reference in New Issue