Audacity  2.2.2
Public Member Functions | Private Member Functions | Private Attributes | List of all members
BuiltinEffectsModule Class Referencefinal

#include <LoadEffects.h>

Inheritance diagram for BuiltinEffectsModule:

Public Member Functions

 BuiltinEffectsModule (ModuleManagerInterface *moduleManager, const wxString *path)
 
virtual ~BuiltinEffectsModule ()
 
wxString GetPath () override
 
wxString GetSymbol () override
 
wxString GetName () override
 
wxString GetVendor () override
 
wxString GetVersion () override
 
wxString GetDescription () override
 
bool Initialize () override
 
void Terminate () override
 
wxArrayString FileExtensions () override
 
wxString InstallPath () override
 
bool AutoRegisterPlugins (PluginManagerInterface &pm) override
 
wxArrayString FindPluginPaths (PluginManagerInterface &pm) override
 
unsigned DiscoverPluginsAtPath (const wxString &path, wxString &errMsg, const RegistrationCallback &callback) override
 
bool IsPluginValid (const wxString &path, bool bFast) override
 
IdentInterface * CreateInstance (const wxString &path) override
 
void DeleteInstance (IdentInterface *instance) override
 

Private Member Functions

std::unique_ptr< EffectInstantiate (const wxString &path)
 

Private Attributes

ModuleManagerInterface * mModMan
 
wxString mPath
 
wxArrayString mNames
 

Detailed Description

Definition at line 24 of file LoadEffects.h.

Constructor & Destructor Documentation

BuiltinEffectsModule::BuiltinEffectsModule ( ModuleManagerInterface *  moduleManager,
const wxString *  path 
)

Definition at line 215 of file LoadEffects.cpp.

References mModMan, and mPath.

217 {
218  mModMan = moduleManager;
219  if (path)
220  {
221  mPath = *path;
222  }
223 }
ModuleManagerInterface * mModMan
Definition: LoadEffects.h:65
BuiltinEffectsModule::~BuiltinEffectsModule ( )
virtual

Definition at line 225 of file LoadEffects.cpp.

References mPath.

226 {
227  mPath.Clear();
228 }

Member Function Documentation

bool BuiltinEffectsModule::AutoRegisterPlugins ( PluginManagerInterface &  pm)
override

Definition at line 290 of file LoadEffects.cpp.

References BUILTIN_EFFECT_PREFIX, DiscoverPluginsAtPath(), and kEffectNames.

291 {
292  wxString ignoredErrMsg;
293  for (size_t i = 0; i < WXSIZEOF(kEffectNames); i++)
294  {
295  wxString path(wxString(BUILTIN_EFFECT_PREFIX) + kEffectNames[i]);
296 
297  if (!pm.IsPluginRegistered(path))
298  {
299  // No checking of error ?
300  DiscoverPluginsAtPath(path, ignoredErrMsg,
301  PluginManagerInterface::DefaultRegistrationCallback);
302  }
303  }
304 
305  // We still want to be called during the normal registration process
306  return false;
307 }
#define BUILTIN_EFFECT_PREFIX
Definition: Effect.h:46
static const wxChar * kEffectNames[]
unsigned DiscoverPluginsAtPath(const wxString &path, wxString &errMsg, const RegistrationCallback &callback) override
IdentInterface * BuiltinEffectsModule::CreateInstance ( const wxString &  path)
override

Definition at line 338 of file LoadEffects.cpp.

References Instantiate().

339 {
340  // Acquires a resource for the application.
341  // Safety of this depends on complementary calls to DeleteInstance on the module manager side.
342  return Instantiate(path).release();
343 }
std::unique_ptr< Effect > Instantiate(const wxString &path)
void BuiltinEffectsModule::DeleteInstance ( IdentInterface *  instance)
override

Definition at line 345 of file LoadEffects.cpp.

346 {
347  // Releases the resource.
348  std::unique_ptr < Effect > {
349  dynamic_cast<Effect *>(instance)
350  };
351 }
Base class for many of the effects in Audacity.
Definition: Effect.h:61
unsigned BuiltinEffectsModule::DiscoverPluginsAtPath ( const wxString &  path,
wxString &  errMsg,
const RegistrationCallback &  callback 
)
override

Definition at line 314 of file LoadEffects.cpp.

References _(), and Instantiate().

Referenced by AutoRegisterPlugins().

317 {
318  errMsg.clear();
319  auto effect = Instantiate(path);
320  if (effect)
321  {
322  if (callback)
323  callback(this, effect.get());
324  return 1;
325  }
326 
327  errMsg = _("Unknown built-in effect name");
328  return 0;
329 }
std::unique_ptr< Effect > Instantiate(const wxString &path)
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom"))), OnMoveTrack) void TrackMenuTable::OnSetName(wxCommandEvent &)
wxArrayString BuiltinEffectsModule::FileExtensions ( )
inlineoverride

Definition at line 44 of file LoadEffects.h.

