Audacity  3.2.0
EffectManager.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  EffectManager.cpp
6 
7  Audacity(R) is copyright (c) 1999-2008 Audacity Team.
8  License: GPL v2 or later. See License.txt.
9 
10 ******************************************************************//*******************************************************************/
20 
21 
22 #include "EffectManager.h"
23 
24 #include "Effect.h"
25 
26 #include <algorithm>
27 #include <wx/tokenzr.h>
28 
29 #include "../widgets/AudacityMessageBox.h"
30 
31 #include "../ShuttleGetDefinition.h"
32 #include "../commands/CommandContext.h"
33 #include "../commands/AudacityCommand.h"
34 #include "PluginManager.h"
35 
36 
37 /*******************************************************************************
38 Creates a singleton and returns reference
39 
40  (Thread-safe...no active threading during construction or after destruction)
41 *******************************************************************************/
43 {
44  static EffectManager em;
45  return em;
46 }
47 
49 {
50  mSkipStateFlag = false;
51 }
52 
54 {
55 }
56 
57 // Here solely for the purpose of Nyquist Workbench until
58 // a better solution is devised.
59 const PluginID & EffectManager::RegisterEffect(std::unique_ptr<Effect> uEffect)
60 {
61  auto pEffect = uEffect.get();
62  const PluginID & ID =
63  PluginManager::Get().RegisterPlugin(std::move(uEffect), PluginTypeEffect);
64  mEffects[ID] = pEffect;
65  return ID;
66 }
67 
68 // Here solely for the purpose of Nyquist Workbench until
69 // a better solution is devised.
71 {
72  PluginID id = ID;
74  mEffects.erase(id);
75 }
76 
78  const CommandContext &context,
79  wxWindow *parent,
80  bool shouldPrompt /* = true */)
81 
82 {
83  this->SetSkipStateFlag(false);
84  AudacityCommand *command = GetAudacityCommand(ID);
85 
86  if (!command)
87  {
88  return false;
89  }
90 
91  bool res = command->DoAudacityCommand(parent, context, shouldPrompt);
92 
93  return res;
94 }
95 
97 {
98  return PluginManager::Get().GetSymbol(ID);
99 }
100 
102 {
103  return GetCommandSymbol(ID).Msgid();
104 }
105 
107 {
108  auto effect = GetEffect(ID);
109  if (effect)
110  return effect->GetFamily().Msgid();
111  return {};
112 }
113 
115 {
116  auto effect = GetEffect(ID);
117  if (effect)
118  return effect->GetVendor().Msgid();
119  return {};
120 }
121 
123 {
124  auto name = PluginManager::Get().GetSymbol(ID).Internal();
126 }
127 
129 {
130  if (GetEffect(ID))
131  return XO("Applied effect: %s").Format( GetCommandName(ID) );
132  if (GetAudacityCommand(ID))
133  return XO("Applied command: %s").Format( GetCommandName(ID) );
134 
135  return {};
136 }
137 
139 {
140  Effect* pEff = GetEffect(ID);
141  if( pEff )
142  return pEff->ManualPage();
143  AudacityCommand * pCom = GetAudacityCommand(ID);
144  if( pCom )
145  return pCom->ManualPage();
146 
147  return wxEmptyString;
148 }
149 
151 {
152  Effect* pEff = GetEffect(ID);
153  if( pEff )
154  return pEff->GetDescription();
155  AudacityCommand * pCom = GetAudacityCommand(ID);
156  if( pCom )
157  return pCom->GetDescription();
158 
159  return {};
160 }
161 
162 
163 void EffectManager::GetCommandDefinition(const PluginID & ID, const CommandContext & context, int flags)
164 {
165  ComponentInterface *command;
166  command = GetEffect(ID);
167  if( !command )
168  command = GetAudacityCommand( ID );
169  if( !command )
170  return;
171 
172  ShuttleParams NullShuttle;
173  // Test if it defines any parameters at all.
174  bool bHasParams = command->DefineParams( NullShuttle );
175  if( (flags ==0) && !bHasParams )
176  return;
177 
178  // This is capturing the output context into the shuttle.
179  ShuttleGetDefinition S( *context.pOutput.get()->mStatusTarget.get() );
180  S.StartStruct();
181  // using GET to expose a CommandID to the user!
182  // Macro command details are one place that we do expose Identifier
183  // to (more sophisticated) users
184  S.AddItem( GetCommandIdentifier( ID ).GET(), "id" );
185  S.AddItem( GetCommandName( ID ).Translation(), "name" );
186  if( bHasParams ){
187  S.StartField( "params" );
188  S.StartArray();
189  command->DefineParams( S );
190  S.EndArray();
191  S.EndField();
192  }
193  // use GET() to expose some details to macro programming users
194  S.AddItem( GetCommandUrl( ID ).GET(), "url" );
195  // The tip is a translated string!
196  S.AddItem( GetCommandTip( ID ).Translation(), "tip" );
197  S.EndStruct();
198 }
199 
200 
201 
203 {
204  Effect *effect = GetEffect(ID);
205 
206  if (effect)
207  {
208  return effect->IsHiddenFromMenus();
209  }
210 
211  return false;
212 }
213 
215 {
217 }
218 
220 {
221  return mSkipStateFlag;
222 }
223 
225 {
226  const PluginDescriptor *plug = PluginManager::Get().GetPlugin(ID);
227  if (plug)
228  {
229  return plug->IsEffectAutomatable();
230  }
231 
232  return false;
233 }
234 
236 {
237  Effect *effect = GetEffect(ID);
238 
239  if (effect)
240  {
241  wxString parms;
242 
243  effect->GetAutomationParametersAsString(parms);
244 
245  // Some effects don't have automatable parameters and will not return
246  // anything, so try to get the active preset (current or factory).
247  if (parms.empty())
248  {
249  parms = GetDefaultPreset(ID);
250  }
251 
252  return parms;
253  }
254 
255  AudacityCommand *command = GetAudacityCommand(ID);
256 
257  if (command)
258  {
259  wxString parms;
260 
261  command->GetAutomationParametersAsString(parms);
262 
263  // Some effects don't have automatable parameters and will not return
264  // anything, so try to get the active preset (current or factory).
265  if (parms.empty())
266  {
267  parms = GetDefaultPreset(ID);
268  }
269 
270  return parms;
271  }
272  return wxEmptyString;
273 }
274 
275 bool EffectManager::SetEffectParameters(const PluginID & ID, const wxString & params)
276 {
277  Effect *effect = GetEffect(ID);
278 
279  if (effect)
280  {
282 
283  if (eap.HasEntry(wxT("Use Preset")))
284  {
285  return effect
286  ->SetAutomationParametersFromString(eap.Read(wxT("Use Preset")));
287  }
288 
290  }
291  AudacityCommand *command = GetAudacityCommand(ID);
292 
293  if (command)
294  {
295  // Set defaults (if not initialised) before setting values.
296  command->Init();
298 
299  if (eap.HasEntry(wxT("Use Preset")))
300  {
301  return command
302  ->SetAutomationParametersFromString(eap.Read(wxT("Use Preset")));
303  }
304 
305  return command->SetAutomationParametersFromString(params);
306  }
307  return false;
308 }
309 
311 
315  const PluginID & ID, const EffectDialogFactory &factory, wxWindow &parent)
316 {
317  bool result = false;
318  Effect *effect = GetEffect(ID);
319 
320  if (effect)
321  {
323  result = effect->ShowHostInterface(
324  parent, factory, effect->IsBatchProcessing() ) != 0;
325  return result;
326  }
327 
328  AudacityCommand *command = GetAudacityCommand(ID);
329 
330  if (command)
331  {
332  result = command->PromptUser(&parent);
333  return result;
334  }
335 
336  return result;
337 }
338 
340 {
342  host.GetCurrentSettingsGroup());
343 }
344 
346 {
348  host.GetFactoryDefaultsGroup());
349 }
350 
352 {
353  RegistryPaths presets;
355  host.GetUserPresetsGroup({}), presets);
356  std::sort( presets.begin(), presets.end() );
357  return presets;
358 }
359 
361 {
362  Effect *effect = GetEffect(ID);
363 
364  if (!effect)
365  {
366  return false;
367  }
368 
369  return GetUserPresets(*effect).size() > 0 ||
370  effect->GetFactoryPresets().size() > 0 ||
371  HasCurrentSettings(*effect) ||
372  HasFactoryDefaults(*effect);
373 }
374 
375 #include <wx/choice.h>
376 #include <wx/listbox.h>
377 #include "../ShuttleGui.h"
378 
379 namespace {
380 
382 //
383 // EffectPresetsDialog
384 //
386 
388 {
389 public:
390  EffectPresetsDialog(wxWindow *parent, Effect *effect);
391  virtual ~EffectPresetsDialog();
392 
393  wxString GetSelected() const;
394  void SetSelected(const wxString & parms);
395 
396 private:
397  void SetPrefix(const TranslatableString & type, const wxString & prefix);
398  void UpdateUI();
399 
400  void OnType(wxCommandEvent & evt);
401  void OnOk(wxCommandEvent & evt);
402  void OnCancel(wxCommandEvent & evt);
403 
404 private:
405  wxChoice *mType;
406  wxListBox *mPresets;
407 
410  wxString mSelection;
411 
412  DECLARE_EVENT_TABLE()
413 };
414 
415 enum
416 {
417  ID_Type = 10000
418 };
419 
420 BEGIN_EVENT_TABLE(EffectPresetsDialog, wxDialogWrapper)
421  EVT_CHOICE(ID_Type, EffectPresetsDialog::OnType)
422  EVT_LISTBOX_DCLICK(wxID_ANY, EffectPresetsDialog::OnOk)
423  EVT_BUTTON(wxID_OK, EffectPresetsDialog::OnOk)
424  EVT_BUTTON(wxID_CANCEL, EffectPresetsDialog::OnCancel)
426 
427 EffectPresetsDialog::EffectPresetsDialog(wxWindow *parent, Effect *effect)
428 : wxDialogWrapper(parent, wxID_ANY, XO("Select Preset"))
429 {
430  ShuttleGui S(this, eIsCreating);
431  S.StartVerticalLay();
432  {
433  S.StartTwoColumn();
434  S.SetStretchyCol(1);
435  {
436  S.AddPrompt(XXO("Type:"));
437  mType = S.Id(ID_Type).AddChoice( {}, {}, 0 );
438 
439  S.AddPrompt(XXO("&Preset:"));
440  mPresets = S
441  .Style( wxLB_SINGLE | wxLB_NEEDED_SB )
442  .AddListBox( {} );
443  }
444  S.EndTwoColumn();
445 
446  S.AddStandardButtons();
447  }
448  S.EndVerticalLay();
449 
450  mUserPresets = GetUserPresets(*effect);
451  mFactoryPresets = effect->GetFactoryPresets();
452 
453  if (mUserPresets.size() > 0)
454  {
455  mType->Append(_("User Presets"));
456  }
457 
458  if (mFactoryPresets.size() > 0)
459  {
460  mType->Append(_("Factory Presets"));
461  }
462 
463  if (HasCurrentSettings(*effect))
464  {
465  mType->Append(_("Current Settings"));
466  }
467 
468  if (HasFactoryDefaults(*effect))
469  {
470  mType->Append(_("Factory Defaults"));
471  }
472 
473  UpdateUI();
474 }
475 
476 EffectPresetsDialog::~EffectPresetsDialog()
477 {
478 }
479 
480 wxString EffectPresetsDialog::GetSelected() const
481 {
482  return mSelection;
483 }
484 
485 void EffectPresetsDialog::SetSelected(const wxString & parms)
486 {
487  wxString preset = parms;
488  if (preset.StartsWith(Effect::kUserPresetIdent))
489  {
490  preset.Replace(Effect::kUserPresetIdent, wxEmptyString, false);
491  SetPrefix(XO("User Presets"), preset);
492  }
493  else if (preset.StartsWith(Effect::kFactoryPresetIdent))
494  {
495  preset.Replace(Effect::kFactoryPresetIdent, wxEmptyString, false);
496  SetPrefix(XO("Factory Presets"), preset);
497  }
498  else if (preset.StartsWith(Effect::kCurrentSettingsIdent))
499  {
500  SetPrefix(XO("Current Settings"), wxEmptyString);
501  }
502  else if (preset.StartsWith(Effect::kFactoryDefaultsIdent))
503  {
504  SetPrefix(XO("Factory Defaults"), wxEmptyString);
505  }
506 }
507 
508 void EffectPresetsDialog::SetPrefix(
509  const TranslatableString & type, const wxString & prefix)
510 {
511  mType->SetStringSelection(type.Translation());
512 
513  if (type == XO("User Presets"))
514  {
515  mPresets->Clear();
516  for (const auto &preset : mUserPresets)
517  mPresets->Append(preset);
518  mPresets->Enable(true);
519  mPresets->SetStringSelection(prefix);
520  if (mPresets->GetSelection() == wxNOT_FOUND)
521  {
522  mPresets->SetSelection(0);
523  }
524  mSelection = Effect::kUserPresetIdent + mPresets->GetStringSelection();
525  }
526  else if (type == XO("Factory Presets"))
527  {
528  mPresets->Clear();
529  for (size_t i = 0, cnt = mFactoryPresets.size(); i < cnt; i++)
530  {
531  auto label = mFactoryPresets[i];
532  if (label.empty())
533  {
534  label = _("None");
535  }
536  mPresets->Append(label);
537  }
538  mPresets->Enable(true);
539  mPresets->SetStringSelection(prefix);
540  if (mPresets->GetSelection() == wxNOT_FOUND)
541  {
542  mPresets->SetSelection(0);
543  }
544  mSelection = Effect::kFactoryPresetIdent + mPresets->GetStringSelection();
545  }
546  else if (type == XO("Current Settings"))
547  {
548  mPresets->Clear();
549  mPresets->Enable(false);
550  mSelection = Effect::kCurrentSettingsIdent;
551  }
552  else if (type == XO("Factory Defaults"))
553  {
554  mPresets->Clear();
555  mPresets->Enable(false);
556  mSelection = Effect::kFactoryDefaultsIdent;
557  }
558 }
559 
560 void EffectPresetsDialog::UpdateUI()
561 {
562  int selected = mType->GetSelection();
563  if (selected == wxNOT_FOUND)
564  {
565  selected = 0;
566  mType->SetSelection(selected);
567  }
568  wxString type = mType->GetString(selected);
569 
570  if (type == _("User Presets"))
571  {
572  selected = mPresets->GetSelection();
573  if (selected == wxNOT_FOUND)
574  {
575  selected = 0;
576  }
577 
578  mPresets->Clear();
579  for (const auto &preset : mUserPresets)
580  mPresets->Append(preset);
581  mPresets->Enable(true);
582  mPresets->SetSelection(selected);
583  mSelection = Effect::kUserPresetIdent + mPresets->GetString(selected);
584  }
585  else if (type == _("Factory Presets"))
586  {
587  selected = mPresets->GetSelection();
588  if (selected == wxNOT_FOUND)
589  {
590  selected = 0;
591  }
592 
593  mPresets->Clear();
594  for (size_t i = 0, cnt = mFactoryPresets.size(); i < cnt; i++)
595  {
596  auto label = mFactoryPresets[i];
597  if (label.empty())
598  {
599  label = _("None");
600  }
601  mPresets->Append(label);
602  }
603  mPresets->Enable(true);
604  mPresets->SetSelection(selected);
605  mSelection = Effect::kFactoryPresetIdent + mPresets->GetString(selected);
606  }
607  else if (type == _("Current Settings"))
608  {
609  mPresets->Clear();
610  mPresets->Enable(false);
611  mSelection = Effect::kCurrentSettingsIdent;
612  }
613  else if (type == _("Factory Defaults"))
614  {
615  mPresets->Clear();
616  mPresets->Enable(false);
617  mSelection = Effect::kFactoryDefaultsIdent;
618  }
619 }
620 
621 void EffectPresetsDialog::OnType(wxCommandEvent & WXUNUSED(evt))
622 {
623  UpdateUI();
624 }
625 
626 void EffectPresetsDialog::OnOk(wxCommandEvent & WXUNUSED(evt))
627 {
628  UpdateUI();
629 
630  EndModal(true);
631 }
632 
633 void EffectPresetsDialog::OnCancel(wxCommandEvent & WXUNUSED(evt))
634 {
635  mSelection = wxEmptyString;
636 
637  EndModal(false);
638 }
639 
640 }
641 
642 wxString EffectManager::GetPreset(const PluginID & ID, const wxString & params, wxWindow * parent)
643 {
644  Effect *effect = GetEffect(ID);
645 
646  if (!effect)
647  {
648  return wxEmptyString;
649  }
650 
652 
653  wxString preset;
654  if (eap.HasEntry(wxT("Use Preset")))
655  {
656  preset = eap.Read(wxT("Use Preset"));
657  }
658 
659  {
660  EffectPresetsDialog dlg(parent, effect);
661  dlg.Layout();
662  dlg.Fit();
663  dlg.SetSize(dlg.GetMinSize());
664  dlg.CenterOnParent();
665  dlg.SetSelected(preset);
666 
667  if (dlg.ShowModal())
668  preset = dlg.GetSelected();
669  else
670  preset = wxEmptyString;
671  }
672 
673  if (preset.empty())
674  {
675  return preset;
676  }
677 
678  // This cleans a config "file" backed by a string in memory.
679  eap.DeleteAll();
680 
681  eap.Write(wxT("Use Preset"), preset);
682  eap.GetParameters(preset);
683 
684  return preset;
685 }
686 
688 {
689  Effect *effect = GetEffect(ID);
690 
691  if (!effect)
692  {
693  return wxEmptyString;
694  }
695 
696  wxString preset;
697  if (HasCurrentSettings(*effect))
698  {
700  }
701  else if (HasFactoryDefaults(*effect))
702  {
704  }
705 
706  if (!preset.empty())
707  {
708  CommandParameters eap;
709 
710  eap.Write(wxT("Use Preset"), preset);
711  eap.GetParameters(preset);
712  }
713 
714  return preset;
715 }
716 
717 void EffectManager::SetBatchProcessing(const PluginID & ID, bool start)
718 {
719  Effect *effect = GetEffect(ID);
720  if (effect)
721  {
722  effect->SetBatchProcessing(start);
723  return;
724  }
725 
726  AudacityCommand *command = GetAudacityCommand(ID);
727  if (command)
728  {
729  command->SetBatchProcessing(start);
730  return;
731  }
732 
733 }
734 
736 {
737  // Must have a "valid" ID
738  if (ID.empty())
739  {
740  return NULL;
741  }
742 
743  // If it is actually a command then refuse it (as an effect).
744  if( mCommands.find( ID ) != mCommands.end() )
745  return NULL;
746 
747  // TODO: This is temporary and should be redone when all effects are converted
748  if (mEffects.find(ID) == mEffects.end())
749  {
750  // This will instantiate the effect client if it hasn't already been done
752  if (ident && ident->IsLegacy())
753  {
754  auto effect = dynamic_cast<Effect *>(ident);
755  if (effect && effect->Startup(NULL))
756  {
757  mEffects[ID] = effect;
758  return effect;
759  }
760  }
761 
762  auto effect = std::make_shared<Effect>(); // TODO: use make_unique and store in std::unordered_map
763  if (effect)
764  {
765  const auto client = dynamic_cast<EffectUIClientInterface *>(ident);
766  if (client && effect->Startup(client))
767  {
768  auto pEffect = effect.get();
769  mEffects[ID] = pEffect;
770  mHostEffects[ID] = std::move(effect);
771  return pEffect;
772  }
773  }
774 
775  auto command = dynamic_cast<AudacityCommand *>(PluginManager::Get().GetInstance(ID));
776  if( !command )
778  XO(
779 "Attempting to initialize the following effect failed:\n\n%s\n\nMore information may be available in 'Help > Diagnostics > Show Log'")
780  .Format( GetCommandName(ID) ),
781  XO("Effect failed to initialize"));
782 
783  return NULL;
784  }
785 
786  return mEffects[ID];
787 }
788 
790 {
791  // Must have a "valid" ID
792  if (ID.empty())
793  {
794  return NULL;
795  }
796 
797  // TODO: This is temporary and should be redone when all effects are converted
798  if (mCommands.find(ID) == mCommands.end())
799  {
800 
801  // This will instantiate the effect client if it hasn't already been done
802  auto command = dynamic_cast<AudacityCommand *>(PluginManager::Get().GetInstance(ID));
803  if (command )//&& command->Startup(NULL))
804  {
805  command->Init();
806  mCommands[ID] = command;
807  return command;
808  }
809 
810  /*
811  if (ident && ident->IsLegacy())
812  {
813  auto command = dynamic_cast<AudacityCommand *>(ident);
814  if (commandt && command->Startup(NULL))
815  {
816  mCommands[ID] = command;
817  return command;
818  }
819  }
820 
821 
822  auto command = std::make_shared<AudacityCommand>(); // TODO: use make_unique and store in std::unordered_map
823  if (command)
824  {
825  AudacityCommand *client = dynamic_cast<AudacityCommand *>(ident);
826  if (client && command->Startup(client))
827  {
828  auto pCommand = command.get();
829  mEffects[ID] = pCommand;
830  mHostEffects[ID] = std::move(effect);
831  return pEffect;
832  }
833  }
834 */
836  XO(
837 "Attempting to initialize the following command failed:\n\n%s\n\nMore information may be available in 'Help > Diagnostics > Show Log'")
838  .Format( GetCommandName(ID) ),
839  XO("Command failed to initialize"));
840 
841  return NULL;
842  }
843 
844  return mCommands[ID];
845 }
846 
847 
849 {
850  static PluginID empty;
851  if (strTarget.empty()) // set GetCommandIdentifier to wxT("") to not show an effect in Batch mode
852  {
853  return empty;
854  }
855 
857  // Effects OR Generic commands...
858  for (auto &plug
860  auto &ID = plug.GetID();
861  if (GetCommandIdentifier(ID) == strTarget)
862  return ID;
863  }
864  return empty;
865 }
866 
EffectUIClientInterface
EffectUIClientInterface is an abstract base class to populate a UI and validate UI values....
Definition: EffectInterface.h:251
EffectManager::GetSkipStateFlag
bool GetSkipStateFlag()
Definition: EffectManager.cpp:219
EVT_BUTTON
EVT_BUTTON(wxID_NO, DependencyDialog::OnNo) EVT_BUTTON(wxID_YES
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::mFactoryPresets
RegistryPaths mFactoryPresets
Definition: EffectManager.cpp:408
PluginManager::GetInstance
ComponentInterface * GetInstance(const PluginID &ID)
Definition: PluginManager.cpp:1422
anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::mPresets
wxListBox * mPresets
Definition: EffectManager.cpp:406
CommandParameters
CommandParameters, derived from wxFileConfig, is essentially doing the same things as the Shuttle cla...
Definition: EffectAutomationParameters.h:67
label
TranslatableString label
Definition: TagsEditor.cpp:163
eIsCreating
@ eIsCreating
Definition: ShuttleGui.h:39
TranslatableString::empty
bool empty() const
Definition: TranslatableString.h:72
PluginTypeEffect
@ PluginTypeEffect
Definition: PluginManager.h:36
AudacityCommand::DoAudacityCommand
bool DoAudacityCommand(wxWindow *parent, const CommandContext &context, bool shouldPrompt=true)
Definition: AudacityCommand.cpp:163
anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog
Definition: EffectManager.cpp:388
EffectDialogFactory
std::function< wxDialog *(wxWindow &parent, EffectHostInterface &, EffectUIClientInterface &) > EffectDialogFactory
Definition: EffectHostInterface.h:55
EffectManager::GetEffectParameters
wxString GetEffectParameters(const PluginID &ID)
Definition: EffectManager.cpp:235
AudacityCommand::PromptUser
virtual bool PromptUser(wxWindow *parent)
Definition: AudacityCommand.cpp:203
EffectManager::mHostEffects
EffectOwnerMap mHostEffects
Definition: EffectManager.h:141
S
#define S(N)
Definition: ToChars.cpp:64
Effect::GetAutomationParametersAsString
virtual bool GetAutomationParametersAsString(wxString &parms)
Definition: Effect.cpp:872
AudacityMessageBox
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
Definition: AudacityMessageBox.cpp:17
EffectManager::mCommands
AudacityCommandMap mCommands
Definition: EffectManager.h:140
EffectHostInterface
EffectHostInterface is a decorator of a EffectUIClientInterface. It adds virtual (abstract) functions...
Definition: EffectHostInterface.h:32
Effect.h
flag
static std::once_flag flag
Definition: WaveformView.cpp:1133
AudacityCommand::GetAutomationParametersAsString
bool GetAutomationParametersAsString(wxString &parms)
Definition: AudacityCommand.cpp:120
AudacityCommand::GetDescription
virtual TranslatableString GetDescription() override
Definition: AudacityCommand.h:58
EffectManager::mSkipStateFlag
bool mSkipStateFlag
Definition: EffectManager.h:147
EffectManager::SetBatchProcessing
void SetBatchProcessing(const PluginID &ID, bool start)
Definition: EffectManager.cpp:717
EffectManager::~EffectManager
virtual ~EffectManager()
Definition: EffectManager.cpp:53
ident
static CommandHandlerObject & ident(AudacityProject &project)
Definition: ModNullCallback.cpp:65
Effect
An Effect object is at once host and client: it is self-hosting.
Definition: Effect.h:77
PluginManager::GetSymbol
const ComponentInterfaceSymbol & GetSymbol(const PluginID &ID)
Definition: PluginManager.cpp:1412
RegistryPaths
std::vector< RegistryPath > RegistryPaths
Definition: Identifier.h:219
EffectManager::UnregisterEffect
void UnregisterEffect(const PluginID &ID)
Used only by Nyquist Workbench module.
Definition: EffectManager.cpp:70
Format
Abstract base class used in importing a file.
anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::mType
wxChoice * mType
Definition: EffectManager.cpp:405
EffectDefinitionInterface::GetSquashedName
static Identifier GetSquashedName(const Identifier &ident)
A utility that strips spaces and CamelCases a name.
Definition: EffectInterface.cpp:11
anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::mUserPresets
RegistryPaths mUserPresets
Definition: EffectManager.cpp:409
PluginSettings::GetConfigSubgroups
bool GetConfigSubgroups(EffectDefinitionInterface &ident, PluginSettings::ConfigurationType type, const RegistryPath &group, RegistryPaths &subgroups)
Definition: ConfigInterface.cpp:23
EffectManager::GetCommandName
TranslatableString GetCommandName(const PluginID &ID)
Definition: EffectManager.cpp:101
PluginManager::RegisterPlugin
const PluginID & RegisterPlugin(ModuleInterface *module) override
Definition: PluginManager.cpp:396
AudacityCommand::ManualPage
virtual ManualPageID ManualPage()
Definition: AudacityCommand.h:62
XO
#define XO(s)
Definition: Internat.h:31
EffectHostInterface::GetCurrentSettingsGroup
virtual RegistryPath GetCurrentSettingsGroup()=0
ShuttleParams
Shuttle that deals with parameters. This is a base class with lots of virtual functions that do nothi...
Definition: Shuttle.h:61
CommandParameters::GetParameters
bool GetParameters(wxString &parms)
Definition: EffectAutomationParameters.h:258
HasCurrentSettings
static bool HasCurrentSettings(EffectHostInterface &host)
Definition: EffectManager.cpp:339
EffectManager::GetCommandSymbol
ComponentInterfaceSymbol GetCommandSymbol(const PluginID &ID)
Definition: EffectManager.cpp:96
Effect::IsBatchProcessing
virtual bool IsBatchProcessing()
Definition: Effect.cpp:960
PluginDescriptor::IsEffectAutomatable
bool IsEffectAutomatable() const
Definition: PluginManager.cpp:216
EffectManager::Get
static EffectManager & Get()
Definition: EffectManager.cpp:42
EffectManager::PromptUser
bool PromptUser(const PluginID &ID, const EffectDialogFactory &factory, wxWindow &parent)
Shows an effect or command dialog so the user can specify settings for later.
Definition: EffectManager.cpp:314
EffectManager::GetCommandUrl
ManualPageID GetCommandUrl(const PluginID &ID)
Definition: EffectManager.cpp:138
ComponentInterfaceSymbol::Msgid
const TranslatableString & Msgid() const
Definition: ComponentInterfaceSymbol.h:56
EffectManager::mEffects
EffectMap mEffects
Definition: EffectManager.h:139
ComponentInterfaceSymbol
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Definition: ComponentInterfaceSymbol.h:27
EffectManager::SetSkipStateFlag
void SetSkipStateFlag(bool flag)
Definition: EffectManager.cpp:214
EffectManager::SetEffectParameters
bool SetEffectParameters(const PluginID &ID, const wxString &params)
Definition: EffectManager.cpp:275
EffectManager::GetCommandIdentifier
CommandID GetCommandIdentifier(const PluginID &ID)
Definition: EffectManager.cpp:122
XXO
#define XXO(s)
Definition: Internat.h:44
EffectManager
EffectManager is the class that handles effects and effect categories.
Definition: EffectManager.h:42
factory
static RegisteredToolbarFactory factory
Definition: ControlToolBar.cpp:820
CommandContext
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
Definition: CommandContext.h:34
EffectManager::GetCommandTip
TranslatableString GetCommandTip(const PluginID &ID)
Definition: EffectManager.cpp:150
EffectManager::GetEffect
Effect * GetEffect(const PluginID &ID)
Definition: EffectManager.cpp:735
Effect::GetFactoryPresets
RegistryPaths GetFactoryPresets() override
Report names of factory presets.
Definition: Effect.cpp:562
EffectManager::GetEffectFamilyName
TranslatableString GetEffectFamilyName(const PluginID &ID)
Definition: EffectManager.cpp:106
PluginManager.h
anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::mSelection
wxString mSelection
Definition: EffectManager.cpp:410
EffectManager::IsHidden
bool IsHidden(const PluginID &ID)
Definition: EffectManager.cpp:202
PluginID
wxString PluginID
Definition: EffectManager.h:31
AudacityCommand
Base class for command in Audacity.
Definition: AudacityCommand.h:40
HasFactoryDefaults
static bool HasFactoryDefaults(EffectHostInterface &host)
Definition: EffectManager.cpp:345
Effect::kCurrentSettingsIdent
static const wxString kCurrentSettingsIdent
Definition: Effect.h:498
name
const TranslatableString name
Definition: Distortion.cpp:98
AudacityCommand::SetBatchProcessing
virtual void SetBatchProcessing(bool start)
Definition: AudacityCommand.h:64
ID_Type
@ ID_Type
Definition: ScienFilter.cpp:81
Effect::kUserPresetIdent
static const wxString kUserPresetIdent
Definition: Effect.h:496
PluginManager::GetPlugin
const PluginDescriptor * GetPlugin(const PluginID &ID) const
Definition: PluginManager.cpp:1335
EffectManager::EffectManager
EffectManager()
Definition: EffectManager.cpp:48
PluginTypeAudacityCommand
@ PluginTypeAudacityCommand
Definition: PluginManager.h:37
PluginDescriptor
Definition: PluginManager.h:45
EffectHostInterface::GetDefinition
virtual EffectDefinitionInterface & GetDefinition()=0
PluginManager::UnregisterPlugin
void UnregisterPlugin(const PluginID &ID)
Definition: PluginManager.cpp:1324
EffectManager::HasPresets
bool HasPresets(const PluginID &ID)
Definition: EffectManager.cpp:360
EffectManager::GetDefaultPreset
wxString GetDefaultPreset(const PluginID &ID)
Definition: EffectManager.cpp:687
AudacityCommand::Init
virtual bool Init()
Definition: AudacityCommand.cpp:71
wxDialogWrapper
Definition: wxPanelWrapper.h:81
PluginManager::Get
static PluginManager & Get()
Definition: PluginManager.cpp:582
EffectHostInterface::GetUserPresetsGroup
virtual RegistryPath GetUserPresetsGroup(const RegistryPath &name)=0
EffectDefinitionInterface
EffectDefinitionInterface is a ComponentInterface that adds some basic read-only information about ef...
Definition: EffectInterface.h:74
AudacityCommand::SetAutomationParametersFromString
bool SetAutomationParametersFromString(const wxString &parms)
Definition: AudacityCommand.cpp:138
PluginManager
PluginManager maintains a list of all plug ins. That covers modules, effects, generators,...
Definition: PluginManager.h:175
CommandParameters::HasEntry
virtual bool HasEntry(const wxString &strName) const override
Definition: EffectAutomationParameters.h:87
TaggedIdentifier< CommandIdTag, false >
_
#define _(s)
Definition: Internat.h:75
Effect::GetDescription
TranslatableString GetDescription() override
Definition: Effect.cpp:160
PluginManager::PluginsOfType
Range PluginsOfType(int type)
Definition: PluginManager.h:270
EffectManager::GetVendorName
TranslatableString GetVendorName(const PluginID &ID)
Definition: EffectManager.cpp:114
ComponentInterfaceSymbol::Internal
const wxString & Internal() const
Definition: ComponentInterfaceSymbol.h:55
EffectManager::GetEffectByIdentifier
const PluginID & GetEffectByIdentifier(const CommandID &strTarget)
Definition: EffectManager.cpp:848
ComponentInterface
ComponentInterface provides name / vendor / version functions to identify plugins....
Definition: ComponentInterface.h:62
EffectManager::GetCommandDefinition
void GetCommandDefinition(const PluginID &ID, const CommandContext &context, int flags)
Definition: EffectManager.cpp:163
PluginSettings::HasConfigGroup
bool HasConfigGroup(EffectDefinitionInterface &ident, PluginSettings::ConfigurationType type, const RegistryPath &group)
Definition: ConfigInterface.cpp:14
EffectManager::GetCommandDescription
TranslatableString GetCommandDescription(const PluginID &ID)
Definition: EffectManager.cpp:128
params
EffectDistortion::Params params
Definition: Distortion.cpp:99
ShuttleGetDefinition
Shuttle that retrieves a JSON format definition of a command's parameters.
Definition: ShuttleGetDefinition.h:22
TranslatableString::Translation
wxString Translation() const
Definition: TranslatableString.h:79
Effect::kFactoryDefaultsIdent
static const wxString kFactoryDefaultsIdent
Definition: Effect.h:499
EffectManager::GetAudacityCommand
AudacityCommand * GetAudacityCommand(const PluginID &ID)
Definition: EffectManager.cpp:789
Effect::SetAutomationParametersFromString
virtual bool SetAutomationParametersFromString(const wxString &parms)
Definition: Effect.cpp:895
Effect::ShowHostInterface
int ShowHostInterface(wxWindow &parent, const EffectDialogFactory &factory, bool forceModal=false) override
Definition: Effect.cpp:470
GetUserPresets
static RegistryPaths GetUserPresets(EffectHostInterface &host)
Definition: EffectManager.cpp:351
EffectManager.h
EffectManager::RegisterEffect
const PluginID & RegisterEffect(std::unique_ptr< Effect > uEffect)
Here solely for the purpose of Nyquist Workbench until a better solution is devised.
Definition: EffectManager.cpp:59
Effect::kFactoryPresetIdent
static const wxString kFactoryPresetIdent
Definition: Effect.h:497
EffectManager::GetPreset
wxString GetPreset(const PluginID &ID, const wxString &params, wxWindow *parent)
Definition: EffectManager.cpp:642
ComponentInterface::DefineParams
virtual bool DefineParams(ShuttleParams &WXUNUSED(S))
Definition: ComponentInterface.h:85
EffectManager::DoAudacityCommand
bool DoAudacityCommand(const PluginID &ID, const CommandContext &, wxWindow *parent, bool shouldPrompt=true)
Definition: EffectManager.cpp:77
EffectManager::SupportsAutomation
bool SupportsAutomation(const PluginID &ID)
Definition: EffectManager.cpp:224
END_EVENT_TABLE
END_EVENT_TABLE()
EffectDefinitionInterface::IsHiddenFromMenus
virtual bool IsHiddenFromMenus()
Default is false.
Definition: EffectInterface.cpp:54
Identifier::empty
bool empty() const
Definition: Identifier.h:61
PluginSettings::Private
@ Private
Definition: PluginInterface.h:56
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631
EffectHostInterface::GetFactoryDefaultsGroup
virtual RegistryPath GetFactoryDefaultsGroup()=0
EffectDefinitionInterface::ManualPage
virtual ManualPageID ManualPage()
Name of a page in the Audacity alpha manual, default is empty.
Definition: EffectInterface.cpp:44
Effect::SetBatchProcessing
virtual void SetBatchProcessing(bool start)
Definition: Effect.cpp:965
CommandContext::pOutput
std::unique_ptr< CommandOutputTargets > pOutput
Definition: CommandContext.h:65