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
37
38/*******************************************************************************
39Creates a singleton and returns reference
40
41 (Thread-safe...no active threading during construction or after destruction)
42*******************************************************************************/
44{
45 static EffectManager em;
46 return em;
47}
48
50{
51 mSkipStateFlag = false;
52}
53
55{
56}
57
58// Here solely for the purpose of Nyquist Workbench until
59// a better solution is devised.
61 std::unique_ptr<EffectPlugin> uEffect)
62{
63 auto pEffect = uEffect.get();
64 const PluginID & ID =
66 mEffects[ID] = { pEffect, {} };
67 return ID;
68}
69
70// Here solely for the purpose of Nyquist Workbench until
71// a better solution is devised.
73{
74 PluginID id = ID;
76 mEffects.erase(id);
77}
78
80 const CommandContext &context,
81 wxWindow *parent,
82 bool shouldPrompt /* = true */)
83
84{
85 this->SetSkipStateFlag(false);
87
88 if (!command)
89 {
90 return false;
91 }
92
93 bool res = command->DoAudacityCommand(parent, context, shouldPrompt);
94
95 return res;
96}
97
99{
100 return PluginManager::Get().GetSymbol(ID);
101}
102
104{
105 return GetCommandSymbol(ID).Msgid();
106}
107
109{
110 if(auto description = PluginManager::Get().GetPlugin(ID))
111 return TranslatableString { description->GetEffectFamily(), {} };
112
113 auto effect = GetEffect(ID);
114 if (effect)
115 return effect->GetDefinition().GetFamily().Msgid();
116 return {};
117}
118
120{
121 if(auto description = PluginManager::Get().GetPlugin(ID))
122 return TranslatableString { description->GetVendor(), {} };
123
124 auto effect = GetEffect(ID);
125 if (effect)
126 return effect->GetDefinition().GetVendor().Msgid();
127 return {};
128}
129
131{
134}
135
137{
138 if (GetEffect(ID))
139 return XO("Applied effect: %s").Format( GetCommandName(ID) );
140 if (GetAudacityCommand(ID))
141 return XO("Applied command: %s").Format( GetCommandName(ID) );
142
143 return {};
144}
145
147{
148 if (auto pEff = GetEffect(ID))
149 return pEff->GetDefinition().ManualPage();
151 if( pCom )
152 return pCom->ManualPage();
153
154 return wxEmptyString;
155}
156
158{
159 if (auto pEff = GetEffect(ID))
160 return pEff->GetDefinition().GetDescription();
162 if( pCom )
163 return pCom->GetDescription();
164
165 return {};
166}
167
168
169void EffectManager::GetCommandDefinition(const PluginID & ID, const CommandContext & context, int flags)
170{
171 const EffectSettingsManager *effect = nullptr;
173 AudacityCommand *command = nullptr;
174
175 if (auto [edi, pSettings] = GetEffectAndDefaultSettings(ID); edi) {
176 effect = &edi->GetDefinition();
177 assert(pSettings); // postcondition
178 settings = pSettings;
179 }
180 else
181 command = GetAudacityCommand( ID );
182 if ( !effect && !command )
183 return;
184
185 ConstSettingsVisitor NullShuttle;
186
187 // Test if it defines any parameters at all.
188 bool bHasParams = command
189 ? command->VisitSettings( NullShuttle )
190 : effect->VisitSettings( NullShuttle, *settings );
191 if ( (flags == 0) && !bHasParams )
192 return;
193
194 // This is capturing the output context into the shuttle.
195 ShuttleGetDefinition S( *context.pOutput.get()->mStatusTarget.get() );
196 S.StartStruct();
197 // using GET to expose a CommandID to the user!
198 // Macro command details are one place that we do expose Identifier
199 // to (more sophisticated) users
200 S.AddItem( GetCommandIdentifier( ID ).GET(), "id" );
201 S.AddItem( GetCommandName( ID ).Translation(), "name" );
202 if ( bHasParams ) {
203 S.StartField( "params" );
204 S.StartArray();
205 command
206 ? command->VisitSettings( S )
207 : effect->VisitSettings( S, *settings );
208 S.EndArray();
209 S.EndField();
210 }
211 // use GET() to expose some details to macro programming users
212 S.AddItem( GetCommandUrl( ID ).GET(), "url" );
213 // The tip is a translated string!
214 S.AddItem( GetCommandTip( ID ).Translation(), "tip" );
215 S.EndStruct();
216}
217
218
219
221{
222 if(auto effect = GetEffect(ID))
223 return effect->GetDefinition().IsHiddenFromMenus();
224 return false;
225}
226
228{
230}
231
233{
234 return mSkipStateFlag;
235}
236
238{
240 if (plug)
241 {
242 return plug->IsEffectAutomatable();
243 }
244
245 return false;
246}
247
248// This function is used only in the macro programming user interface
250{
251 auto pair = GetEffectAndDefaultSettings(ID);
252 if (auto effect = pair.first) {
253 assert(pair.second); // postcondition
254 wxString parms;
255
256 effect->SaveSettingsAsString(*pair.second, parms);
257
258 // Some effects don't have automatable parameters and will not return
259 // anything, so try to get the active preset (current or factory).
260 if (parms.empty())
261 {
262 parms = GetDefaultPreset(ID);
263 }
264
265 return parms;
266 }
267
268 AudacityCommand *command = GetAudacityCommand(ID);
269
270 if (command)
271 {
272 wxString parms;
273
274 command->SaveSettingsAsString(parms);
275
276 // Some effects don't have automatable parameters and will not return
277 // anything, so try to get the active preset (current or factory).
278 if (parms.empty())
279 {
280 parms = GetDefaultPreset(ID);
281 }
282
283 return parms;
284 }
285 return wxEmptyString;
286}
287
288// This function is used only in the macro programming user interface
290 const PluginID & ID, const wxString & params)
291{
292 auto pair = GetEffectAndDefaultSettings(ID);
293 if (auto effect = pair.first) {
294 assert(pair.second); // postcondition
295 auto &settings = *pair.second;
297
298 // Check first for what GetDefaultPreset() might have written
299 if (eap.HasEntry(wxT("Use Preset")))
300 {
301 return effect->LoadSettingsFromString(
302 eap.Read(wxT("Use Preset")), settings);
303 }
304
305 return effect->LoadSettingsFromString(params, settings);
306 }
307 AudacityCommand *command = GetAudacityCommand(ID);
308
309 if (command)
310 {
311 // Set defaults (if not initialised) before setting values.
312 command->Init();
314
315 // Check first for what GetDefaultPreset() might have written
316 if (eap.HasEntry(wxT("Use Preset")))
317 {
318 return command
319 ->LoadSettingsFromString(eap.Read(wxT("Use Preset")));
320 }
321
322 return command->LoadSettingsFromString(params);
323 }
324 return false;
325}
326
328
332 const PluginID & ID, const EffectDialogFactory &factory, wxWindow &parent)
333{
334 bool result = false;
335 if (auto effect = GetEffect(ID)) {
336 std::shared_ptr<EffectInstance> pInstance;
339 if (const auto pSettings = GetDefaultSettings(ID))
340 result = effect->ShowHostInterface(
341 parent, factory,
342 pInstance,
343 *std::make_shared<SimpleEffectSettingsAccess>(*pSettings),
344 effect->IsBatchProcessing() ) != 0;
345 return result;
346 }
347
348 AudacityCommand *command = GetAudacityCommand(ID);
349
350 if (command)
351 {
352 result = command->PromptUser(&parent);
353 return result;
354 }
355
356 return result;
357}
358
360{
363}
364
366{
369}
370
372{
373 RegistryPaths presets;
375 UserPresetsGroup({}), presets);
376 std::sort( presets.begin(), presets.end() );
377 return presets;
378}
379
381{
382 auto effect = GetEffect(ID);
383
384 if (!effect)
385 {
386 return false;
387 }
388
389 return GetUserPresets(*effect).size() > 0 ||
390 effect->GetDefinition().GetFactoryPresets().size() > 0 ||
391 HasCurrentSettings(*effect) ||
392 HasFactoryDefaults(*effect);
393}
394
395#include <wx/choice.h>
396#include <wx/listbox.h>
397#include "../ShuttleGui.h"
398
399namespace {
400
402//
403// EffectPresetsDialog
404//
406
408{
409public:
410 EffectPresetsDialog(wxWindow *parent, EffectPlugin *effect);
411 virtual ~EffectPresetsDialog();
412
413 wxString GetSelected() const;
414 void SetSelected(const wxString & parms);
415
416private:
417 void SetPrefix(const TranslatableString & type, const wxString & prefix);
418 void UpdateUI();
419
420 void OnType(wxCommandEvent & evt);
421 void OnOk(wxCommandEvent & evt);
422 void OnCancel(wxCommandEvent & evt);
423
424private:
425 wxChoice *mType;
426 wxListBox *mPresets;
427
430 wxString mSelection;
431
432 DECLARE_EVENT_TABLE()
433};
434
435enum
436{
437 ID_Type = 10000
439
440BEGIN_EVENT_TABLE(EffectPresetsDialog, wxDialogWrapper)
441 EVT_CHOICE(ID_Type, EffectPresetsDialog::OnType)
442 EVT_LISTBOX_DCLICK(wxID_ANY, EffectPresetsDialog::OnOk)
443 EVT_BUTTON(wxID_OK, EffectPresetsDialog::OnOk)
444 EVT_BUTTON(wxID_CANCEL, EffectPresetsDialog::OnCancel)
446
448 wxWindow *parent, EffectPlugin *effect)
449: wxDialogWrapper(parent, wxID_ANY, XO("Select Preset"))
450{
451 ShuttleGui S(this, eIsCreating);
452 S.StartVerticalLay();
453 {
454 S.StartTwoColumn();
455 S.SetStretchyCol(1);
456 {
457 S.AddPrompt(XXO("Type:"));
458 mType = S.Id(ID_Type).AddChoice( {}, {}, 0 );
459
460 S.AddPrompt(XXO("&Preset:"));
461 mPresets = S
462 .Style( wxLB_SINGLE | wxLB_NEEDED_SB )
463 .AddListBox( {} );
464 }
465 S.EndTwoColumn();
466
467 S.AddStandardButtons();
468 }
469 S.EndVerticalLay();
470
471 mUserPresets = GetUserPresets(*effect);
472 mFactoryPresets = effect->GetDefinition().GetFactoryPresets();
473
474 if (mUserPresets.size() > 0)
475 {
476 mType->Append(_("User Presets"));
477 }
478
479 if (mFactoryPresets.size() > 0)
480 {
481 mType->Append(_("Factory Presets"));
482 }
483
484 if (HasCurrentSettings(*effect))
485 {
486 mType->Append(_("Current Settings"));
487 }
488
489 if (HasFactoryDefaults(*effect))
490 {
491 mType->Append(_("Factory Defaults"));
492 }
493
494 UpdateUI();
495}
496
497EffectPresetsDialog::~EffectPresetsDialog()
498{
499}
500
501wxString EffectPresetsDialog::GetSelected() const
502{
503 return mSelection;
504}
505
506void EffectPresetsDialog::SetSelected(const wxString & parms)
507{
508 wxString preset = parms;
510 {
511 preset.Replace(EffectPlugin::kUserPresetIdent, wxEmptyString, false);
512 SetPrefix(XO("User Presets"), preset);
513 }
514 else if (preset.StartsWith(EffectPlugin::kFactoryPresetIdent))
515 {
516 preset.Replace(EffectPlugin::kFactoryPresetIdent, wxEmptyString, false);
517 SetPrefix(XO("Factory Presets"), preset);
518 }
519 else if (preset.StartsWith(EffectPlugin::kCurrentSettingsIdent))
520 {
521 SetPrefix(XO("Current Settings"), wxEmptyString);
522 }
523 else if (preset.StartsWith(EffectPlugin::kFactoryDefaultsIdent))
524 {
525 SetPrefix(XO("Factory Defaults"), wxEmptyString);
526 }
527}
528
529void EffectPresetsDialog::SetPrefix(
530 const TranslatableString & type, const wxString & prefix)
531{
532 mType->SetStringSelection(type.Translation());
533
534 if (type == XO("User Presets"))
535 {
536 mPresets->Clear();
537 for (const auto &preset : mUserPresets)
538 mPresets->Append(preset);
539 mPresets->Enable(true);
540 mPresets->SetStringSelection(prefix);
541 if (mPresets->GetSelection() == wxNOT_FOUND)
542 {
543 mPresets->SetSelection(0);
544 }
546 + mPresets->GetStringSelection();
547 }
548 else if (type == XO("Factory Presets"))
549 {
550 mPresets->Clear();
551 for (size_t i = 0, cnt = mFactoryPresets.size(); i < cnt; i++)
552 {
553 auto label = mFactoryPresets[i];
554 if (label.empty())
555 {
556 label = _("None");
557 }
558 mPresets->Append(label);
559 }
560 mPresets->Enable(true);
561 mPresets->SetStringSelection(prefix);
562 if (mPresets->GetSelection() == wxNOT_FOUND)
563 {
564 mPresets->SetSelection(0);
565 }
567 + mPresets->GetStringSelection();
568 }
569 else if (type == XO("Current Settings"))
570 {
571 mPresets->Clear();
572 mPresets->Enable(false);
574 }
575 else if (type == XO("Factory Defaults"))
576 {
577 mPresets->Clear();
578 mPresets->Enable(false);
580 }
581}
582
583void EffectPresetsDialog::UpdateUI()
584{
585 int selected = mType->GetSelection();
586 if (selected == wxNOT_FOUND)
587 {
588 selected = 0;
589 mType->SetSelection(selected);
590 }
591 wxString type = mType->GetString(selected);
592
593 if (type == _("User Presets"))
594 {
595 selected = mPresets->GetSelection();
596 if (selected == wxNOT_FOUND)
597 {
598 selected = 0;
599 }
600
601 mPresets->Clear();
602 for (const auto &preset : mUserPresets)
603 mPresets->Append(preset);
604 mPresets->Enable(true);
605 mPresets->SetSelection(selected);
607 + mPresets->GetString(selected);
608 }
609 else if (type == _("Factory Presets"))
610 {
611 selected = mPresets->GetSelection();
612 if (selected == wxNOT_FOUND)
613 {
614 selected = 0;
615 }
616
617 mPresets->Clear();
618 for (size_t i = 0, cnt = mFactoryPresets.size(); i < cnt; i++)
619 {
620 auto label = mFactoryPresets[i];
621 if (label.empty())
622 {
623 label = _("None");
624 }
625 mPresets->Append(label);
626 }
627 mPresets->Enable(true);
628 mPresets->SetSelection(selected);
630 + mPresets->GetString(selected);
631 }
632 else if (type == _("Current Settings"))
633 {
634 mPresets->Clear();
635 mPresets->Enable(false);
637 }
638 else if (type == _("Factory Defaults"))
639 {
640 mPresets->Clear();
641 mPresets->Enable(false);
643 }
644}
645
646void EffectPresetsDialog::OnType(wxCommandEvent & WXUNUSED(evt))
647{
648 UpdateUI();
649}
650
651void EffectPresetsDialog::OnOk(wxCommandEvent & WXUNUSED(evt))
652{
653 UpdateUI();
654
655 EndModal(true);
656}
657
658void EffectPresetsDialog::OnCancel(wxCommandEvent & WXUNUSED(evt))
659{
660 mSelection = wxEmptyString;
661
662 EndModal(false);
663}
664
665}
666
667// This function is used only in the macro programming user interface
668wxString EffectManager::GetPreset(const PluginID & ID, const wxString & params, wxWindow * parent)
669{
670 auto effect = GetEffect(ID);
671
672 if (!effect)
673 {
674 return wxEmptyString;
675 }
676
678
679 wxString preset;
680 if (eap.HasEntry(wxT("Use Preset")))
681 {
682 preset = eap.Read(wxT("Use Preset"));
683 }
684
685 {
686 EffectPresetsDialog dlg(parent, effect);
687 dlg.Layout();
688 dlg.Fit();
689 dlg.SetSize(dlg.GetMinSize());
690 dlg.CenterOnParent();
691 dlg.SetSelected(preset);
692
693 if (dlg.ShowModal())
694 preset = dlg.GetSelected();
695 else
696 preset = wxEmptyString;
697 }
698
699 if (preset.empty())
700 {
701 return preset;
702 }
703
704 // This cleans a config "file" backed by a string in memory.
705 eap.DeleteAll();
706
707 eap.Write(wxT("Use Preset"), preset);
709
710 return preset;
711}
712
713// This function is used only in the macro programming user interface
715{
716 auto effect = GetEffect(ID);
717
718 if (!effect)
719 {
720 return wxEmptyString;
721 }
722
723 wxString preset;
724 if (HasCurrentSettings(*effect))
725 {
727 }
728 else if (HasFactoryDefaults(*effect))
729 {
731 }
732
733 if (!preset.empty())
734 {
736
737 eap.Write(wxT("Use Preset"), preset);
739 }
740
741 return preset;
742}
743
745{
746 if (auto effect = GetEffect(ID))
747 effect->SetBatchProcessing();
748 else if (auto command = GetAudacityCommand(ID))
749 command->SetBatchProcessing(true);
750}
751
753{
754 if (auto effect = GetEffect(ID))
755 effect->UnsetBatchProcessing();
756 else if (auto command = GetAudacityCommand(ID))
757 command->SetBatchProcessing(false);
758}
759
761{
762 return DoGetEffect(ID).effect;
763}
764
766{
767 return GetEffectAndDefaultSettings(ID).second;
768}
769
770std::pair<EffectPlugin *, EffectSettings *>
772{
773 auto &results = DoGetEffect(ID);
774 if (results.effect)
775 return {results.effect, &results.settings};
776 else
777 return {nullptr, nullptr};
778}
779
780namespace {
781// Before: settings are as defaulted by `manager.MakeSettings()`
782// Do as needed (once, persistently, when the plug-in is first used): store
783// those default values into the config under "FactoryDefaults" preset
784// After: settings are loaded for the "CurrentSettings" preset
787 // Config key remembering whether we already stored FactoryDefaults
788 constexpr auto InitializedKey = L"Initialized";
789 if (bool haveDefaults{};
791 InitializedKey, haveDefaults, false),
792 !haveDefaults
793 ) {
794 manager.SaveUserPreset(FactoryDefaultsGroup(), settings);
796 InitializedKey, true);
797 }
798 manager.LoadUserPreset(CurrentSettingsGroup(), settings);
799}
800
801std::pair<ComponentInterface *, EffectSettings>
803{
804 if (auto result = dynamic_cast<EffectSettingsManager*>(
805 PluginManager::Get().Load(ID))) {
806 auto settings = result->MakeSettings();
807 InitializePreset(*result, settings);
808 return { result, std::move(settings) };
809 }
810 return { nullptr, {} };
811}
812}
813
815{
816 static EffectAndDefaultSettings empty;
817
818 // Must have a "valid" ID
819 if (ID.empty())
820 return empty;
821
822 // If it is actually a command then refuse it (as an effect).
823 if( mCommands.find( ID ) != mCommands.end() )
824 return empty;
825
826 if (auto iter = mEffects.find(ID); iter != mEffects.end())
827 return iter->second;
828 else {
829 // This will instantiate the effect client if it hasn't already been done
830 auto [component, settings] = LoadComponent(ID);
831 if (!component)
832 return empty;
833
834 if (auto effect = dynamic_cast<EffectPlugin *>(component))
835 return (mEffects[ID] = { effect, std::move(settings) });
836 else if (auto client = dynamic_cast<EffectUIClientInterface *>(component)) {
837 // Nothing inherits EffectUIClientInterface now that does not also
838 // inherit EffectPlugin
839 wxASSERT(false);
840 return empty;
841 }
842 else {
843 if ( !dynamic_cast<AudacityCommand *>(component) )
845 XO(
846"Attempting to initialize the following effect failed:\n\n%s\n\nMore information may be available in 'Help > Diagnostics > Show Log'")
847 .Format( GetCommandName(ID) ),
848 XO("Effect failed to initialize"));
849
850 return empty;
851 }
852 }
853}
854
856{
857 // Must have a "valid" ID
858 if (ID.empty())
859 {
860 return NULL;
861 }
862
863 if (mCommands.find(ID) == mCommands.end()) {
864 // This will instantiate the command if it hasn't already been done
865 auto command =
866 dynamic_cast<AudacityCommand *>(PluginManager::Get().Load(ID));
867 if (command)
868 {
869 command->Init();
870 mCommands[ID] = command;
871 return command;
872 }
873
875 XO(
876"Attempting to initialize the following command failed:\n\n%s\n\nMore information may be available in 'Help > Diagnostics > Show Log'")
877 .Format( GetCommandName(ID) ),
878 XO("Command failed to initialize"));
879
880 return NULL;
881 }
882
883 return mCommands[ID];
884}
885
886
888{
889 static PluginID empty;
890 if (strTarget.empty()) // set GetCommandIdentifier to wxT("") to not show an effect in Batch mode
891 {
892 return empty;
893 }
894
896 // Effects OR Generic commands...
897 for (auto &plug
899 auto &ID = plug.GetID();
900 if (GetCommandIdentifier(ID) == strTarget)
901 return ID;
902 }
903 return empty;
904}
905
908{
909 return Get().GetEffect(ID);
910}
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
static RegisteredToolbarFactory factory
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< wxDialog *(wxWindow &parent, EffectPlugin &, EffectUIClientInterface &, std::shared_ptr< EffectInstance > &, EffectSettingsAccess &) > EffectDialogFactory
Type of function that creates a dialog for an effect.
Definition: EffectPlugin.h:39
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
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
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:52
static const wxString kUserPresetIdent
Definition: EffectPlugin.h:56
static const wxString kFactoryPresetIdent
Definition: EffectPlugin.h:57
virtual const EffectSettingsManager & GetDefinition() const =0
static const wxString kCurrentSettingsIdent
Definition: EffectPlugin.h:58
static const wxString kFactoryDefaultsIdent
Definition: EffectPlugin.h:59
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:41
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
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.