Audacity 3.2.0
AudioUnitEffect.h
Go to the documentation of this file.
1/*!********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file AudioUnitEffect.h
6
7 Dominic Mazzoni
8 Leland Lucius
9
10**********************************************************************/
11#ifndef AUDACITY_AUDIOUNIT_EFFECT_H
12#define AUDACITY_AUDIOUNIT_EFFECT_H
13
14
15
16#if USE_AUDIO_UNITS
17
18#include "AudioUnitWrapper.h"
19
20#include "MemoryX.h"
21#include <functional>
22#include <type_traits>
23#include <vector>
24
25#include <AudioToolbox/AudioUnitUtilities.h>
26#include <AudioUnit/AudioUnitProperties.h>
27
28#include "../PerTrackEffect.h"
29#include "PluginInterface.h"
30
31#include <wx/weakref.h>
32
33#define AUDIOUNITEFFECTS_VERSION wxT("1.0.0.0")
34/* i18n-hint: the name of an Apple audio software protocol */
35#define AUDIOUNITEFFECTS_FAMILY EffectFamilySymbol{ wxT("AudioUnit"), XO("Audio Unit") }
36class AudioUnitEffect;
37
38class AUControl;
39
40class AudioUnitEffect final
41 : public PerTrackEffect
43{
44public:
46
47 AudioUnitEffect(const PluginPath & path,
48 const wxString & name, AudioComponent component,
49 Parameters *pParameters = nullptr,
50 AudioUnitEffect *master = nullptr);
51 virtual ~AudioUnitEffect();
52
53 // ComponentInterface implementation
54
55 PluginPath GetPath() const override;
56 ComponentInterfaceSymbol GetSymbol() const override;
57 VendorSymbol GetVendor() const override;
58 wxString GetVersion() const override;
59 TranslatableString GetDescription() const override;
60
61 // EffectDefinitionInterface implementation
62
63 EffectType GetType() const override;
64 EffectFamilySymbol GetFamily() const override;
65 bool IsInteractive() const override;
66 bool IsDefault() const override;
67 RealtimeSince RealtimeSupport() const override;
68 bool SupportsAutomation() const override;
69
70 EffectSettings MakeSettings() const override;
72 const EffectSettings &src, EffectSettings &dst) const override;
73
74 bool SaveSettings(
75 const EffectSettings &settings, CommandParameters & parms) const override;
77 bool LoadSettings(
78 const CommandParameters & parms, EffectSettings &settings) const override;
79
81 const RegistryPath & name, EffectSettings &settings) const override;
82 bool SaveUserPreset(
83 const RegistryPath & name, const EffectSettings &settings) const override;
84
85 RegistryPaths GetFactoryPresets() const override;
87 const override;
88
89 int ShowClientInterface(wxWindow &parent, wxDialog &dialog,
90 EffectUIValidator *pValidator, bool forceModal) override;
91
92 bool InitializePlugin();
94
95 // EffectUIClientInterface implementation
96
97 std::shared_ptr<EffectInstance> MakeInstance() const override;
98 std::unique_ptr<EffectUIValidator> PopulateUI(
100 const EffectOutputs *pOutputs) override;
101 bool CloseUI() override;
102
103 bool CanExportPresets() override;
104 void ExportPresets(const EffectSettings &settings) const override;
106
107 bool HasOptions() override;
108 void ShowOptions() override;
109
110 // AudioUnitEffect implementation
111
112private:
114 static RegistryPath FindPresetKey(const CommandParameters & parms);
115
117 const AudioUnitEffectSettings &settings, const wxString & path) const;
119 AudioUnitEffectSettings &settings, const wxString & path) const;
125 const wxString &path, const void *blob, size_t len,
126 bool allowEmpty = true) const;
127
128 void GetChannelCounts();
129
131 const RegistryPath & group, EffectSettings &settings) const;
133 LoadPreset(const RegistryPath & group, EffectSettings &settings) const;
134 bool SavePreset(const RegistryPath & group,
135 const AudioUnitEffectSettings &settings) const;
136
137#if defined(HAVE_AUDIOUNIT_BASIC_SUPPORT)
138 bool CreatePlain(wxWindow *parent);
139#endif
140
141private:
143 const wxString mName;
144 const wxString mVendor;
145
146 bool mInteractive{ false };
147 bool mUseLatency{ true };
148
149 wxWindow *mParent{};
150 wxString mUIType; // NOT translated, "Full", "Generic", or "Basic"
151};
152
153#endif
154
155#endif
const TranslatableString name
Definition: Distortion.cpp:74
std::optional< std::unique_ptr< EffectSettingsAccess::Message > > OptionalMessage
EffectType
wxString RegistryPath
Definition: Identifier.h:218
wxString PluginPath
type alias for identifying a Plugin supplied by a module, each module defining its own interpretation...
Definition: Identifier.h:214
std::vector< RegistryPath > RegistryPaths
Definition: Identifier.h:219
#define S(N)
Definition: ToChars.cpp:64
static Settings & settings()
Definition: TrackInfo.cpp:87
An Effect class that handles a wide range of effects. ??Mac only??
bool HasOptions() override
TranslatableString SaveBlobToConfig(const RegistryPath &group, const wxString &path, const void *blob, size_t len, bool allowEmpty=true) const
bool CloseUI() override
bool SaveUserPreset(const RegistryPath &name, const EffectSettings &settings) const override
Save settings in the configuration file as a user-named preset.
bool IsDefault() const override
Whether the effect sorts "above the line" in the menus.
bool SaveSettings(const EffectSettings &settings, CommandParameters &parms) const override
Store settings as keys and values.
static RegistryPath ChoosePresetKey(const EffectSettings &settings)
static RegistryPath FindPresetKey(const CommandParameters &parms)
PluginPath GetPath() const override
RegistryPaths GetFactoryPresets() const override
Report names of factory presets.
EffectType GetType() const override
Type determines how it behaves.
OptionalMessage ImportPresets(EffectSettings &settings) override
void ShowOptions() override
TranslatableString Export(const AudioUnitEffectSettings &settings, const wxString &path) const
int ShowClientInterface(wxWindow &parent, wxDialog &dialog, EffectUIValidator *pValidator, bool forceModal) override
TranslatableString GetDescription() const override
OptionalMessage LoadFactoryPreset(int id, EffectSettings &settings) const override
std::unique_ptr< EffectUIValidator > PopulateUI(ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) override
Adds controls to a panel that is given as the parent window of S
EffectSettings MakeSettings() const override
bool CanExportPresets() override
virtual ~AudioUnitEffect()
std::shared_ptr< EffectInstance > MakeInstance() const override
Make an object maintaining short-term state of an Effect.
wxWindow * mParent
EffectFamilySymbol GetFamily() const override
Report identifier and user-visible name of the effect protocol.
RealtimeSince RealtimeSupport() const override
Since which version of Audacity has the effect supported realtime?
bool MigrateOldConfigFile(const RegistryPath &group, EffectSettings &settings) const
bool LoadSettings(const CommandParameters &parms, EffectSettings &settings) const override
May allocate memory, so should be called only in the main thread.
const wxString mName
bool CopySettingsContents(const EffectSettings &src, EffectSettings &dst) const override
Update one settings object from another.
bool SupportsAutomation() const override
Whether the effect has any automatable controls.
TranslatableString Import(AudioUnitEffectSettings &settings, const wxString &path) const
OptionalMessage LoadPreset(const RegistryPath &group, EffectSettings &settings) const
wxString GetVersion() const override
const wxString mVendor
AudioUnitEffect(const PluginPath &path, const wxString &name, AudioComponent component, Parameters *pParameters=nullptr, AudioUnitEffect *master=nullptr)
OptionalMessage LoadUserPreset(const RegistryPath &name, EffectSettings &settings) const override
void ExportPresets(const EffectSettings &settings) const override
bool SavePreset(const RegistryPath &group, const AudioUnitEffectSettings &settings) const
VendorSymbol GetVendor() const override
const PluginPath mPath
ComponentInterfaceSymbol GetSymbol() const override
bool IsInteractive() const override
Whether the effect needs a dialog for entry of settings.
CommandParameters, derived from wxFileConfig, is essentially doing the same things as the SettingsVis...
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
RealtimeSince
In which versions of Audacity was an effect realtime capable?
Performs effect computation.
Hold values to send to effect output meters.
Interface for transferring values from a panel of effect controls.
Definition: EffectPlugin.h:239
Base class for many of the effects in Audacity.
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.
Common base class for AudioUnitEffect and its Instance.
Externalized state of a plug-in.