44 { return {}; }
wxArrayString BuiltinEffectsModule::FindPluginPaths ( PluginManagerInterface &  pm)
override

Definition at line 309 of file LoadEffects.cpp.

References mNames.

310 {
311  return mNames;
312 }
wxArrayString mNames
Definition: LoadEffects.h:68
wxString BuiltinEffectsModule::GetDescription ( )
override

Definition at line 260 of file LoadEffects.cpp.

References _().

261 {
262  return _("Provides builtin effects to Audacity");
263 }
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom"))), OnMoveTrack) void TrackMenuTable::OnSetName(wxCommandEvent &)
wxString BuiltinEffectsModule::GetName ( )
override

Definition at line 244 of file LoadEffects.cpp.

References XO.

245 {
246  return XO("Builtin Effects");
247 }
#define XO(s)
Definition: Internat.h:30
wxString BuiltinEffectsModule::GetPath ( )
override

Definition at line 234 of file LoadEffects.cpp.

References mPath.

235 {
236  return mPath;
237 }
wxString BuiltinEffectsModule::GetSymbol ( )
override

Definition at line 239 of file LoadEffects.cpp.

References XO.

240 {
241  return XO("Builtin Effects");
242 }
#define XO(s)
Definition: Internat.h:30
wxString BuiltinEffectsModule::GetVendor ( )
override

Definition at line 249 of file LoadEffects.cpp.

References XO.

250 {
251  return XO("The Audacity Team");
252 }
#define XO(s)
Definition: Internat.h:30
wxString BuiltinEffectsModule::GetVersion ( )
override

Definition at line 254 of file LoadEffects.cpp.

References AUDACITY_VERSION_STRING.

255 {
256  // This "may" be different if this were to be maintained as a separate DLL
258 }
#define AUDACITY_VERSION_STRING
Definition: Audacity.h:81
bool BuiltinEffectsModule::Initialize ( )
override

Definition at line 269 of file LoadEffects.cpp.

References BUILTIN_EFFECT_PREFIX, kEffectNames, kExcludedNames, and mNames.

270 {
271  for (size_t i = 0; i < WXSIZEOF(kEffectNames); i++)
272  {
273  mNames.Add(wxString(BUILTIN_EFFECT_PREFIX) + kEffectNames[i]);
274  }
275 
276  for (size_t i = 0; i < WXSIZEOF(kExcludedNames); i++)
277  {
278  mNames.Add(wxString(BUILTIN_EFFECT_PREFIX) + kExcludedNames[i]);
279  }
280 
281  return true;
282 }
#define BUILTIN_EFFECT_PREFIX
Definition: Effect.h:46
static const wxChar * kEffectNames[]
static const wxChar * kExcludedNames[]
wxArrayString mNames
Definition: LoadEffects.h:68
wxString BuiltinEffectsModule::InstallPath ( )
inlineoverride

Definition at line 45 of file LoadEffects.h.

45 { return {}; }
std::unique_ptr< Effect > BuiltinEffectsModule::Instantiate ( const wxString &  path)
private

Definition at line 357 of file LoadEffects.cpp.

References BUILTIN_EFFECT_PREFIX, EFFECT_LIST, EXCLUDE_LIST, and mNames.

Referenced by CreateInstance(), and DiscoverPluginsAtPath().

358 {
359  wxASSERT(path.StartsWith(BUILTIN_EFFECT_PREFIX));
360  wxASSERT(mNames.Index(path) != wxNOT_FOUND);
361 
362  switch (mNames.Index(path))
363  {
364  EFFECT_LIST;
365  EXCLUDE_LIST;
366  }
367 
368  return nullptr;
369 }
#define BUILTIN_EFFECT_PREFIX
Definition: Effect.h:46
#define EFFECT_LIST
wxArrayString mNames
Definition: LoadEffects.h:68
#define EXCLUDE_LIST
bool BuiltinEffectsModule::IsPluginValid ( const wxString &  path,
bool  bFast 
)
override

Definition at line 331 of file LoadEffects.cpp.

References mNames.

332 {
333  // bFast is unused as checking in the list is fast.
334  bFast;
335  return mNames.Index(path) != wxNOT_FOUND;
336 }
wxArrayString mNames
Definition: LoadEffects.h:68
void BuiltinEffectsModule::Terminate ( )
override

Definition at line 284 of file LoadEffects.cpp.

285 {
286  // Nothing to do here
287  return;
288 }

Member Data Documentation

ModuleManagerInterface* BuiltinEffectsModule::mModMan
private

Definition at line 65 of file LoadEffects.h.

Referenced by BuiltinEffectsModule().

wxArrayString BuiltinEffectsModule::mNames
private

Definition at line 68 of file LoadEffects.h.

Referenced by FindPluginPaths(), Initialize(), Instantiate(), and IsPluginValid().

wxString BuiltinEffectsModule::mPath
private

Definition at line 66 of file LoadEffects.h.

Referenced by BuiltinEffectsModule(), GetPath(), and ~BuiltinEffectsModule().


The documentation for this class was generated from the following files: