Audacity  3.0.3
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
EffectManager Class Reference

EffectManager is the class that handles effects and effect categories. More...

#include <EffectManager.h>

Collaboration diagram for EffectManager:
[legend]

Classes

struct  UnsetBatchProcessing
 

Public Types

enum  : unsigned {
  kNone = 0x00, kConfigured = 0x01, kSkipState = 0x02, kDontRepeatLast = 0x04,
  kRepeatGen = 0x08, kRepeatNyquistPrompt = 0x10
}
 

Public Member Functions

 EffectManager ()
 
virtual ~EffectManager ()
 
const PluginIDRegisterEffect (std::unique_ptr< Effect > uEffect)
 Here solely for the purpose of Nyquist Workbench until a better solution is devised. More...
 
void UnregisterEffect (const PluginID &ID)
 Used only by Nyquist Workbench module. More...
 
TranslatableString GetEffectFamilyName (const PluginID &ID)
 
TranslatableString GetVendorName (const PluginID &ID)
 
bool DoAudacityCommand (const PluginID &ID, const CommandContext &, wxWindow *parent, bool shouldPrompt=true)
 
ComponentInterfaceSymbol GetCommandSymbol (const PluginID &ID)
 
TranslatableString GetCommandName (const PluginID &ID)
 
CommandID GetCommandIdentifier (const PluginID &ID)
 
TranslatableString GetCommandDescription (const PluginID &ID)
 
ManualPageID GetCommandUrl (const PluginID &ID)
 
TranslatableString GetCommandTip (const PluginID &ID)
 
void GetCommandDefinition (const PluginID &ID, const CommandContext &context, int flags)
 
bool IsHidden (const PluginID &ID)
 
bool SupportsAutomation (const PluginID &ID)
 
wxString GetEffectParameters (const PluginID &ID)
 
bool SetEffectParameters (const PluginID &ID, const wxString &params)
 
bool PromptUser (const PluginID &ID, const EffectClientInterface::EffectDialogFactory &factory, wxWindow &parent)
 
bool HasPresets (const PluginID &ID)
 
wxString GetPreset (const PluginID &ID, const wxString &params, wxWindow *parent)
 
wxString GetDefaultPreset (const PluginID &ID)
 
BatchProcessingScope SetBatchProcessing (const PluginID &ID)
 
void SetSkipStateFlag (bool flag)
 
bool GetSkipStateFlag ()
 
const PluginIDGetEffectByIdentifier (const CommandID &strTarget)
 
EffectGetEffect (const PluginID &ID)
 

Static Public Member Functions

static EffectManagerGet ()
 

Private Types

using BatchProcessingScope = std::unique_ptr< EffectManager, UnsetBatchProcessing >
 

Private Member Functions

void SetBatchProcessing (const PluginID &ID, bool start)
 
AudacityCommandGetAudacityCommand (const PluginID &ID)
 

Private Attributes

EffectMap mEffects
 
AudacityCommandMap mCommands
 
EffectOwnerMap mHostEffects
 
int mNumEffects
 
bool mSkipStateFlag
 

Detailed Description

EffectManager is the class that handles effects and effect categories.

It maintains a graph of effect categories and subcategories, registers and unregisters effects and can return filtered lists of effects.

Definition at line 45 of file EffectManager.h.

Member Typedef Documentation

◆ BatchProcessingScope

Definition at line 123 of file EffectManager.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum : unsigned
Enumerator
kNone 
kConfigured 
kSkipState 
kDontRepeatLast 
kRepeatGen 
kRepeatNyquistPrompt 

Definition at line 49 of file EffectManager.h.

49  : unsigned {
50  // No flags specified
51  kNone = 0x00,
52  // Flag used to disable prompting for configuration parameteres.
53  kConfigured = 0x01,
54  // Flag used to disable saving the state after processing.
55  kSkipState = 0x02,
56  // Flag used to disable "Repeat Last Effect"
57  kDontRepeatLast = 0x04,
58  // Flag used to disable "Select All during Repeat Generator Effect"
59  kRepeatGen = 0x08,
60  // Flag used for repeating Nyquist Prompt
61  kRepeatNyquistPrompt = 0x10,
62  };

Constructor & Destructor Documentation

◆ EffectManager()

EffectManager::EffectManager ( )

Definition at line 48 of file EffectManager.cpp.

49 {
50  mSkipStateFlag = false;
51 }

References mSkipStateFlag.

◆ ~EffectManager()

EffectManager::~EffectManager ( )
virtual

Definition at line 53 of file EffectManager.cpp.

54 {
55 }

Member Function Documentation

◆ DoAudacityCommand()

bool EffectManager::DoAudacityCommand ( const PluginID ID,
const CommandContext context,
wxWindow *  parent,
bool  shouldPrompt = true 
)

Run a command given the plugin ID

Definition at line 77 of file EffectManager.cpp.

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 }

References AudacityCommand::DoAudacityCommand(), GetAudacityCommand(), and SetSkipStateFlag().

Referenced by MacroCommands::DoAudacityCommand().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Get()

EffectManager & EffectManager::Get ( )
static

Get the singleton instance of the EffectManager. Probably not safe for multi-thread use.

Definition at line 42 of file EffectManager.cpp.

43 {
44  static EffectManager em;
45  return em;
46 }

Referenced by anonymous_namespace{PluginMenus.cpp}::AddEffectMenuItems(), anonymous_namespace{PluginMenus.cpp}::AnalyzeMenu(), MacroCommands::ApplyCommand(), MacroCommands::ApplyEffectCommand(), HelpCommand::ApplyInner(), anonymous_namespace{PluginMenus.cpp}::CompareEffectsByPublisher(), anonymous_namespace{PluginMenus.cpp}::CompareEffectsByPublisherAndName(), anonymous_namespace{PluginMenus.cpp}::CompareEffectsByType(), anonymous_namespace{PluginMenus.cpp}::CompareEffectsByTypeAndName(), MacroCommands::DoAudacityCommand(), EffectUI::DoEffect(), anonymous_namespace{PluginMenus.cpp}::EffectMenu(), anonymous_namespace{PluginMenus.cpp}::GenerateMenu(), MacroCommands::GetCurrentParamsFor(), MacroCommands::HandleTextualCommand(), MacroCommandsCatalog::MacroCommandsCatalog(), PluginActions::Handler::OnApplyMacroDirectlyByName(), PluginActions::Handler::OnAudacityCommand(), EffectNoiseReduction::Dialog::OnGetProfile(), NyqBench::OnGo(), MacroCommandDialog::OnItemSelected(), TrackActions::Handler::OnStereoToMono(), anonymous_namespace{PluginMenus.cpp}::PopulateEffectsMenu(), NyquistEffect::Process(), MacroCommands::PromptForParamsFor(), MacroCommands::PromptForPresetFor(), GetInfoCommand::SendCommands(), MacroCommandDialog::SetCommandAndParams(), anonymous_namespace{PluginMenus.cpp}::ToolsMenu(), and anonymous_namespace{TrackMenus.cpp}::TracksMenu().

Here is the caller graph for this function:

◆ GetAudacityCommand()

AudacityCommand * EffectManager::GetAudacityCommand ( const PluginID ID)
private

Definition at line 762 of file EffectManager.cpp.

763 {
764  // Must have a "valid" ID
765  if (ID.empty())
766  {
767  return NULL;
768  }
769 
770  // TODO: This is temporary and should be redone when all effects are converted
771  if (mCommands.find(ID) == mCommands.end())
772  {
773 
774  // This will instantiate the effect client if it hasn't already been done
775  auto command = dynamic_cast<AudacityCommand *>(PluginManager::Get().GetInstance(ID));
776  if (command )//&& command->Startup(NULL))
777  {
778  command->Init();
779  mCommands[ID] = command;
780  return command;
781  }
782 
783  /*
784  if (ident && ident->IsLegacy())
785  {
786  auto command = dynamic_cast<AudacityCommand *>(ident);
787  if (commandt && command->Startup(NULL))
788  {
789  mCommands[ID] = command;
790  return command;
791  }
792  }
793 
794 
795  auto command = std::make_shared<AudacityCommand>(); // TODO: use make_unique and store in std::unordered_map
796  if (command)
797  {
798  AudacityCommand *client = dynamic_cast<AudacityCommand *>(ident);
799  if (client && command->Startup(client))
800  {
801  auto pCommand = command.get();
802  mEffects[ID] = pCommand;
803  mHostEffects[ID] = std::move(effect);
804  return pEffect;
805  }
806  }
807 */
809  XO(
810 "Attempting to initialize the following command failed:\n\n%s\n\nMore information may be available in 'Help > Diagnostics > Show Log'")
811  .Format( GetCommandName(ID) ),
812  XO("Command failed to initialize"));
813 
814  return NULL;
815  }
816 
817  return mCommands[ID];
818 }

References AudacityMessageBox(), PluginManager::Get(), GetCommandName(), PluginManager::GetInstance(), AudacityCommand::Init(), mCommands, and XO.

Referenced by DoAudacityCommand(), GetCommandDefinition(), GetCommandDescription(), GetCommandTip(), GetCommandUrl(), GetEffectParameters(), PromptUser(), SetBatchProcessing(), and SetEffectParameters().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetCommandDefinition()

void EffectManager::GetCommandDefinition ( const PluginID ID,
const CommandContext context,
int  flags 
)

Definition at line 163 of file EffectManager.cpp.

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 }

References CommandMessageTargetDecorator::AddItem(), ComponentInterface::DefineParams(), CommandMessageTargetDecorator::EndArray(), CommandMessageTargetDecorator::EndField(), CommandMessageTargetDecorator::EndStruct(), GetAudacityCommand(), GetCommandIdentifier(), GetCommandName(), GetCommandTip(), GetCommandUrl(), GetEffect(), CommandContext::pOutput, CommandMessageTargetDecorator::StartArray(), CommandMessageTargetDecorator::StartField(), and CommandMessageTargetDecorator::StartStruct().

Referenced by HelpCommand::ApplyInner(), and GetInfoCommand::SendCommands().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetCommandDescription()

TranslatableString EffectManager::GetCommandDescription ( const PluginID ID)

Definition at line 128 of file EffectManager.cpp.

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 }

References GetAudacityCommand(), GetCommandName(), GetEffect(), and XO.

Referenced by EffectUI::DoEffect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetCommandIdentifier()

CommandID EffectManager::GetCommandIdentifier ( const PluginID ID)

Definition at line 122 of file EffectManager.cpp.

123 {
124  wxString name = PluginManager::Get().GetSymbol(ID).Internal();
126 }

References PluginManager::Get(), Effect::GetSquashedName(), PluginManager::GetSymbol(), ComponentInterfaceSymbol::Internal(), and name.

Referenced by GetCommandDefinition(), GetEffectByIdentifier(), MacroCommands::HandleTextualCommand(), MacroCommandsCatalog::MacroCommandsCatalog(), and GetInfoCommand::SendCommands().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetCommandName()

TranslatableString EffectManager::GetCommandName ( const PluginID ID)

Definition at line 101 of file EffectManager.cpp.

102 {
103  return GetCommandSymbol(ID).Msgid();
104 }

References GetCommandSymbol(), and ComponentInterfaceSymbol::Msgid().

Referenced by EffectUI::DoEffect(), GetAudacityCommand(), GetCommandDefinition(), GetCommandDescription(), GetEffect(), and PluginActions::Handler::OnApplyMacroDirectlyByName().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetCommandSymbol()

ComponentInterfaceSymbol EffectManager::GetCommandSymbol ( const PluginID ID)

Definition at line 96 of file EffectManager.cpp.

97 {
98  return PluginManager::Get().GetSymbol(ID);
99 }

References PluginManager::Get(), and PluginManager::GetSymbol().

Referenced by GetCommandName().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetCommandTip()

TranslatableString EffectManager::GetCommandTip ( const PluginID ID)

Definition at line 150 of file EffectManager.cpp.

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 }

References GetAudacityCommand(), AudacityCommand::GetDescription(), Effect::GetDescription(), and GetEffect().

Referenced by GetCommandDefinition().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetCommandUrl()

ManualPageID EffectManager::GetCommandUrl ( const PluginID ID)

Definition at line 138 of file EffectManager.cpp.

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 }

References GetAudacityCommand(), GetEffect(), AudacityCommand::ManualPage(), and Effect::ManualPage().

Referenced by GetCommandDefinition().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetDefaultPreset()

wxString EffectManager::GetDefaultPreset ( const PluginID ID)

Definition at line 660 of file EffectManager.cpp.

661 {
662  Effect *effect = GetEffect(ID);
663 
664  if (!effect)
665  {
666  return wxEmptyString;
667  }
668 
669  wxString preset;
670  if (effect->HasCurrentSettings())
671  {
673  }
674  else if (effect->HasFactoryDefaults())
675  {
677  }
678 
679  if (!preset.empty())
680  {
681  CommandParameters eap;
682 
683  eap.Write(wxT("Use Preset"), preset);
684  eap.GetParameters(preset);
685  }
686 
687  return preset;
688 }

References GetEffect(), CommandParameters::GetParameters(), Effect::HasCurrentSettings(), Effect::HasFactoryDefaults(), Effect::kCurrentSettingsIdent, and Effect::kFactoryDefaultsIdent.

Referenced by GetEffectParameters(), and MacroCommandDialog::OnItemSelected().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetEffect()

Effect * EffectManager::GetEffect ( const PluginID ID)

Return an effect by its ID.

Definition at line 708 of file EffectManager.cpp.

709 {
710  // Must have a "valid" ID
711  if (ID.empty())
712  {
713  return NULL;
714  }
715 
716  // If it is actually a command then refuse it (as an effect).
717  if( mCommands.find( ID ) != mCommands.end() )
718  return NULL;
719 
720  // TODO: This is temporary and should be redone when all effects are converted
721  if (mEffects.find(ID) == mEffects.end())
722  {
723  // This will instantiate the effect client if it hasn't already been done
725  if (ident && ident->IsLegacy())
726  {
727  auto effect = dynamic_cast<Effect *>(ident);
728  if (effect && effect->Startup(NULL))
729  {
730  mEffects[ID] = effect;
731  return effect;
732  }
733  }
734 
735  auto effect = std::make_shared<Effect>(); // TODO: use make_unique and store in std::unordered_map
736  if (effect)
737  {
738  EffectClientInterface *client = dynamic_cast<EffectClientInterface *>(ident);
739  if (client && effect->Startup(client))
740  {
741  auto pEffect = effect.get();
742  mEffects[ID] = pEffect;
743  mHostEffects[ID] = std::move(effect);
744  return pEffect;
745  }
746  }
747 
748  auto command = dynamic_cast<AudacityCommand *>(PluginManager::Get().GetInstance(ID));
749  if( !command )
751  XO(
752 "Attempting to initialize the following effect failed:\n\n%s\n\nMore information may be available in 'Help > Diagnostics > Show Log'")
753  .Format( GetCommandName(ID) ),
754  XO("Effect failed to initialize"));
755 
756  return NULL;
757  }
758 
759  return mEffects[ID];
760 }

References AudacityMessageBox(), PluginManager::Get(), GetCommandName(), PluginManager::GetInstance(), ident(), mCommands, mEffects, mHostEffects, and XO.

Referenced by EffectUI::DoEffect(), GetCommandDefinition(), GetCommandDescription(), GetCommandTip(), GetCommandUrl(), GetDefaultPreset(), GetEffectFamilyName(), GetEffectParameters(), GetPreset(), GetVendorName(), HasPresets(), IsHidden(), PromptUser(), SetBatchProcessing(), and SetEffectParameters().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetEffectByIdentifier()

const PluginID & EffectManager::GetEffectByIdentifier ( const CommandID strTarget)

Definition at line 821 of file EffectManager.cpp.

822 {
823  static PluginID empty;
824  if (strTarget.empty()) // set GetCommandIdentifier to wxT("") to not show an effect in Batch mode
825  {
826  return empty;
827  }
828 
830  // Effects OR Generic commands...
831  for (auto &plug
833  auto &ID = plug.GetID();
834  if (GetCommandIdentifier(ID) == strTarget)
835  return ID;
836  }
837  return empty;
838 }

References Identifier::empty(), PluginManager::Get(), GetCommandIdentifier(), PluginManager::PluginsOfType(), PluginTypeAudacityCommand, and PluginTypeEffect.

Referenced by MacroCommands::ApplyCommand(), HelpCommand::ApplyInner(), MacroCommands::GetCurrentParamsFor(), MacroCommandDialog::OnItemSelected(), MacroCommands::PromptForParamsFor(), MacroCommands::PromptForPresetFor(), MacroCommandDialog::SetCommandAndParams(), and anonymous_namespace{TrackMenus.cpp}::TracksMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetEffectFamilyName()

TranslatableString EffectManager::GetEffectFamilyName ( const PluginID ID)

Definition at line 106 of file EffectManager.cpp.

107 {
108  auto effect = GetEffect(ID);
109  if (effect)
110  return effect->GetFamily().Msgid();
111  return {};
112 }

References GetEffect().

Referenced by anonymous_namespace{PluginMenus.cpp}::AddEffectMenuItems().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetEffectParameters()

wxString EffectManager::GetEffectParameters ( const PluginID ID)

Definition at line 235 of file EffectManager.cpp.

