![]() |
Audacity 3.2.0
|
EffectManager is the class that handles effects and effect categories. More...
#include <EffectManager.h>
Classes | |
struct | UnsetBatchProcessing |
A custom deleter for std::unique_ptr. More... | |
Public Types | |
enum | : unsigned { kNone = 0x00 , kConfigured = 0x01 , kSkipState = 0x02 , kDontRepeatLast = 0x04 , kRepeatGen = 0x08 , kRepeatNyquistPrompt = 0x10 } |
Public Member Functions | |
EffectManager () | |
virtual | ~EffectManager () |
const PluginID & | RegisterEffect (std::unique_ptr< EffectPlugin > 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 ¶ms) |
bool | PromptUser (const PluginID &ID, const EffectDialogFactory &factory, wxWindow &parent) |
Shows an effect or command dialog so the user can specify settings for later. More... | |
bool | HasPresets (const PluginID &ID) |
wxString | GetPreset (const PluginID &ID, const wxString ¶ms, wxWindow *parent) |
wxString | GetDefaultPreset (const PluginID &ID) |
BatchProcessingScope | SetBatchProcessing (const PluginID &ID) |
Begin a scope that ends when the returned object is destroyed. More... | |
void | SetSkipStateFlag (bool flag) |
bool | GetSkipStateFlag () |
const PluginID & | GetEffectByIdentifier (const CommandID &strTarget) |
EffectPlugin * | GetEffect (const PluginID &ID) |
EffectSettings * | GetDefaultSettings (const PluginID &ID) |
std::pair< EffectPlugin *, EffectSettings * > | GetEffectAndDefaultSettings (const PluginID &ID) |
Static Public Member Functions | |
static const EffectInstanceFactory * | GetInstanceFactory (const PluginID &ID) |
static EffectManager & | Get () |
Private Types | |
using | BatchProcessingScope = std::unique_ptr< EffectManager, UnsetBatchProcessing > |
Private Member Functions | |
void | BatchProcessingOn (const PluginID &ID) |
void | BatchProcessingOff (const PluginID &ID) |
EffectAndDefaultSettings & | DoGetEffect (const PluginID &ID) |
AudacityCommand * | GetAudacityCommand (const PluginID &ID) |
Private Attributes | |
EffectMap | mEffects |
AudacityCommandMap | mCommands |
EffectOwnerMap | mHostEffects |
int | mNumEffects |
bool | mSkipStateFlag |
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 47 of file EffectManager.h.
|
private |
Definition at line 131 of file EffectManager.h.
anonymous enum : unsigned |
Enumerator | |
---|---|
kNone | |
kConfigured | |
kSkipState | |
kDontRepeatLast | |
kRepeatGen | |
kRepeatNyquistPrompt |
Definition at line 51 of file EffectManager.h.
EffectManager::EffectManager | ( | ) |
|
virtual |
Definition at line 53 of file EffectManager.cpp.
|
private |
Definition at line 765 of file EffectManager.cpp.
References GetAudacityCommand(), and GetEffect().
Referenced by EffectManager::UnsetBatchProcessing::operator()().
|
private |
Definition at line 757 of file EffectManager.cpp.
References GetAudacityCommand(), and GetEffect().
bool EffectManager::DoAudacityCommand | ( | const PluginID & | ID, |
const CommandContext & | context, | ||
wxWindow * | parent, | ||
bool | shouldPrompt = true |
||
) |
Run a command given the plugin ID
Definition at line 78 of file EffectManager.cpp.
References AudacityCommand::DoAudacityCommand(), GetAudacityCommand(), and SetSkipStateFlag().
Referenced by CommandDispatch::DoAudacityCommand().
|
private |
Definition at line 836 of file EffectManager.cpp.
References AudacityMessageBox(), GetCommandName(), anonymous_namespace{EffectManager.cpp}::LoadComponent(), mCommands, mEffects, settings(), and XO().
Referenced by GetEffect(), and GetEffectAndDefaultSettings().
|
static |
Get the singleton instance of the EffectManager. Probably not safe for multi-thread use.
Definition at line 42 of file EffectManager.cpp.
Referenced by anonymous_namespace{MenuHelper.cpp}::AddGroupedEffectMenuItems(), anonymous_namespace{MenuHelper.cpp}::AddSortedEffectMenuItems(), anonymous_namespace{PluginMenus.cpp}::AnalyzeMenu(), MacroCommands::ApplyCommand(), MacroCommands::ApplyEffectCommand(), HelpCommand::ApplyInner(), anonymous_namespace{MenuHelper.cpp}::ComapareEffectsByTypeAndPublisher(), anonymous_namespace{MenuHelper.cpp}::CompareEffectsByPublisher(), anonymous_namespace{MenuHelper.cpp}::CompareEffectsByPublisherAndName(), anonymous_namespace{MenuHelper.cpp}::CompareEffectsByType(), anonymous_namespace{MenuHelper.cpp}::CompareEffectsByTypeAndName(), CommandDispatch::DoAudacityCommand(), EffectUI::DoEffect(), anonymous_namespace{PluginMenus.cpp}::EffectMenu(), anonymous_namespace{PluginMenus.cpp}::GenerateMenu(), MacroCommands::GetCurrentParamsFor(), GetInstanceFactory(), CommandDispatch::HandleTextualCommand(), anonymous_namespace{MenuHelper.cpp}::IsEnabledPlugin(), MacroCommandsCatalog::MacroCommandsCatalog(), anonymous_namespace{BatchProcessDialog.cpp}::OnApplyMacroDirectlyByName(), CommandDispatch::OnAudacityCommand(), EffectNoiseReduction::Dialog::OnGetProfile(), NyqBench::OnGo(), MacroCommandDialog::OnItemSelected(), anonymous_namespace{RealtimeEffectPanel.cpp}::RealtimeEffectControl::OnOptionsClicked(), anonymous_namespace{TrackMenus.cpp}::OnStereoToMono(), PluginMenuItems(), NyquistEffect::Process(), MacroCommands::PromptForParamsFor(), MacroCommands::PromptForPresetFor(), GetInfoCommand::SendCommands(), MacroCommandDialog::SetCommandAndParams(), RealtimeEffectStateUI::Show(), anonymous_namespace{TrackMenus.cpp}::TracksMenu(), and RealtimeEffectStateUI::UpdateTitle().
|
private |
Definition at line 871 of file EffectManager.cpp.
References AudacityMessageBox(), PluginManager::Get(), GetCommandName(), AudacityCommand::Init(), PluginManager::Load(), mCommands, and XO().
Referenced by BatchProcessingOff(), BatchProcessingOn(), DoAudacityCommand(), GetCommandDefinition(), GetCommandDescription(), GetCommandTip(), GetCommandUrl(), GetEffectParameters(), PromptUser(), and SetEffectParameters().
void EffectManager::GetCommandDefinition | ( | const PluginID & | ID, |
const CommandContext & | context, | ||
int | flags | ||
) |
Definition at line 168 of file EffectManager.cpp.
References GetAudacityCommand(), GetCommandIdentifier(), GetCommandName(), GetCommandTip(), GetCommandUrl(), GetEffectAndDefaultSettings(), CommandContext::pOutput, S, settings(), AudacityCommand::VisitSettings(), and EffectSettingsManager::VisitSettings().
Referenced by HelpCommand::ApplyInner(), and GetInfoCommand::SendCommands().
TranslatableString EffectManager::GetCommandDescription | ( | const PluginID & | ID | ) |
Definition at line 135 of file EffectManager.cpp.
References GetAudacityCommand(), GetCommandName(), GetEffect(), and XO().
Referenced by EffectUI::DoEffect().
Definition at line 129 of file EffectManager.cpp.
References PluginManager::Get(), EffectDefinitionInterface::GetSquashedName(), PluginManager::GetSymbol(), ComponentInterfaceSymbol::Internal(), and name.
Referenced by GetCommandDefinition(), GetEffectByIdentifier(), CommandDispatch::HandleTextualCommand(), MacroCommandsCatalog::MacroCommandsCatalog(), and GetInfoCommand::SendCommands().
TranslatableString EffectManager::GetCommandName | ( | const PluginID & | ID | ) |
Definition at line 102 of file EffectManager.cpp.
References GetCommandSymbol(), and ComponentInterfaceSymbol::Msgid().
Referenced by EffectUI::DoEffect(), DoGetEffect(), GetAudacityCommand(), GetCommandDefinition(), GetCommandDescription(), and anonymous_namespace{BatchProcessDialog.cpp}::OnApplyMacroDirectlyByName().
ComponentInterfaceSymbol EffectManager::GetCommandSymbol | ( | const PluginID & | ID | ) |
Definition at line 97 of file EffectManager.cpp.
References PluginManager::Get(), and PluginManager::GetSymbol().
Referenced by GetCommandName().
TranslatableString EffectManager::GetCommandTip | ( | const PluginID & | ID | ) |
Definition at line 156 of file EffectManager.cpp.
References GetAudacityCommand(), AudacityCommand::GetDescription(), and GetEffect().
Referenced by GetCommandDefinition().
ManualPageID EffectManager::GetCommandUrl | ( | const PluginID & | ID | ) |
Definition at line 145 of file EffectManager.cpp.
References GetAudacityCommand(), GetEffect(), and AudacityCommand::ManualPage().
Referenced by GetCommandDefinition().
wxString EffectManager::GetDefaultPreset | ( | const PluginID & | ID | ) |
Definition at line 727 of file EffectManager.cpp.
References GetEffect(), CommandParameters::GetParameters(), HasCurrentSettings(), HasFactoryDefaults(), EffectPlugin::kCurrentSettingsIdent, EffectPlugin::kFactoryDefaultsIdent, preset, and wxT().
Referenced by GetEffectParameters(), and MacroCommandDialog::OnItemSelected().
EffectSettings * EffectManager::GetDefaultSettings | ( | const PluginID & | ID | ) |
Get default settings by effect ID. May return nullptr
Definition at line 778 of file EffectManager.cpp.
References GetEffectAndDefaultSettings().
Referenced by EffectUI::DoEffect(), and PromptUser().
EffectPlugin * EffectManager::GetEffect | ( | const PluginID & | ID | ) |
Return an effect by its ID.
Definition at line 773 of file EffectManager.cpp.
References DoGetEffect(), and EffectAndDefaultSettings::effect.
Referenced by BatchProcessingOff(), BatchProcessingOn(), EffectUI::DoEffect(), GetCommandDescription(), GetCommandTip(), GetCommandUrl(), GetDefaultPreset(), GetEffectFamilyName(), GetInstanceFactory(), GetPreset(), GetVendorName(), HasPresets(), IsHidden(), anonymous_namespace{RealtimeEffectPanel.cpp}::RealtimeEffectControl::OnOptionsClicked(), PromptUser(), RealtimeEffectStateUI::Show(), and RealtimeEffectStateUI::UpdateTitle().
std::pair< EffectPlugin *, EffectSettings * > EffectManager::GetEffectAndDefaultSettings | ( | const PluginID & | ID | ) |
Get effect and default settings by effect ID.
result: !result.first || result.second
(if first member is not null, then the second is not null) Definition at line 784 of file EffectManager.cpp.
References DoGetEffect().
Referenced by GetCommandDefinition(), GetDefaultSettings(), GetEffectParameters(), and SetEffectParameters().
Definition at line 903 of file EffectManager.cpp.
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().
TranslatableString EffectManager::GetEffectFamilyName | ( | const PluginID & | ID | ) |
Definition at line 107 of file EffectManager.cpp.
References PluginManager::Get(), and GetEffect().
Referenced by anonymous_namespace{MenuHelper.cpp}::AddSortedEffectMenuItems().
wxString EffectManager::GetEffectParameters | ( | const PluginID & | ID | ) |
Definition at line 248 of file EffectManager.cpp.
References GetAudacityCommand(), GetDefaultPreset(), GetEffectAndDefaultSettings(), and AudacityCommand::SaveSettingsAsString().
Referenced by MacroCommands::GetCurrentParamsFor(), and MacroCommands::PromptForParamsFor().
|
static |
Find the singleton EffectInstanceFactory for ID.
Definition at line 923 of file EffectManager.cpp.
References Get(), and GetEffect().
wxString EffectManager::GetPreset | ( | const PluginID & | ID, |
const wxString & | params, | ||
wxWindow * | parent | ||
) |
Definition at line 681 of file EffectManager.cpp.
References GetEffect(), CommandParameters::GetParameters(), CommandParameters::HasEntry(), params, preset, and wxT().
Referenced by MacroCommands::PromptForPresetFor().
bool EffectManager::GetSkipStateFlag | ( | ) |
Definition at line 231 of file EffectManager.cpp.
References mSkipStateFlag.
Referenced by EffectUI::DoEffect().
TranslatableString EffectManager::GetVendorName | ( | const PluginID & | ID | ) |
Definition at line 118 of file EffectManager.cpp.
References PluginManager::Get(), and GetEffect().
Referenced by anonymous_namespace{MenuHelper.cpp}::AddSortedEffectMenuItems().
bool EffectManager::HasPresets | ( | const PluginID & | ID | ) |
Definition at line 393 of file EffectManager.cpp.
References GetEffect(), GetUserPresets(), HasCurrentSettings(), and HasFactoryDefaults().
Referenced by MacroCommandDialog::OnItemSelected(), and MacroCommandDialog::SetCommandAndParams().
bool EffectManager::IsHidden | ( | const PluginID & | ID | ) |
Definition at line 219 of file EffectManager.cpp.
References GetEffect().
Referenced by anonymous_namespace{MenuHelper.cpp}::IsEnabledPlugin().
bool EffectManager::PromptUser | ( | const PluginID & | ID, |
const EffectDialogFactory & | factory, | ||
wxWindow & | parent | ||
) |
Shows an effect or command dialog so the user can specify settings for later.
It is used when defining a macro. It does not invoke the effect or command.
Show the effect dialog, only so that the user can choose settings, for instance to define a macro.
Definition at line 330 of file EffectManager.cpp.
References TrackList::Create(), cloud::factory, GetAudacityCommand(), GetDefaultSettings(), GetEffect(), AudacityCommand::PromptUser(), EffectBase::SetTracks(), and EffectUIServices::ShowHostInterface().
const PluginID & EffectManager::RegisterEffect | ( | std::unique_ptr< EffectPlugin > | uEffect | ) |
Here solely for the purpose of Nyquist Workbench until a better solution is devised.
Register an effect so it can be executed. uEffect is expected to be a self-hosting Nyquist effect
Definition at line 59 of file EffectManager.cpp.
References PluginManager::Get(), mEffects, PluginTypeEffect, and PluginManager::RegisterPlugin().
Referenced by NyqBench::OnGo().
|
inline |
Begin a scope that ends when the returned object is destroyed.
Within this scope, "batch" (i.e. macro) processing happens, and Effects that are not yet stateless may change their state temporarily, but it is restored afterward
Definition at line 140 of file EffectManager.h.
Referenced by MacroCommands::ApplyEffectCommand(), and MacroCommands::PromptForParamsFor().
bool EffectManager::SetEffectParameters | ( | const PluginID & | ID, |
const wxString & | params | ||
) |
Definition at line 288 of file EffectManager.cpp.
References GetAudacityCommand(), GetEffectAndDefaultSettings(), CommandParameters::HasEntry(), AudacityCommand::Init(), AudacityCommand::LoadSettingsFromString(), params, settings(), and wxT().
void EffectManager::SetSkipStateFlag | ( | bool | flag | ) |
Allow effects to disable saving the state at run time
Definition at line 226 of file EffectManager.cpp.
References flag, and mSkipStateFlag.
Referenced by DoAudacityCommand(), EffectUI::DoEffect(), EffectNoiseReduction::Dialog::OnGetProfile(), and NyquistEffect::Process().
bool EffectManager::SupportsAutomation | ( | const PluginID & | ID | ) |
Support for batch commands
Definition at line 236 of file EffectManager.cpp.
References PluginManager::Get(), PluginManager::GetPlugin(), and PluginDescriptor::IsEffectAutomatable().
void EffectManager::UnregisterEffect | ( | const PluginID & | ID | ) |
Used only by Nyquist Workbench module.
Definition at line 71 of file EffectManager.cpp.
References PluginManager::Get(), mEffects, and PluginManager::UnregisterPlugin().
Referenced by NyqBench::OnGo().
|
private |
Definition at line 171 of file EffectManager.h.
Referenced by DoGetEffect(), and GetAudacityCommand().
|
private |
Definition at line 170 of file EffectManager.h.
Referenced by DoGetEffect(), RegisterEffect(), and UnregisterEffect().
|
private |
Definition at line 172 of file EffectManager.h.
|
private |
Definition at line 174 of file EffectManager.h.
|
private |
Definition at line 178 of file EffectManager.h.
Referenced by EffectManager(), GetSkipStateFlag(), and SetSkipStateFlag().