Audacity 3.2.0
Limiter.cpp
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*!********************************************************************
3
4 Audacity: A Digital Audio Editor
5
6 Limiter.cpp
7
8 Matthieu Hodgkinson
9
10**********************************************************************/
11
12#include "Limiter.h"
13#include "CompressorInstance.h" // A limiter is just a compressor with hard-coded parameters.
17#include "LimiterEditor.h"
18#include "LoadEffects.h"
19#include "ShuttleAutomation.h"
20
22
23namespace
24{
26} // namespace
27
29{
30 static CapturedParameters<
36 parameters;
37 return parameters;
38}
39
40std::shared_ptr<EffectInstance> EffectLimiter::MakeInstance() const
41{
42 return std::make_shared<CompressorInstance>(*this);
43}
44
46{
47 // Given the infinite ratio, a limiter is always susceptible to modifying the
48 // audio.
49 return false;
50}
51
53{
55}
56
58{
59 return Symbol;
60}
61
63{
64 return XO("Augments loudness while minimizing distortion.");
65}
66
68{
69 // TODO
70 return L"";
71}
72
74{
75 return EffectTypeProcess;
76}
77
79{
81}
82
84{
86 RegistryPaths paths(presets.size());
87 std::transform(
88 presets.begin(), presets.end(), paths.begin(), [](const auto& preset) {
89 return RegistryPath { preset.name.Translation() };
90 });
91 return paths;
92}
93
96{
98 if (id < 0 || id >= presets.size())
99 return {};
100 EffectLimiter::GetSettings(settings) = presets[id].preset;
101 return { nullptr };
102}
103
104std::unique_ptr<EffectEditor> EffectLimiter::MakeEditor(
105 ShuttleGui& S, EffectInstance& instance, EffectSettingsAccess& access,
106 const EffectOutputs* pOutputs) const
107{
109 S, instance, access, *this, pOutputs, GetSettings(access.Get()));
110}
111
112std::unique_ptr<EffectOutputs> EffectLimiter::MakeOutputs() const
113{
114 return std::make_unique<DynamicRangeProcessorDummyOutputs>();
115}
EffectType
@ EffectTypeProcess
std::optional< std::unique_ptr< EffectSettingsAccess::Message > > OptionalMessage
XO("Cut/Copy/Paste")
std::vector< RegistryPath > RegistryPaths
Definition: Identifier.h:219
ReverbSettings preset
Definition: ReverbBase.cpp:25
#define S(N)
Definition: ToChars.cpp:64
static Settings & settings()
Definition: TrackInfo.cpp:51
int id
Generates EffectParameterMethods overrides from variadic template arguments.
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
void SetLinearEffectFlag(bool linearEffectFlag)
Definition: EffectBase.cpp:210
RealtimeSince
In which versions of Audacity was an effect realtime capable?
Performs effect computation.
EffectType GetType() const override
Type determines how it behaves.
Definition: Limiter.cpp:73
bool CheckWhetherSkipEffect(const EffectSettings &settings) const override
After Init(), tell whether Process() should be skipped.
Definition: Limiter.cpp:45
static const ComponentInterfaceSymbol Symbol
Definition: Limiter.h:22
std::unique_ptr< EffectEditor > MakeEditor(ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) const override
Called only from PopulateUI, to add controls to effect panel.
Definition: Limiter.cpp:104
ManualPageID ManualPage() const override
Name of a page in the Audacity alpha manual, default is empty.
Definition: Limiter.cpp:67
std::shared_ptr< EffectInstance > MakeInstance() const override
Make an object maintaining short-term state of an Effect.
Definition: Limiter.cpp:40
RegistryPaths GetFactoryPresets() const override
Report names of factory presets.
Definition: Limiter.cpp:83
OptionalMessage LoadFactoryPreset(int id, EffectSettings &settings) const override
Definition: Limiter.cpp:95
RealtimeSince RealtimeSupport() const override
Since which version of Audacity has the effect supported realtime?
Definition: Limiter.cpp:78
const EffectParameterMethods & Parameters() const override
Definition: Limiter.cpp:28
TranslatableString GetDescription() const override
Definition: Limiter.cpp:62
ComponentInterfaceSymbol GetSymbol() const override
Definition: Limiter.cpp:57
std::unique_ptr< EffectOutputs > MakeOutputs() const override
Produce an object to hold values to send to effect output meters.
Definition: Limiter.cpp:112
Hold values to send to effect output meters.
Interface for manipulations of an Effect's settings.
virtual const EffectSettings & Get()=0
static LimiterSettings & GetSettings(EffectSettings &settings)
Assume settings originated from MakeSettings() and copies thereof.
Definition: Effect.h:166
static constexpr LimiterParameter showTarget
Definition: LimiterEditor.h:90
static constexpr LimiterParameter releaseMs
Definition: LimiterEditor.h:74
static constexpr LimiterParameter makeupTargetDb
Definition: LimiterEditor.h:50
static constexpr LimiterParameter lookaheadMs
Definition: LimiterEditor.h:68
static constexpr LimiterParameter thresholdDb
Definition: LimiterEditor.h:41
static constexpr LimiterParameter showOutput
Definition: LimiterEditor.h:84
static constexpr LimiterParameter showActual
Definition: LimiterEditor.h:87
static constexpr LimiterParameter showInput
Definition: LimiterEditor.h:81
static constexpr LimiterParameter kneeWidthDb
Definition: LimiterEditor.h:59
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
Holds a msgid for the translation catalog; may also bind format arguments.
std::unique_ptr< EffectEditor > MakeLimiterEditor(ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectUIServices &services, const EffectOutputs *pOutputs, LimiterSettings settings)
DYNAMIC_RANGE_PROCESSOR_API std::vector< LimiterPreset > GetLimiterPresets()
BuiltinEffectsModule::Registration< EffectLimiter > reg
Definition: Limiter.cpp:25
Externalized state of a plug-in.