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 "ConfigInterface.h"
32#include "../ShuttleGetDefinition.h"
33#include "../commands/CommandContext.h"
34#include "../commands/AudacityCommand.h"
35#include "PluginManager.h"
36#include "Track.h"
37
38
39/*******************************************************************************
40Creates a singleton and returns reference
41
42 (Thread-safe...no active threading during construction or after destruction)
43*******************************************************************************/
45{
46 static EffectManager em;
47 return em;
48}
49
51{
52 mSkipStateFlag = false;
53}
54
56{
57}
58
59// Here solely for the purpose of Nyquist Workbench until
60// a better solution is devised.
62 std::unique_ptr<EffectPlugin> uEffect)
63{
64 auto pEffect = uEffect.get();
65 const PluginID & ID =
67 mEffects[ID] = { pEffect, {} };
68 return ID;
69}
70
71// Here solely for the purpose of Nyquist Workbench until
72// a better solution is devised.
74{
75 PluginID id = ID;
77 mEffects.erase(id);
78}
79
81 const CommandContext &context,
82 wxWindow *parent,
83 bool shouldPrompt /* = true */)
84
85{
86 this->SetSkipStateFlag(false);
88
89 if (!command)
90 {
91 return false;
92 }
93
94 bool res = command->DoAudacityCommand(parent, context, shouldPrompt);
95
96 return res;
97}
98
100{
101 return PluginManager::Get().GetSymbol(ID);
102}
103
105{
106 return GetCommandSymbol(ID).Msgid();
107}
108
110{
111 if(auto description = PluginManager::Get().GetPlugin(ID))
112 return TranslatableString { description->GetEffectFamily(), {} };
113
114 auto effect = GetEffect(ID);
115 if (effect)
116 return effect->GetDefinition().GetFamily().Msgid();
117 return {};
118}
119
121{
122 if(auto description = PluginManager::Get().GetPlugin(ID))
123 return TranslatableString { description->GetVendor(), {} };
124
125 auto effect = GetEffect(ID);
126 if (effect)
127 return effect->GetDefinition().GetVendor().Msgid();
128 return {};
129}
130
132{
135}
136
138{
139 if (GetEffect(ID))
140 return XO("Applied effect: %s").Format( GetCommandName(ID) );
141 if (GetAudacityCommand(ID))
142 return XO("Applied command: %s").Format( GetCommandName(ID) );
143
144 return {};
145}
146
148{
149 if (auto pEff = GetEffect(ID))
150 return pEff->GetDefinition().ManualPage();
152 if( pCom )
153 return pCom->ManualPage();
154
155 return wxEmptyString;
156}
157
159{
160 if (auto pEff = GetEffect(ID))
161 return pEff->GetDefinition().GetDescription();
163 if( pCom )
164 return pCom->GetDescription();
165
166 return {};
167}
168
169
170void EffectManager::GetCommandDefinition(const PluginID & ID, const CommandContext & context, int flags)
171{
172 const EffectSettingsManager *effect = nullptr;
174 AudacityCommand *command = nullptr;
175
176 if (auto [edi, pSettings] = GetEffectAndDefaultSettings(ID); edi) {
177 effect = &edi->GetDefinition();
178 assert(pSettings); // postcondition
179 settings = pSettings;
180 }
181 else
182 command = GetAudacityCommand( ID );
183 if ( !effect && !command )
184 return;
185
186 ConstSettingsVisitor NullShuttle;
187
188 // Test if it defines any parameters at all.
189 bool bHasParams = command
190 ? command->VisitSettings( NullShuttle )
191 : effect->VisitSettings( NullShuttle, *settings );
192 if ( (flags == 0) && !bHasParams )
193 return;
194
195 // This is capturing the output context into the shuttle.
196 ShuttleGetDefinition S( *context.pOutput.get()->mStatusTarget.get() );
197 S.StartStruct();
198 // using GET to expose a CommandID to the user!
199 // Macro command details are one place that we do expose Identifier
200 // to (more sophisticated) users
201 S.AddItem( GetCommandIdentifier( ID ).GET(), "id" );
202 S.AddItem( GetCommandName( ID ).Translation(), "name" );
203 if ( bHasParams ) {
204 S.StartField( "params" );
205 S.StartArray();
206 command
207 ? command->VisitSettings( S )
208 : effect->VisitSettings( S, *settings );
209 S.EndArray();
210 S.EndField();
211 }
212 // use GET() to expose some details to macro programming users
213 S.AddItem( GetCommandUrl( ID ).GET(), "url" );
214 // The tip is a translated string!
215 S.AddItem( GetCommandTip( ID ).Translation(), "tip" );
216 S.EndStruct();
217}
218
219
220
222{
223 if(auto effect = GetEffect(ID))
224 return effect->GetDefinition().IsHiddenFromMenus();
225 return false;
226}
227
229{
231}
232
234{
235 return mSkipStateFlag;
236}
237
239{
241 if (plug)
242 {
243 return plug->IsEffectAutomatable();
244 }
245
246 return false;
247}
248
249// This function is used only in the macro programming user interface
251{
252 auto pair = GetEffectAndDefaultSettings(ID);
253 if (auto effect = pair.first) {
254 assert(pair.second); // postcondition
255 wxString parms;
256
257 effect->SaveSettingsAsString(*pair.second, parms);
258
259 // Some effects don't have automatable parameters and will not return
260 // anything, so try to get the active preset (current or factory).
261 if (parms.empty())
262 {
263 parms = GetDefaultPreset(ID);
264 }
265
266 return parms;
267 }
268
269 AudacityCommand *command = GetAudacityCommand(ID);
270
271 if (command)
272 {
273 wxString parms;
274
275 command->SaveSettingsAsString(parms);
276
277 // Some effects don't have automatable parameters and will not return
278 // anything, so try to get the active preset (current or factory).
279 if (parms.empty())
280 {
281 parms = GetDefaultPreset(ID);
282 }
283
284 return parms;
285 }
286 return wxEmptyString;
287}
288
289// This function is used only in the macro programming user interface
291 const PluginID & ID, const wxString & params)
292{
293 auto pair = GetEffectAndDefaultSettings(ID);
294 if (auto effect = pair.first) {
295 assert(pair.second); // postcondition
296 auto &settings = *pair.second;
298
299 // Check first for what GetDefaultPreset() might have written
300 if (eap.HasEntry(wxT("Use Preset")))
301 {
302 return effect->LoadSettingsFromString(
303 eap.Read(wxT("Use Preset")), settings).has_value();
304 }
305
306 return effect->LoadSettingsFromString(params, settings).has_value();
307 }
308 AudacityCommand *command = GetAudacityCommand(ID);
309
310 if (command)
311 {
312 // Set defaults (if not initialised) before setting values.
313 command->Init();
315
316 // Check first for what GetDefaultPreset() might have written
317 if (eap.HasEntry(wxT("Use Preset")))
318 {
319 return command
320 ->LoadSettingsFromString(eap.Read(wxT("Use Preset")));
321 }
322
323 return command->LoadSettingsFromString(params);
324 }
325 return false;
326}
327
329
333 const PluginID & ID, const EffectDialogFactory &factory, wxWindow &parent)
334{
335 bool result = false;
336 if (auto effect = GetEffect(ID)) {
337
338 auto empty = TrackList::Create(nullptr);
339 auto pEffectBase = dynamic_cast<EffectBase*>(effect);
340 if (pEffectBase)
341 // This allows effects to call Init() safely
342 pEffectBase->SetTracks(empty.get());
343 Finally Do([&]{
344 // reverse the side-effect
345 if (pEffectBase)
346 pEffectBase->SetTracks(nullptr);
347 });
348
349 std::shared_ptr<EffectInstance> pInstance;
352 if (const auto pSettings = GetDefaultSettings(ID))
353 result = effect->ShowHostInterface(
354 parent, factory,
355 pInstance,
356 *std::make_shared<SimpleEffectSettingsAccess>(*pSettings),
357 effect->IsBatchProcessing() ) != 0;
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 if (auto client = dynamic_cast<EffectUIClientInterface *>(component)) {
859 // Nothing inherits EffectUIClientInterface now that does not also
860 // inherit EffectPlugin
861 wxASSERT(false);
862 return empty;
863 }
864 else {
865 if ( !dynamic_cast<AudacityCommand *>(component) )
867 XO(
868"Attempting to initialize the following effect failed:\n\n%s\n\nMore information may be available in 'Help > Diagnostics > Show Log'")
869 .Format( GetCommandName(ID) ),
870 XO("Effect failed to initialize"));
871
872 return empty;
873 }
874 }
875}
876
878{
879 // Must have a "valid" ID
880 if (ID.empty())
881 {
882 return NULL;
883 }
884
885 if (mCommands.find(ID) == mCommands.end()) {
886 // This will instantiate the command if it hasn't already been done
887 auto command =
888 dynamic_cast<AudacityCommand *>(PluginManager::Get().Load(ID));
889 if (command)
890 {
891 command->Init();
892 mCommands[ID] = command;
893 return command;
894 }
895
897 XO(
898"Attempting to initialize the following command failed:\n\n%s\n\nMore information may be available in 'Help > Diagnostics > Show Log'")
899 .Format( GetCommandName(ID) ),
900 XO("Command failed to initialize"));
901
902 return NULL;
903 }
904
905 return mCommands[ID];
906}
907
908
910{
911 static PluginID empty;
912 if (strTarget.empty()) // set GetCommandIdentifier to wxT("") to not show an effect in Batch mode
913 {
914 return empty;
915 }
916
918 // Effects OR Generic commands...
919 for (auto &plug
921 auto &ID = plug.GetID();
922 if (GetCommandIdentifier(ID) == strTarget)
923 return ID;
924 }
925 return empty;
926}
927
930{
931 return Get().GetEffect(ID);
932}
wxT("CloseDown"))
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
END_EVENT_TABLE()
EVT_BUTTON(wxID_NO, DependencyDialog::OnNo) EVT_BUTTON(wxID_YES
EffectDistortion::Params params
Definition: Distortion.cpp:83
const TranslatableString name
Definition: Distortion.cpp:82
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)
wxString PluginID
Definition: EffectManager.h:30
std::function< DialogFactoryResults(wxWindow &parent, EffectPlugin &, EffectUIClientInterface &, EffectSettingsAccess &) > EffectDialogFactory
Type of function that creates a dialog for an effect.
Definition: EffectPlugin.h:41
std::vector< RegistryPath > RegistryPaths
Definition: Identifier.h:219
#define XXO(s)
Definition: Internat.h:44
#define XO(s)
Definition: Internat.h:31
#define _(s)
Definition: Internat.h:75
@ PluginTypeAudacityCommand
@ PluginTypeEffect
static const AttachedProjectObjects::RegisteredFactory manager
EffectReverbSettings preset
Definition: Reverb.cpp:46
@ ID_Type
Definition: ScienFilter.cpp:79
@ eIsCreating
Definition: ShuttleGui.h:39
TranslatableString label
Definition: TagsEditor.cpp:163
#define S(N)
Definition: ToChars.cpp:64
declares abstract base class Track, TrackList, and iterators over TrackList
static Settings & settings()
Definition: TrackInfo.cpp:87
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:33
void SetTracks(TrackList *pTracks)
Definition: EffectBase.h:38
static Identifier GetSquashedName(const Identifier &ident)
A utility that strips spaces and CamelCases a name.
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 and of dialogs to control them.
Definition: EffectPlugin.h:54
static const wxString kUserPresetIdent
Definition: EffectPlugin.h:58
static const wxString kFactoryPresetIdent
Definition: EffectPlugin.h:59
virtual const EffectSettingsManager & GetDefinition() const =0
static const wxString kCurrentSettingsIdent
Definition: EffectPlugin.h:60
static const wxString kFactoryDefaultsIdent
Definition: EffectPlugin.h:61
EffectSettingsManager is an EffectDefinitionInterface that adds a factory function for EffectSettings...
virtual bool VisitSettings(SettingsVisitor &visitor, EffectSettings &settings)
EffectUIClientInterface is an abstract base class to populate a UI and validate UI values....
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:42
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 ...
Definition: Shuttle.h:115
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:628
static std::shared_ptr< TrackList > Create(AudacityProject *pOwner)
Definition: Track.cpp:502
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)
static RegisteredToolbarFactory factory
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:173