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#include "Effect.h"
24
25#include <algorithm>
26
27#include "AudacityMessageBox.h"
28
29#include "ConfigInterface.h"
30#include "../ShuttleGetDefinition.h"
31#include "CommandContext.h"
32#include "../commands/AudacityCommand.h"
33#include "PluginManager.h"
34#include "Track.h"
35
36
37/*******************************************************************************
38Creates 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.
60 std::unique_ptr<EffectPlugin> uEffect)
61{
62 auto pEffect = uEffect.get();
63 const PluginID & ID =
65 mEffects[ID] = { pEffect, {} };
66 return ID;
67}
68
69// Here solely for the purpose of Nyquist Workbench until
70// a better solution is devised.
72{
73 PluginID id = ID;
75 mEffects.erase(id);
76}
77
79 const CommandContext &context,
80 wxWindow *parent,
81 bool shouldPrompt /* = true */)
82
83{
84 this->SetSkipStateFlag(false);
86
87 if (!command)
88 {
89 return false;
90 }
91
92 bool res = command->DoAudacityCommand(parent, context, shouldPrompt);
93
94 return res;
95}
96
98{
99 return PluginManager::Get().GetSymbol(ID);
100}
101
103{
104 return GetCommandSymbol(ID).Msgid();
105}
106
108{
109 if(auto description = PluginManager::Get().GetPlugin(ID))
110 return TranslatableString { description->GetEffectFamily(), {} };
111
112 auto effect = GetEffect(ID);
113 if (effect)
114 return effect->GetDefinition().GetFamily().Msgid();
115 return {};
116}
117
119{
120 if(auto description = PluginManager::Get().GetPlugin(ID))
121 return TranslatableString { description->GetVendor(), {} };
122
123 auto effect = GetEffect(ID);
124 if (effect)
125 return effect->GetDefinition().GetVendor().Msgid();
126 return {};
127}
128
130{
133}
134
136{
137 if (GetEffect(ID))
138 return XO("Applied effect: %s").Format( GetCommandName(ID) );
139 if (GetAudacityCommand(ID))
140 return XO("Applied command: %s").Format( GetCommandName(ID) );
141
142 return {};
143}
144
146{
147 if (auto pEff = GetEffect(ID))
148 return pEff->GetDefinition().ManualPage();
150 if( pCom )
151 return pCom->ManualPage();
152
153 return wxEmptyString;
154}
155
157{
158 if (auto pEff = GetEffect(ID))
159 return pEff->GetDefinition().GetDescription();
161 if( pCom )
162 return pCom->GetDescription();
163
164 return {};
165}
166
167
168void EffectManager::GetCommandDefinition(const PluginID & ID, const CommandContext & context, int flags)
169{
170 const EffectSettingsManager *effect = nullptr;
172 AudacityCommand *command = nullptr;
173
174 if (auto [edi, pSettings] = GetEffectAndDefaultSettings(ID); edi) {
175 effect = &edi->GetDefinition();
176 assert(pSettings); // postcondition
177 settings = pSettings;
178 }
179 else
180 command = GetAudacityCommand( ID );
181 if ( !effect && !command )
182 return;
183
184 ConstSettingsVisitor NullShuttle;
185
186 // Test if it defines any parameters at all.
187 bool bHasParams = command
188 ? command->VisitSettings( NullShuttle )
189 : effect->VisitSettings( NullShuttle, *settings );
190 if ( (flags == 0) && !bHasParams )
191 return;
192
193 // This is capturing the output context into the shuttle.
194 ShuttleGetDefinition S( *context.pOutput.get()->mStatusTarget.get() );
195 S.StartStruct();
196 // using GET to expose a CommandID to the user!
197 // Macro command details are one place that we do expose Identifier
198 // to (more sophisticated) users
199 S.AddItem( GetCommandIdentifier( ID ).GET(), "id" );
200 S.AddItem( GetCommandName( ID ).Translation(), "name" );
201 if ( bHasParams ) {
202 S.StartField( "params" );
203 S.StartArray();
204 command
205 ? command->VisitSettings( S )
206 : effect->VisitSettings( S, *settings );
207 S.EndArray();
208 S.EndField();
209 }
210 // use GET() to expose some details to macro programming users
211 S.AddItem( GetCommandUrl( ID ).GET(), "url" );
212 // The tip is a translated string!
213 S.AddItem( GetCommandTip( ID ).Translation(), "tip" );
214 S.EndStruct();
215}
216
217
218
220{
221 if(auto effect = GetEffect(ID))
222 return effect->GetDefinition().IsHiddenFromMenus();
223 return false;
224}
225
227{
229}
230
232{
233 return mSkipStateFlag;
234}
235
237{
239 if (plug)
240 {
241 return plug->IsEffectAutomatable();
242 }
243
244 return false;
245}
246
247// This function is used only in the macro programming user interface
249{
250 auto pair = GetEffectAndDefaultSettings(ID);
251 if (auto effect = pair.first) {
252 assert(pair.second); // postcondition
253 wxString parms;
254
255 effect->SaveSettingsAsString(*pair.second, parms);
256
257 // Some effects don't have automatable parameters and will not return
258 // anything, so try to get the active preset (current or factory).
259 if (parms.empty())
260 {
261 parms = GetDefaultPreset(ID);
262 }
263
264 return parms;
265 }
266
267 AudacityCommand *command = GetAudacityCommand(ID);
268
269 if (command)
270 {
271 wxString parms;
272
273 command->SaveSettingsAsString(parms);
274
275 // Some effects don't have automatable parameters and will not return
276 // anything, so try to get the active preset (current or factory).
277 if (parms.empty())
278 {
279 parms = GetDefaultPreset(ID);
280 }
281
282 return parms;
283 }
284 return wxEmptyString;
285}
286
287// This function is used only in the macro programming user interface
289 const PluginID & ID, const wxString & params)
290{
291 auto pair = GetEffectAndDefaultSettings(ID);
292 if (auto effect = pair.first) {
293 assert(pair.second); // postcondition
294 auto &settings = *pair.second;
296
297 // Check first for what GetDefaultPreset() might have written
298 if (eap.HasEntry(wxT("Use Preset")))
299 {
300 return effect->LoadSettingsFromString(
301 eap.Read(wxT("Use Preset")), settings).has_value();
302 }
303
304 return effect->LoadSettingsFromString(params, settings).has_value();
305 }
306 AudacityCommand *command = GetAudacityCommand(ID);
307
308 if (command)
309 {
310 // Set defaults (if not initialised) before setting values.
311 command->Init();
313
314 // Check first for what GetDefaultPreset() might have written
315 if (eap.HasEntry(wxT("Use Preset")))
316 {
317 return command
318 ->LoadSettingsFromString(eap.Read(wxT("Use Preset")));
319 }
320
321 return command->LoadSettingsFromString(params);
322 }
323 return false;
324}
325
327
331 const PluginID & ID, const EffectDialogFactory &factory, wxWindow &parent)
332{
333 bool result = false;
334 if (auto effect = dynamic_cast<Effect*>(GetEffect(ID))) {
335
336 auto empty = TrackList::Create(nullptr);
337 auto pEffectBase = dynamic_cast<EffectBase*>(effect);
338 if (pEffectBase)
339 // This allows effects to call Init() safely
340 pEffectBase->SetTracks(empty.get());
341 Finally Do([&]{
342 // reverse the side-effect
343 if (pEffectBase)
344 pEffectBase->SetTracks(nullptr);
345 });
346
347 std::shared_ptr<EffectInstance> pInstance;
350 if (const auto pSettings = GetDefaultSettings(ID)) {
351 const auto pServices = dynamic_cast<EffectUIServices *>(effect);
352 result = pServices && pServices->ShowHostInterface(*effect,
353 parent, factory,
354 pInstance,
355 *std::make_shared<SimpleEffectSettingsAccess>(*pSettings),
356 effect->IsBatchProcessing() ) != 0;
357 }
358 return result;
359 }
360
361 AudacityCommand *command = GetAudacityCommand(ID);
362
363 if (command)
364 {
365 result = command->PromptUser(&parent);
366 return result;
367 }
368
369 return result;
370}
371
373{
376}
377
379{
382}
383
385{
386 RegistryPaths presets;
388 UserPresetsGroup({}), presets);
389 std::sort( presets.begin(), presets.end() );
390 return presets;
391}
392
394{
395 auto effect = GetEffect(ID);
396
397 if (!effect)
398 {
399 return false;
400 }
401
402 return GetUserPresets(*effect).size() > 0 ||
403 effect->GetDefinition().GetFactoryPresets().size() > 0 ||
404 HasCurrentSettings(*effect) ||
405 HasFactoryDefaults(*effect);
406}
407
408#include <wx/choice.h>
409#include <wx/listbox.h>
410#include "ShuttleGui.h"
411
412namespace {
413
415//
416// EffectPresetsDialog
417//
419
421{
422public:
423 EffectPresetsDialog(wxWindow *parent, EffectPlugin *effect);
424 virtual ~EffectPresetsDialog();
425
426 wxString GetSelected() const;
427 void SetSelected(const wxString & parms);
428
429private:
430 void SetPrefix(const TranslatableString & type, const wxString & prefix);
431 void UpdateUI();
432
433 void OnType(wxCommandEvent & evt);
434 void OnOk(wxCommandEvent & evt);
435 void OnCancel(wxCommandEvent & evt);
436
437private:
438 wxChoice *mType;
439 wxListBox *mPresets;
440
443 wxString mSelection;
444
445 DECLARE_EVENT_TABLE()
446};
447
448enum
449{
450 ID_Type = 10000
452
453BEGIN_EVENT_TABLE(EffectPresetsDialog, wxDialogWrapper)
454 EVT_CHOICE(ID_Type, EffectPresetsDialog::OnType)
455 EVT_LISTBOX_DCLICK(wxID_ANY, EffectPresetsDialog::OnOk)
456 EVT_BUTTON(wxID_OK, EffectPresetsDialog::OnOk)
457 EVT_BUTTON(wxID_CANCEL, EffectPresetsDialog::OnCancel)
459
461 wxWindow *parent, EffectPlugin *effect)
462: wxDialogWrapper(parent, wxID_ANY, XO("Select Preset"))
463{
464 ShuttleGui S(this, eIsCreating);
465 S.StartVerticalLay();
466 {
467 S.StartTwoColumn();
468 S.SetStretchyCol(1);
469 {
470 S.AddPrompt(XXO("Type:"));
471 mType = S.Id(ID_Type).AddChoice( {}, {}, 0 );
472
473 S.AddPrompt(XXO("&Preset:"));
474 mPresets = S
475 .Style( wxLB_SINGLE | wxLB_NEEDED_SB )
476 .AddListBox( {} );
477 }
478 S.EndTwoColumn();
479
480 S.AddStandardButtons();
481 }
482 S.EndVerticalLay();
483
484 mUserPresets = GetUserPresets(*effect);
485 mFactoryPresets = effect->GetDefinition().GetFactoryPresets();
486
487 if (mUserPresets.size() > 0)
488 {
489 mType->Append(_("User Presets"));
490 }
491
492 if (mFactoryPresets.size() > 0)
493 {
494 mType->Append(_("Factory Presets"));
495 }
496
497 if (HasCurrentSettings(*effect))
498 {
499 mType->Append(_("Current Settings"));
500 }
501
502 if (HasFactoryDefaults(*effect))
503 {
504 mType->Append(_("Factory Defaults"));
505 }
506
507 UpdateUI();
508}
509
510EffectPresetsDialog::~EffectPresetsDialog()
511{
512}
513
514wxString EffectPresetsDialog::GetSelected() const
515{
516 return mSelection;
517}
518
519void EffectPresetsDialog::SetSelected(const wxString & parms)
520{
521 wxString preset = parms;
523 {
524 preset.Replace(EffectPlugin::kUserPresetIdent, wxEmptyString, false);
525 SetPrefix(XO("User Presets"), preset);
526 }
527 else if (preset.StartsWith(EffectPlugin::kFactoryPresetIdent))
528 {
529 preset.Replace(EffectPlugin::kFactoryPresetIdent, wxEmptyString, false);
530 SetPrefix(XO("Factory Presets"), preset);
531 }
532 else if (preset.StartsWith(EffectPlugin::kCurrentSettingsIdent))
533 {
534 SetPrefix(XO("Current Settings"), wxEmptyString);
535 }
536 else if (preset.StartsWith(EffectPlugin::kFactoryDefaultsIdent))
537 {
538 SetPrefix(XO("Factory Defaults"), wxEmptyString);
539 }
540}
541
542void EffectPresetsDialog::SetPrefix(
543 const TranslatableString & type, const wxString & prefix)
544{
545 mType->SetStringSelection(type.Translation());
546
547 if (type == XO("User Presets"))
548 {
549 mPresets->Clear();
550 for (const auto &preset : mUserPresets)
551 mPresets->Append(preset);
552 mPresets->Enable(true);
553 mPresets->SetStringSelection(prefix);
554 if (mPresets->GetSelection() == wxNOT_FOUND)
555 {
556 mPresets->SetSelection(0);
557 }
559 + mPresets->GetStringSelection();
560 }
561 else if (type == XO("Factory Presets"))
562 {
563 mPresets->Clear();
564 for (size_t i = 0, cnt = mFactoryPresets.size(); i < cnt; i++)
565 {
566 auto label = mFactoryPresets[i];
567 if (label.empty())
568 {
569 label = _("None");
570 }
571 mPresets->Append(label);
572 }
573 mPresets->Enable(true);
574 mPresets->SetStringSelection(prefix);
575 if (mPresets->GetSelection() == wxNOT_FOUND)
576 {
577 mPresets->SetSelection(0);
578 }
580 + mPresets->GetStringSelection();
581 }
582 else if (type == XO("Current Settings"))
583 {
584 mPresets->Clear();
585 mPresets->Enable(false);
587 }
588 else if (type == XO("Factory Defaults"))
589 {
590 mPresets->Clear();
591 mPresets->Enable(false);
593 }
594}
595
596void EffectPresetsDialog::UpdateUI()
597{
598 int selected = mType->GetSelection();
599 if (selected == wxNOT_FOUND)
600 {
601 selected = 0;
602 mType->SetSelection(selected);
603 }
604 wxString type = mType->GetString(selected);
605
606 if (type == _("User Presets"))
607 {
608 selected = mPresets->GetSelection();
609 if (selected == wxNOT_FOUND)
610 {
611 selected = 0;
612 }
613
614 mPresets->Clear();
615 for (const auto &preset : mUserPresets)
616 mPresets->Append(preset);
617 mPresets->Enable(true);
618 mPresets->SetSelection(selected);
620 + mPresets->GetString(selected);
621 }
622 else if (type == _("Factory Presets"))
623 {
624 selected = mPresets->GetSelection();
625 if (selected == wxNOT_FOUND)
626 {
627 selected = 0;
628 }
629
630 mPresets->Clear();
631 for (size_t i = 0, cnt = mFactoryPresets.size(); i < cnt; i++)
632 {
633 auto label = mFactoryPresets[i];
634 if (label.empty())
635 {
636 label = _("None");
637 }
638 mPresets->Append(label);
639 }
640 mPresets->Enable(true);
641 mPresets->SetSelection(selected);
643 + mPresets->GetString(selected);
644 }
645 else if (type == _("Current Settings"))
646 {
647 mPresets->Clear();
648 mPresets->Enable(false);
650 }
651 else if (type == _("Factory Defaults"))
652 {
653 mPresets->Clear();
654 mPresets->Enable(false);
656 }
657}
658
659void EffectPresetsDialog::OnType(wxCommandEvent & WXUNUSED(evt))
660{
661 UpdateUI();
662}
663
664void EffectPresetsDialog::OnOk(wxCommandEvent & WXUNUSED(evt))
665{
666 UpdateUI();
667
668 EndModal(true);
669}
670
671void EffectPresetsDialog::OnCancel(wxCommandEvent & WXUNUSED(evt))
672{
673 mSelection = wxEmptyString;
674
675 EndModal(false);
676}
677
678}
679
680// This function is used only in the macro programming user interface
681wxString EffectManager::GetPreset(const PluginID & ID, const wxString & params, wxWindow * parent)
682{
683 auto effect = GetEffect(ID);
684
685 if (!effect)
686 {
687 return wxEmptyString;
688 }
689
691
692 wxString preset;
693 if (eap.HasEntry(wxT("Use Preset")))
694 {
695 preset = eap.Read(wxT("Use Preset"));
696 }
697
698 {
699 EffectPresetsDialog dlg(parent, effect);
700 dlg.Layout();
701 dlg.Fit();
702 dlg.SetSize(dlg.GetMinSize());
703 dlg.CenterOnParent();
704 dlg.SetSelected(preset);
705
706 if (dlg.ShowModal())
707 preset = dlg.GetSelected();
708 else
709 preset = wxEmptyString;
710 }
711
712 if (preset.empty())
713 {
714 return preset;
715 }
716
717 // This cleans a config "file" backed by a string in memory.
718 eap.DeleteAll();
719
720 eap.Write(wxT("Use Preset"), preset);
722
723 return preset;
724}
725
726// This function is used only in the macro programming user interface
728{
729 auto effect = GetEffect(ID);
730
731 if (!effect)
732 {
733 return wxEmptyString;
734 }
735
736 wxString preset;
737 if (HasCurrentSettings(*effect))
738 {
740 }
741 else if (HasFactoryDefaults(*effect))
742 {
744 }
745
746 if (!preset.empty())
747 {
749
750 eap.Write(wxT("Use Preset"), preset);
752 }
753
754 return preset;
755}
756
758{
759 if (auto effect = GetEffect(ID))
760 effect->SetBatchProcessing();
761 else if (auto command = GetAudacityCommand(ID))
762 command->SetBatchProcessing(true);
763}
764
766{
767 if (auto effect = GetEffect(ID))
768 effect->UnsetBatchProcessing();
769 else if (auto command = GetAudacityCommand(ID))
770 command->SetBatchProcessing(false);
771}
772
774{
775 return DoGetEffect(ID).effect;
776}
777
779{
780 return GetEffectAndDefaultSettings(ID).second;
781}
782
783std::pair<EffectPlugin *, EffectSettings *>
785{
786 auto &results = DoGetEffect(ID);
787 if (results.effect)
788 return {results.effect, &results.settings};
789 else
790 return {nullptr, nullptr};
791}
792
793namespace {
794// Before: settings are as defaulted by `manager.MakeSettings()`
795// Do as needed (once, persistently, when the plug-in is first used): store
796// those default values into the config under "FactoryDefaults" preset
797// After: settings are loaded for the "CurrentSettings" preset
800 // Config key remembering whether we already stored FactoryDefaults
801 constexpr auto InitializedKey = L"Initialized";
802 if (bool haveDefaults{};
804 InitializedKey, haveDefaults, false),
805 !haveDefaults
806 ) {
807 manager.SaveUserPreset(FactoryDefaultsGroup(), settings);
808 // Also initialize the "current" settings --
809 if (bool haveCurrent{};
811 InitializedKey, haveCurrent, false),
812 !haveCurrent
813 ) {
814 manager.SaveUserPreset(CurrentSettingsGroup(), settings);
815 }
817 InitializedKey, true);
818 }
819 // ignore failure
820 (void) manager.LoadUserPreset(CurrentSettingsGroup(), settings);
821}
822
823std::pair<ComponentInterface *, EffectSettings>
825{
826 if (auto result = dynamic_cast<EffectSettingsManager*>(
827 PluginManager::Get().Load(ID))) {
828 auto settings = result->MakeSettings();
829 InitializePreset(*result, settings);
830 return { result, std::move(settings) };
831 }
832 return { nullptr, {} };
833}
834}
835
837{
838 static EffectAndDefaultSettings empty;
839
840 // Must have a "valid" ID
841 if (ID.empty())
842 return empty;
843
844 // If it is actually a command then refuse it (as an effect).
845 if( mCommands.find( ID ) != mCommands.end() )
846 return empty;
847
848 if (auto iter = mEffects.find(ID); iter != mEffects.end())
849 return iter->second;
850 else {
851 // This will instantiate the effect client if it hasn't already been done
852 auto [component, settings] = LoadComponent(ID);
853 if (!component)
854 return empty;
855
856 if (auto effect = dynamic_cast<EffectPlugin *>(component))
857 return (mEffects[ID] = { effect, std::move(settings) });
858 else {
859 if ( !dynamic_cast<AudacityCommand *>(component) )
861 XO(
862"Attempting to initialize the following effect failed:\n\n%s\n\nMore information may be available in 'Help > Diagnostics > Show Log'")
863 .Format( GetCommandName(ID) ),
864 XO("Effect failed to initialize"));
865
866 return empty;
867 }
868 }
869}
870
872{
873 // Must have a "valid" ID
874 if (ID.empty())
875 {
876 return NULL;
877 }
878
879 if (mCommands.find(ID) == mCommands.end()) {
880 // This will instantiate the command if it hasn't already been done
881 auto command =
882 dynamic_cast<AudacityCommand *>(PluginManager::Get().Load(ID));
883 if (command)
884 {
885 command->Init();
886 mCommands[ID] = command;
887 return command;
888 }
889
891 XO(
892"Attempting to initialize the following command failed:\n\n%s\n\nMore information may be available in 'Help > Diagnostics > Show Log'")
893 .Format( GetCommandName(ID) ),
894 XO("Command failed to initialize"));
895
896 return NULL;
897 }
898
899 return mCommands[ID];
900}
901
902
904{
905 static PluginID empty;
906 if (strTarget.empty()) // set GetCommandIdentifier to wxT("") to not show an effect in Batch mode
907 {
908 return empty;
909 }
910
912 // Effects OR Generic commands...
913 for (auto &plug
915 auto &ID = plug.GetID();
916 if (GetCommandIdentifier(ID) == strTarget)
917 return ID;
918 }
919 return empty;
920}
921
924{
925 return Get().GetEffect(ID);
926}
wxT("CloseDown"))
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
static RegisteredToolbarFactory factory
END_EVENT_TABLE()
wxString PluginID
EVT_BUTTON(wxID_NO, DependencyDialog::OnNo) EVT_BUTTON(wxID_YES
EffectDistortionSettings params
Definition: Distortion.cpp:77
const TranslatableString name
Definition: Distortion.cpp:76
RegistryPath UserPresetsGroup(const RegistryPath &name)
Compute part of a registry path, given a name which may be empty.
const RegistryPath & FactoryDefaultsGroup()
Component of a configuration key path, for default state of MakeSettings()
const RegistryPath & CurrentSettingsGroup()
Component of a configuration key path, for last-used destructive settings.
static bool HasFactoryDefaults(EffectPlugin &host)
static bool HasCurrentSettings(EffectPlugin &host)
static RegistryPaths GetUserPresets(EffectPlugin &host)
std::function< DialogFactoryResults(wxWindow &parent, EffectBase &, EffectUIServices &, EffectSettingsAccess &) > EffectDialogFactory
Type of function that creates a dialog for an effect.
XO("Cut/Copy/Paste")
XXO("&Cut/Copy/Paste Toolbar")
std::vector< RegistryPath > RegistryPaths
Definition: Identifier.h:219
#define _(s)
Definition: Internat.h:73
@ PluginTypeAudacityCommand
@ PluginTypeEffect
static const AttachedProjectObjects::RegisteredFactory manager
EffectReverbSettings preset
Definition: Reverb.cpp:44
@ ID_Type
Definition: ScienFilter.cpp:79
@ eIsCreating
Definition: ShuttleGui.h:37
TranslatableString label
Definition: TagsEditor.cpp:165
#define S(N)
Definition: ToChars.cpp:64
declares abstract base class Track, TrackList, and iterators over TrackList
static Settings & settings()
Definition: TrackInfo.cpp:69
static std::once_flag flag
Base class for command in Audacity.
virtual bool Init()
bool LoadSettingsFromString(const wxString &parms)
bool SaveSettingsAsString(wxString &parms)
virtual bool VisitSettings(SettingsVisitor &)
virtual bool PromptUser(wxWindow *parent)
virtual ManualPageID ManualPage()
bool DoAudacityCommand(wxWindow *parent, const CommandContext &context, bool shouldPrompt=true)
virtual TranslatableString GetDescription() const override
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
std::unique_ptr< CommandOutputTargets > pOutput
CommandParameters, derived from wxFileConfig, is essentially doing the same things as the SettingsVis...
virtual bool HasEntry(const wxString &strName) const override
bool GetParameters(wxString &parms)
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
const wxString & Internal() const
const TranslatableString & Msgid() const
Base class for many of the effects in Audacity.
Definition: EffectBase.h:28
void SetTracks(TrackList *pTracks)
Definition: EffectBase.cpp:43
static Identifier GetSquashedName(const Identifier &ident)
A utility that strips spaces and CamelCases a name.
Base class for many of the effects in Audacity.
Definition: Effect.h:26
EffectManager is the class that handles effects and effect categories.
Definition: EffectManager.h:48
bool SupportsAutomation(const PluginID &ID)
ComponentInterfaceSymbol GetCommandSymbol(const PluginID &ID)
ManualPageID GetCommandUrl(const PluginID &ID)
CommandID GetCommandIdentifier(const PluginID &ID)
bool HasPresets(const PluginID &ID)
bool GetSkipStateFlag()
void BatchProcessingOff(const PluginID &ID)
AudacityCommand * GetAudacityCommand(const PluginID &ID)
void SetSkipStateFlag(bool flag)
EffectPlugin * GetEffect(const PluginID &ID)
void GetCommandDefinition(const PluginID &ID, const CommandContext &context, int flags)
EffectMap mEffects
static const EffectInstanceFactory * GetInstanceFactory(const PluginID &ID)
void BatchProcessingOn(const PluginID &ID)
std::pair< EffectPlugin *, EffectSettings * > GetEffectAndDefaultSettings(const PluginID &ID)
static EffectManager & Get()
EffectSettings * GetDefaultSettings(const PluginID &ID)
TranslatableString GetCommandName(const PluginID &ID)
TranslatableString GetVendorName(const PluginID &ID)
wxString GetDefaultPreset(const PluginID &ID)
bool DoAudacityCommand(const PluginID &ID, const CommandContext &, wxWindow *parent, bool shouldPrompt=true)
const PluginID & RegisterEffect(std::unique_ptr< EffectPlugin > uEffect)
Here solely for the purpose of Nyquist Workbench until a better solution is devised.
bool SetEffectParameters(const PluginID &ID, const wxString &params)
wxString GetPreset(const PluginID &ID, const wxString &params, wxWindow *parent)
TranslatableString GetEffectFamilyName(const PluginID &ID)
TranslatableString GetCommandTip(const PluginID &ID)
void UnregisterEffect(const PluginID &ID)
Used only by Nyquist Workbench module.
EffectAndDefaultSettings & DoGetEffect(const PluginID &ID)
wxString GetEffectParameters(const PluginID &ID)
AudacityCommandMap mCommands
virtual ~EffectManager()
bool IsHidden(const PluginID &ID)
const PluginID & GetEffectByIdentifier(const CommandID &strTarget)
TranslatableString GetCommandDescription(const PluginID &ID)
bool PromptUser(const PluginID &ID, const EffectDialogFactory &factory, wxWindow &parent)
Shows an effect or command dialog so the user can specify settings for later.
Factory of instances of an effect.
Definition: EffectPlugin.h:36
static const wxString kUserPresetIdent
Definition: EffectPlugin.h:40
static const wxString kFactoryPresetIdent
Definition: EffectPlugin.h:41
virtual const EffectSettingsManager & GetDefinition() const =0
static const wxString kCurrentSettingsIdent
Definition: EffectPlugin.h:42
static const wxString kFactoryDefaultsIdent
Definition: EffectPlugin.h:43
EffectSettingsManager is an EffectDefinitionInterface that adds a factory function for EffectSettings...
virtual bool VisitSettings(SettingsVisitor &visitor, EffectSettings &settings)
virtual int ShowHostInterface(EffectBase &plugin, wxWindow &parent, const EffectDialogFactory &factory, std::shared_ptr< EffectInstance > &pInstance, EffectSettingsAccess &access, bool forceModal=false)
Abstract base class used in importing a file.
bool empty() const
Definition: Identifier.h:61
bool IsEffectAutomatable() const
PluginManager maintains a list of all plug ins. That covers modules, effects, generators,...
Definition: PluginManager.h:51
ComponentInterface * Load(const PluginID &ID)
void UnregisterPlugin(const PluginID &ID)
Range PluginsOfType(int type)
const PluginDescriptor * GetPlugin(const PluginID &ID) const
void RegisterPlugin(PluginDescriptor &&desc)
const ComponentInterfaceSymbol & GetSymbol(const PluginID &ID)
static PluginManager & Get()
Visitor of effect or command parameters. This is a base class with lots of virtual functions that do ...
SettingsVisitor that retrieves a JSON format definition of a command's parameters.
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
static TrackListHolder Create(AudacityProject *pOwner)
Definition: Track.cpp:330
Holds a msgid for the translation catalog; may also bind format arguments.
wxString Translation() const
bool GetConfigSubgroups(const EffectDefinitionInterface &ident, PluginSettings::ConfigurationType type, const RegistryPath &group, RegistryPaths &subgroups)
bool SetConfig(const EffectDefinitionInterface &ident, ConfigurationType type, const RegistryPath &group, const RegistryPath &key, const Value &value)
bool HasConfigGroup(const EffectDefinitionInterface &ident, PluginSettings::ConfigurationType type, const RegistryPath &group)
bool GetConfig(const EffectDefinitionInterface &ident, ConfigurationType type, const RegistryPath &group, const RegistryPath &key, Value &var, const Value &defval)
THEME_RESOURCES_API void Load()
std::pair< ComponentInterface *, EffectSettings > LoadComponent(const PluginID &ID)
void InitializePreset(EffectSettingsManager &manager, EffectSettings &settings)
Externalized state of a plug-in.
"finally" as in The C++ Programming Language, 4th ed., p. 358 Useful for defining ad-hoc RAII actions...
Definition: MemoryX.h:174