Audacity 3.2.0
Compressor.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 Compressor.cpp
7
8 Matthieu Hodgkinson
9
10**********************************************************************/
11
12#include "Compressor.h"
13#include "CompressorEditor.h"
14#include "CompressorInstance.h"
17#include "LoadEffects.h"
18#include "ShuttleAutomation.h"
19
21
22namespace
23{
25} // namespace
26
28{
29 static CapturedParameters<
35 parameters;
36 return parameters;
37}
38
39std::shared_ptr<EffectInstance> EffectCompressor::MakeInstance() const
40{
41 return std::make_shared<CompressorInstance>(*this);
42}
43
44std::unique_ptr<EffectOutputs> EffectCompressor::MakeOutputs() const
45{
46 return std::make_unique<DynamicRangeProcessorDummyOutputs>();
47}
48
50 const EffectSettings& settings) const
51{
52 const auto& compressorSettings = GetSettings(settings);
53 return compressorSettings.compressionRatio == 1 &&
54 compressorSettings.makeupGainDb == 0 &&
55 // Also look-ahead, as this adds delay when used on a real-time input
56 // (mic).
57 compressorSettings.lookaheadMs == 0;
58}
59
61{
63}
64
66{
67 return Symbol;
68}
69
71{
72 return XO(
73 "Reduces \"dynamic range\", or differences between loud and quiet parts.");
74}
75
77{
78 // TODO: add manual page
79 return L"";
80}
81
83{
84 return EffectTypeProcess;
85}
86
88{
90}
91
92// Effect implementation
93
94std::unique_ptr<EffectEditor> EffectCompressor::MakeEditor(
96 const EffectOutputs* pOutputs) const
97{
99 S, instance, access, *this, pOutputs, GetSettings(access.Get()));
100}
EffectType
@ EffectTypeProcess
XO("Cut/Copy/Paste")
#define S(N)
Definition: ToChars.cpp:64
static Settings & settings()
Definition: TrackInfo.cpp:47
Generates EffectParameterMethods overrides from variadic template arguments.
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
static constexpr CompressorParameter releaseMs
static constexpr CompressorParameter compressionRatio
static constexpr CompressorParameter thresholdDb
static constexpr CompressorParameter lookaheadMs
static constexpr CompressorParameter showGraph
static constexpr CompressorParameter makeupGainDb
static constexpr CompressorParameter attackMs
static constexpr CompressorParameter kneeWidthDb
void SetLinearEffectFlag(bool linearEffectFlag)
Definition: EffectBase.cpp:210
const EffectParameterMethods & Parameters() const override
Definition: Compressor.cpp:27
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: Compressor.cpp:94
std::unique_ptr< EffectOutputs > MakeOutputs() const override
Produce an object to hold values to send to effect output meters.
Definition: Compressor.cpp:44
EffectType GetType() const override
Type determines how it behaves.
Definition: Compressor.cpp:82
static const ComponentInterfaceSymbol Symbol
Definition: Compressor.h:22
RealtimeSince RealtimeSupport() const override
Since which version of Audacity has the effect supported realtime?
Definition: Compressor.cpp:87
ComponentInterfaceSymbol GetSymbol() const override
Definition: Compressor.cpp:65
TranslatableString GetDescription() const override
Definition: Compressor.cpp:70
ManualPageID ManualPage() const override
Name of a page in the Audacity alpha manual, default is empty.
Definition: Compressor.cpp:76
bool CheckWhetherSkipEffect(const EffectSettings &settings) const override
After Init(), tell whether Process() should be skipped.
Definition: Compressor.cpp:49
std::shared_ptr< EffectInstance > MakeInstance() const override
Make an object maintaining short-term state of an Effect.
Definition: Compressor.cpp:39
RealtimeSince
In which versions of Audacity was an effect realtime capable?
Performs effect computation.
Hold values to send to effect output meters.
Interface for manipulations of an Effect's settings.
virtual const EffectSettings & Get()=0
static CompressorSettings & GetSettings(EffectSettings &settings)
Assume settings originated from MakeSettings() and copies thereof.
Definition: Effect.h:166
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 > MakeCompressorEditor(ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectUIServices &services, const EffectOutputs *pOutputs, CompressorSettings settings)
BuiltinEffectsModule::Registration< EffectCompressor > reg
Definition: Compressor.cpp:24
Externalized state of a plug-in.