236 {
237  Effect *effect = GetEffect(ID);
238 
239  if (effect)
240  {
241  wxString parms;
242 
243  effect->GetAutomationParameters(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->GetAutomationParameters(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 }

References GetAudacityCommand(), Effect::GetAutomationParameters(), AudacityCommand::GetAutomationParameters(), GetDefaultPreset(), and GetEffect().

Referenced by MacroCommands::GetCurrentParamsFor(), and MacroCommands::PromptForParamsFor().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPreset()

wxString EffectManager::GetPreset ( const PluginID ID,
const wxString &  params,
wxWindow *  parent 
)

Definition at line 615 of file EffectManager.cpp.

616 {
617  Effect *effect = GetEffect(ID);
618 
619  if (!effect)
620  {
621  return wxEmptyString;
622  }
623 
625 
626  wxString preset;
627  if (eap.HasEntry(wxT("Use Preset")))
628  {
629  preset = eap.Read(wxT("Use Preset"));
630  }
631 
632  {
633  EffectPresetsDialog dlg(parent, effect);
634  dlg.Layout();
635  dlg.Fit();
636  dlg.SetSize(dlg.GetMinSize());
637  dlg.CenterOnParent();
638  dlg.SetSelected(preset);
639 
640  if (dlg.ShowModal())
641  preset = dlg.GetSelected();
642  else
643  preset = wxEmptyString;
644  }
645 
646  if (preset.empty())
647  {
648  return preset;
649  }
650 
651  // This cleans a config "file" backed by a string in memory.
652  eap.DeleteAll();
653 
654  eap.Write(wxT("Use Preset"), preset);
655  eap.GetParameters(preset);
656 
657  return preset;
658 }

References GetEffect(), CommandParameters::GetParameters(), CommandParameters::HasEntry(), and params.

Referenced by MacroCommands::PromptForPresetFor().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSkipStateFlag()

bool EffectManager::GetSkipStateFlag ( )

Definition at line 219 of file EffectManager.cpp.

220 {
221  return mSkipStateFlag;
222 }

References mSkipStateFlag.

Referenced by EffectUI::DoEffect().

Here is the caller graph for this function:

◆ GetVendorName()

TranslatableString EffectManager::GetVendorName ( const PluginID ID)

Definition at line 114 of file EffectManager.cpp.

115 {
116  auto effect = GetEffect(ID);
117  if (effect)
118  return effect->GetVendor().Msgid();
119  return {};
120 }

References GetEffect().

Referenced by anonymous_namespace{PluginMenus.cpp}::AddEffectMenuItems().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HasPresets()

bool EffectManager::HasPresets ( const PluginID ID)

Definition at line 333 of file EffectManager.cpp.

334 {
335  Effect *effect = GetEffect(ID);
336 
337  if (!effect)
338  {
339  return false;
340  }
341 
342  return effect->GetUserPresets().size() > 0 ||
343  effect->GetFactoryPresets().size() > 0 ||
344  effect->HasCurrentSettings() ||
345  effect->HasFactoryDefaults();
346 }

References GetEffect(), Effect::GetFactoryPresets(), Effect::GetUserPresets(), Effect::HasCurrentSettings(), and Effect::HasFactoryDefaults().

Referenced by MacroCommandDialog::OnItemSelected(), and MacroCommandDialog::SetCommandAndParams().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsHidden()

bool EffectManager::IsHidden ( const PluginID ID)

Definition at line 202 of file EffectManager.cpp.

203 {
204  Effect *effect = GetEffect(ID);
205 
206  if (effect)
207  {
208  return effect->IsHidden();
209  }
210 
211  return false;
212 }

References GetEffect(), and Effect::IsHidden().

Referenced by anonymous_namespace{PluginMenus.cpp}::PopulateEffectsMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PromptUser()

bool EffectManager::PromptUser ( const PluginID ID,
const EffectClientInterface::EffectDialogFactory factory,
wxWindow &  parent 
)

Definition at line 308 of file EffectManager.cpp.

311 {
312  bool result = false;
313  Effect *effect = GetEffect(ID);
314 
315  if (effect)
316  {
317  result = effect->ShowInterface(
318  parent, factory, effect->IsBatchProcessing() );
319  return result;
320  }
321 
322  AudacityCommand *command = GetAudacityCommand(ID);
323 
324  if (command)
325  {
326  result = command->PromptUser(&parent);
327  return result;
328  }
329 
330  return result;
331 }

References factory, GetAudacityCommand(), GetEffect(), Effect::IsBatchProcessing(), AudacityCommand::PromptUser(), and Effect::ShowInterface().

Here is the call graph for this function:

◆ RegisterEffect()

const PluginID & EffectManager::RegisterEffect ( std::unique_ptr< Effect uEffect)

Here solely for the purpose of Nyquist Workbench until a better solution is devised.

Register an effect so it can be executed.

Definition at line 59 of file EffectManager.cpp.

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 }

References PluginManager::Get(), mEffects, PluginTypeEffect, and PluginManager::RegisterPlugin().

Referenced by NyqBench::OnGo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetBatchProcessing() [1/2]

BatchProcessingScope EffectManager::SetBatchProcessing ( const PluginID ID)
inline

Definition at line 127 of file EffectManager.h.

128  {
129  SetBatchProcessing(ID, true); return BatchProcessingScope{ this, {ID} };
130  }

◆ SetBatchProcessing() [2/2]

void EffectManager::SetBatchProcessing ( const PluginID ID,
bool  start 
)
private

Definition at line 690 of file EffectManager.cpp.

691 {
692  Effect *effect = GetEffect(ID);
693  if (effect)
694  {
695  effect->SetBatchProcessing(start);
696  return;
697  }
698 
699  AudacityCommand *command = GetAudacityCommand(ID);
700  if (command)
701  {
702  command->SetBatchProcessing(start);
703  return;
704  }
705 
706 }

References GetAudacityCommand(), GetEffect(), AudacityCommand::SetBatchProcessing(), and Effect::SetBatchProcessing().

Referenced by MacroCommands::ApplyEffectCommand(), EffectManager::UnsetBatchProcessing::operator()(), and MacroCommands::PromptForParamsFor().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetEffectParameters()

bool EffectManager::SetEffectParameters ( const PluginID ID,
const wxString &  params 
)

Definition at line 275 of file EffectManager.cpp.

276 {
277  Effect *effect = GetEffect(ID);
278 
279  if (effect)
280  {
282 
283  if (eap.HasEntry(wxT("Use Preset")))
284  {
285  return effect->SetAutomationParameters(eap.Read(wxT("Use Preset")));
286  }
287 
288  return effect->SetAutomationParameters(params);
289  }
290  AudacityCommand *command = GetAudacityCommand(ID);
291 
292  if (command)
293  {
294  // Set defaults (if not initialised) before setting values.
295  command->Init();
297 
298  if (eap.HasEntry(wxT("Use Preset")))
299  {
300  return command->SetAutomationParameters(eap.Read(wxT("Use Preset")));
301  }
302 
303  return command->SetAutomationParameters(params);
304  }
305  return false;
306 }

References GetAudacityCommand(), GetEffect(), CommandParameters::HasEntry(), AudacityCommand::Init(), params, Effect::SetAutomationParameters(), and AudacityCommand::SetAutomationParameters().

Here is the call graph for this function:

◆ SetSkipStateFlag()

void EffectManager::SetSkipStateFlag ( bool  flag)

Allow effects to disable saving the state at run time

Definition at line 214 of file EffectManager.cpp.

215 {
217 }

References flag, and mSkipStateFlag.

Referenced by DoAudacityCommand(), EffectUI::DoEffect(), EffectNoiseReduction::Dialog::OnGetProfile(), and NyquistEffect::Process().

Here is the caller graph for this function:

◆ SupportsAutomation()

bool EffectManager::SupportsAutomation ( const PluginID ID)

Support for batch commands

Definition at line 224 of file EffectManager.cpp.

225 {
226  const PluginDescriptor *plug = PluginManager::Get().GetPlugin(ID);
227  if (plug)
228  {
229  return plug->IsEffectAutomatable();
230  }
231 
232  return false;
233 }

References PluginManager::Get(), PluginManager::GetPlugin(), and PluginDescriptor::IsEffectAutomatable().

Here is the call graph for this function:

◆ UnregisterEffect()

void EffectManager::UnregisterEffect ( const PluginID ID)

Used only by Nyquist Workbench module.

Definition at line 70 of file EffectManager.cpp.

71 {
72  PluginID id = ID;
74  mEffects.erase(id);
75 }

References PluginManager::Get(), mEffects, and PluginManager::UnregisterPlugin().

Referenced by NyqBench::OnGo().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mCommands

AudacityCommandMap EffectManager::mCommands
private

Definition at line 145 of file EffectManager.h.

Referenced by GetAudacityCommand(), and GetEffect().

◆ mEffects

EffectMap EffectManager::mEffects
private

Definition at line 144 of file EffectManager.h.

Referenced by GetEffect(), RegisterEffect(), and UnregisterEffect().

◆ mHostEffects

EffectOwnerMap EffectManager::mHostEffects
private

Definition at line 146 of file EffectManager.h.

Referenced by GetEffect().

◆ mNumEffects

int EffectManager::mNumEffects
private

Definition at line 148 of file EffectManager.h.

◆ mSkipStateFlag

bool EffectManager::mSkipStateFlag
private

Definition at line 152 of file EffectManager.h.

Referenced by EffectManager(), GetSkipStateFlag(), and SetSkipStateFlag().


The documentation for this class was generated from the following files:
Effect::GetAutomationParameters
bool GetAutomationParameters(CommandParameters &parms) override
Definition: Effect.cpp:534
PluginManager::GetInstance
ComponentInterface * GetInstance(const PluginID &ID)
Definition: PluginManager.cpp:1532
Effect::GetSquashedName
static CommandID GetSquashedName(wxString name)
Definition: Effect.cpp:776
CommandParameters
CommandParameters, derived from wxFileConfig, is essentially doing the same things as the Shuttle cla...
Definition: EffectAutomationParameters.h:67
PluginTypeEffect
@ PluginTypeEffect
Definition: PluginManager.h:35
AudacityCommand::DoAudacityCommand
bool DoAudacityCommand(wxWindow *parent, const CommandContext &context, bool shouldPrompt=true)
Definition: AudacityCommand.cpp:182
AudacityCommand::PromptUser
virtual bool PromptUser(wxWindow *parent)
Definition: AudacityCommand.cpp:222
EffectManager::mHostEffects
EffectOwnerMap mHostEffects
Definition: EffectManager.h:146
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:145
Effect::ManualPage
virtual ManualPageID ManualPage()
Definition: Effect.cpp:1172
Effect::HasFactoryDefaults
virtual bool HasFactoryDefaults()
Definition: Effect.cpp:1167
flag
static std::once_flag flag
Definition: WaveformView.cpp:1124
EffectManager::kRepeatGen
@ kRepeatGen
Definition: EffectManager.h:59
Effect::GetUserPresets
virtual RegistryPaths GetUserPresets()
Definition: Effect.cpp:1151
AudacityCommand::GetDescription
virtual TranslatableString GetDescription() override
Definition: AudacityCommand.h:64
EffectManager::mSkipStateFlag
bool mSkipStateFlag
Definition: EffectManager.h:152
EffectManager::SetBatchProcessing
void SetBatchProcessing(const PluginID &ID, bool start)
Definition: EffectManager.cpp:690
ident
static CommandHandlerObject & ident(AudacityProject &project)
Definition: ModNullCallback.cpp:65
Effect
Base class for many of the effects in Audacity.
Definition: Effect.h:72
PluginManager::GetSymbol
const ComponentInterfaceSymbol & GetSymbol(const PluginID &ID)
Definition: PluginManager.cpp:1522
Format
Abstract base class used in importing a file.
EffectManager::kConfigured
@ kConfigured
Definition: EffectManager.h:53
EffectManager::kDontRepeatLast
@ kDontRepeatLast
Definition: EffectManager.h:57
EffectManager::GetCommandName
TranslatableString GetCommandName(const PluginID &ID)
Definition: EffectManager.cpp:101
PluginManager::RegisterPlugin
const PluginID & RegisterPlugin(ModuleInterface *module) override
Definition: PluginManager.cpp:397
AudacityCommand::ManualPage
virtual ManualPageID ManualPage()
Definition: AudacityCommand.h:68
XO
#define XO(s)
Definition: Internat.h:31
Effect::SetAutomationParameters
bool SetAutomationParameters(CommandParameters &parms) override
Definition: Effect.cpp:544
Effect::IsHidden
virtual bool IsHidden()
Definition: Effect.cpp:2290
ShuttleParams
Shuttle that deals with parameters. This is a base class with lots of virtual functions that do nothi...
Definition: Shuttle.h:62
CommandParameters::GetParameters
bool GetParameters(wxString &parms)
Definition: EffectAutomationParameters.h:258
EffectManager::GetCommandSymbol
ComponentInterfaceSymbol GetCommandSymbol(const PluginID &ID)
Definition: EffectManager.cpp:96
Effect::IsBatchProcessing
virtual bool IsBatchProcessing()
Definition: Effect.cpp:1190
PluginDescriptor::IsEffectAutomatable
bool IsEffectAutomatable() const
Definition: PluginManager.cpp:217
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:144
EffectManager::SetSkipStateFlag
void SetSkipStateFlag(bool flag)
Definition: EffectManager.cpp:214
EffectManager::GetCommandIdentifier
CommandID GetCommandIdentifier(const PluginID &ID)
Definition: EffectManager.cpp:122
EffectManager
EffectManager is the class that handles effects and effect categories.
Definition: EffectManager.h:46
EffectManager::BatchProcessingScope
std::unique_ptr< EffectManager, UnsetBatchProcessing > BatchProcessingScope
Definition: EffectManager.h:124
factory
static RegisteredToolbarFactory factory
Definition: ControlToolBar.cpp:806
EffectManager::GetCommandTip
TranslatableString GetCommandTip(const PluginID &ID)
Definition: EffectManager.cpp:150
EffectManager::GetEffect
Effect * GetEffect(const PluginID &ID)
Definition: EffectManager.cpp:708
Effect::GetFactoryPresets
RegistryPaths GetFactoryPresets() override
Definition: Effect.cpp:586
PluginID
wxString PluginID
Definition: EffectManager.h:30
AudacityCommand::GetAutomationParameters
virtual bool GetAutomationParameters(wxString &parms)
Definition: AudacityCommand.cpp:139
AudacityCommand
Base class for command in Audacity.
Definition: AudacityCommand.h:41
Effect::kCurrentSettingsIdent
static const wxString kCurrentSettingsIdent
Definition: Effect.h:539
name
const TranslatableString name
Definition: Distortion.cpp:98
AudacityCommand::SetBatchProcessing
virtual void SetBatchProcessing(bool start)
Definition: AudacityCommand.h:70
PluginManager::GetPlugin
const PluginDescriptor * GetPlugin(const PluginID &ID) const
Definition: PluginManager.cpp:1445
PluginTypeAudacityCommand
@ PluginTypeAudacityCommand
Definition: PluginManager.h:36
PluginDescriptor
Definition: PluginManager.h:44
PluginManager::UnregisterPlugin
void UnregisterPlugin(const PluginID &ID)
Definition: PluginManager.cpp:1434
EffectManager::kRepeatNyquistPrompt
@ kRepeatNyquistPrompt
Definition: EffectManager.h:61
EffectManager::GetDefaultPreset
wxString GetDefaultPreset(const PluginID &ID)
Definition: EffectManager.cpp:660
EffectClientInterface
EffectClientInterface provides the ident interface to Effect, and is what makes Effect into a plug-in...
Definition: EffectInterface.h:185
AudacityCommand::Init
virtual bool Init()
Definition: AudacityCommand.cpp:89
PluginManager::Get
static PluginManager & Get()
Definition: PluginManager.cpp:695
EffectDefinitionInterface
EffectDefinitionInterface is a ComponentInterface that additionally tracks flag-functions for interac...
Definition: EffectInterface.h:76
AudacityCommand::SetAutomationParameters
virtual bool SetAutomationParameters(const wxString &parms)
Definition: AudacityCommand.cpp:157
PluginManager
PluginManager maintains a list of all plug ins. That covers modules, effects, generators,...
Definition: PluginManager.h:174
Effect::GetDescription
TranslatableString GetDescription() override
Definition: Effect.cpp:183
Effect::HasCurrentSettings
virtual bool HasCurrentSettings()
Definition: Effect.cpp:1162
PluginManager::PluginsOfType
Range PluginsOfType(int type)
Definition: PluginManager.h:281
ComponentInterfaceSymbol::Internal
const wxString & Internal() const
Definition: ComponentInterfaceSymbol.h:55
EffectManager::kSkipState
@ kSkipState
Definition: EffectManager.h:55
ComponentInterface
ComponentInterface provides name / vendor / version functions to identify plugins....
Definition: ComponentInterface.h:62
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
Effect::kFactoryDefaultsIdent
static const wxString kFactoryDefaultsIdent
Definition: Effect.h:540
EffectManager::GetAudacityCommand
AudacityCommand * GetAudacityCommand(const PluginID &ID)
Definition: EffectManager.cpp:762
Effect::ShowInterface
bool ShowInterface(wxWindow &parent, const EffectDialogFactory &factory, bool forceModal=false) override
Definition: Effect.cpp:481
ComponentInterface::DefineParams
virtual bool DefineParams(ShuttleParams &WXUNUSED(S))
Definition: ComponentInterface.h:85
EffectManager::kNone
@ kNone
Definition: EffectManager.h:51
Identifier::empty
bool empty() const
Definition: Identifier.h:61
Effect::SetBatchProcessing
virtual void SetBatchProcessing(bool start)
Definition: Effect.cpp:1195
CommandContext::pOutput
std::unique_ptr< CommandOutputTargets > pOutput
Definition: CommandContext.h:65