Audacity 3.2.0
LegacyCompressorBase.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 LegacyCompressorBase.h
6
7 Dominic Mazzoni
8
9**********************************************************************/
10#pragma once
11
12#include "MemoryX.h"
13#include "ShuttleAutomation.h"
14#include "TwoPassSimpleMono.h"
15
18
19class BUILTIN_EFFECTS_API LegacyCompressorBase : public EffectTwoPassSimpleMono
20{
21public:
22 static inline LegacyCompressorBase*
24 {
25 return &e;
26 }
27
29
31 virtual ~LegacyCompressorBase();
32
33 // ComponentInterface implementation
34
35 ComponentInterfaceSymbol GetSymbol() const override;
36 TranslatableString GetDescription() const override;
37 ManualPageID ManualPage() const override;
38
39 // EffectDefinitionInterface implementation
40
41 EffectType GetType() const override;
42
43protected:
44 // EffectTwoPassSimpleMono implementation
45
46 bool InitPass1() override;
47 bool InitPass2() override;
48 bool NewTrackPass1() override;
49 bool ProcessPass2(float* buffer, size_t len) override;
51 float* buffer1, size_t len1, float* buffer2, size_t len2) override;
52
53private:
54 // LegacyCompressorBase implementation
55
56 void FreshenCircle();
57 float AvgCircle(float x);
58 void Follow(
59 float* buffer, float* env, size_t len, float* previous,
60 size_t previous_len);
61 float DoCompression(float x, double env);
62
63protected:
64 double mRMSSum;
66 size_t mCirclePos;
68
72 double mRatio;
73 bool mNormalize; // MJS
75
76 double mDecayTime; // The "Release" time.
80 double mThreshold;
84 double mGain;
85 double mLastLevel;
86 Floats mFollow1, mFollow2;
87 size_t mFollowLen;
88
89 double mMax; // MJS
90
91 const EffectParameterMethods& Parameters() const override;
92
93 static constexpr EffectParameter Threshold {
94 &LegacyCompressorBase::mThresholdDB, L"Threshold", -12.0, -60.0, -1.0, 1
95 };
96 static constexpr EffectParameter NoiseFloor {
98 L"NoiseFloor",
99 -40.0,
100 -80.0,
101 -20.0,
102 0.2
103 };
104 static constexpr EffectParameter Ratio {
105 &LegacyCompressorBase::mRatio, L"Ratio", 2.0, 1.1, 10.0, 10
106 };
107 static constexpr EffectParameter AttackTime {
108 &LegacyCompressorBase::mAttackTime, L"AttackTime", 0.2, 0.1, 5.0, 100
109 };
110 static constexpr EffectParameter ReleaseTime {
111 &LegacyCompressorBase::mDecayTime, L"ReleaseTime", 1.0, 1.0, 30.0, 10
112 };
113 static constexpr EffectParameter Normalize {
114 &LegacyCompressorBase::mNormalize, L"Normalize", true, false, true, 1
115 };
116 static constexpr EffectParameter UsePeak {
117 &LegacyCompressorBase::mUsePeak, L"UsePeak", false, false, true, 1
118 };
119};
EffectType
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
virtual EffectType GetType() const =0
Type determines how it behaves.
virtual ManualPageID ManualPage() const
Name of a page in the Audacity alpha manual, default is empty.
virtual const EffectParameterMethods & Parameters() const
Definition: Effect.cpp:96
TranslatableString GetDescription() const override
Definition: Effect.cpp:64
ComponentInterfaceSymbol GetSymbol() const override
Definition: Effect.cpp:49
Interface for manipulations of an Effect's settings.
An Effect base class that implements a two pass process.
virtual bool ProcessPass2(float *WXUNUSED(buffer), size_t WXUNUSED(len))
virtual bool TwoBufferProcessPass1(float *buffer1, size_t len1, float *buffer2, size_t len2)
An Effect derived from EffectTwoPassSimpleMono.
static LegacyCompressorBase * FetchParameters(LegacyCompressorBase &e, EffectSettings &)
static const ComponentInterfaceSymbol Symbol
Holds a msgid for the translation catalog; may also bind format arguments.
Externalized state of a plug-in.