Audacity 3.2.0
ReverbBase.h
Go to the documentation of this file.
1#pragma once
2
3#include "PerTrackEffect.h"
4#include "Reverb_libSoX.h"
5#include "SettingsVisitor.h"
6
7struct BUILTIN_EFFECTS_API ReverbSettings
8{
9 static constexpr double roomSizeDefault = 75.0;
10 static constexpr double preDelayDefault = 10.0;
11 static constexpr double reverberanceDefault = 50.0;
12 static constexpr double hfDampingDefault = 50.0;
13 static constexpr double toneLowDefault = 100.0;
14 static constexpr double toneHighDefault = 100.0;
15 static constexpr double wetGainDefault = -1.0;
16 static constexpr double dryGainDefault = -1.0;
17 static constexpr double stereoWidthDefault = 100.0;
18 static constexpr bool wetOnlyDefault = false;
19
20 double mRoomSize { roomSizeDefault };
21 double mPreDelay { preDelayDefault };
22 double mReverberance { reverberanceDefault };
23 double mHfDamping { hfDampingDefault };
24 double mToneLow { toneLowDefault };
25 double mToneHigh { toneHighDefault };
26 double mWetGain { wetGainDefault };
27 double mDryGain { dryGainDefault };
28 double mStereoWidth { stereoWidthDefault };
29 bool mWetOnly { wetOnlyDefault };
30
31 friend bool operator==(const ReverbSettings& a, const ReverbSettings& b);
32
34 const ReverbSettings& a, const ReverbSettings& b);
35};
36
38{
40 float* dry;
41 float* wet[2];
42};
43
45{
47 : Reverb_priv_t {}
48 {
49 }
51 {
53 }
54};
55
57{
58 unsigned mNumChans {};
59 std::unique_ptr<Reverb_priv_ex[]> mP {};
60};
61
62class BUILTIN_EFFECTS_API ReverbBase :
63 public EffectWithSettings<ReverbSettings, PerTrackEffect>
64{
65public:
67
68 ReverbBase();
69 virtual ~ReverbBase();
70
71 // ComponentInterface implementation
72
73 ComponentInterfaceSymbol GetSymbol() const override;
74 TranslatableString GetDescription() const override;
75 ManualPageID ManualPage() const override;
76
77 // EffectDefinitionInterface implementation
78
79 EffectType GetType() const override;
80 RegistryPaths GetFactoryPresets() const override;
82 LoadFactoryPreset(int id, EffectSettings& settings) const override;
83
84 RealtimeSince RealtimeSupport() const override;
85
86 struct BUILTIN_EFFECTS_API Instance :
89 {
90 explicit Instance(const PerTrackEffect& effect);
91
92 bool ProcessInitialize(
94 ChannelNames chanMap) override;
95
96 size_t ProcessBlock(
97 EffectSettings& settings, const float* const* inBlock,
98 float* const* outBlock, size_t blockLen) override;
99
100 bool ProcessFinalize(void) noexcept override;
101
102 // Realtime section
103
104 bool
105 RealtimeInitialize(EffectSettings& settings, double sampleRate) override;
106
107 bool RealtimeAddProcessor(
108 EffectSettings& settings, EffectOutputs*, unsigned numChannels,
109 float sampleRate) override;
110
111 bool RealtimeFinalize(EffectSettings& settings) noexcept override;
112
113 size_t RealtimeProcess(
114 size_t group, EffectSettings& settings, const float* const* inbuf,
115 float* const* outbuf, size_t numSamples) override;
116
117 bool RealtimeSuspend() override;
118
119 unsigned GetAudioOutCount() const override;
120
121 unsigned GetAudioInCount() const override;
122
123 bool InstanceInit(
125 ChannelNames chanMap, bool forceStereo);
126
127 size_t InstanceProcess(
129 const float* const* inBlock, float* const* outBlock, size_t blockLen);
130
132 std::vector<ReverbBase::Instance> mSlaves;
133
134 unsigned mChannels { 2 };
135
137 double mLastSampleRate { 0 };
138 };
139
140protected:
141 const EffectParameterMethods& Parameters() const override;
142
143 static constexpr EffectParameter RoomSize { &ReverbSettings::mRoomSize,
144 L"RoomSize",
146 0,
147 100,
148 1 };
149
150 static constexpr EffectParameter PreDelay { &ReverbSettings::mPreDelay,
151 L"Delay",
153 0,
154 200,
155 1 };
156
157 static constexpr EffectParameter Reverberance {
159 L"Reverberance",
161 0,
162 100,
163 1
164 };
165
166 static constexpr EffectParameter HfDamping {
168 L"HfDamping",
170 0,
171 100,
172 1
173 };
174
175 static constexpr EffectParameter ToneLow { &ReverbSettings::mToneLow,
176 L"ToneLow",
178 0,
179 100,
180 1 };
181
182 static constexpr EffectParameter ToneHigh { &ReverbSettings::mToneHigh,
183 L"ToneHigh",
185 0,
186 100,
187 1 };
188
189 static constexpr EffectParameter WetGain { &ReverbSettings::mWetGain,
190 L"WetGain",
192 -20,
193 10,
194 1 };
195
196 static constexpr EffectParameter DryGain { &ReverbSettings::mDryGain,
197 L"DryGain",
199 -20,
200 10,
201 1 };
202
203 static constexpr EffectParameter StereoWidth {
205 L"StereoWidth",
207 0,
208 100,
209 1
210 };
211
212 static constexpr EffectParameter WetOnly { &ReverbSettings::mWetOnly,
213 L"WetOnly",
215 false,
216 true,
217 1 };
218};
EffectType
ChannelName
std::optional< std::unique_ptr< EffectSettingsAccess::Message > > OptionalMessage
std::vector< RegistryPath > RegistryPaths
Definition: Identifier.h:219
static void reverb_delete(reverb_t *p)
bool OnlySimpleParametersChanged(const ReverbSettings &a, const ReverbSettings &b)
Definition: ReverbBase.cpp:369
static Settings & settings()
Definition: TrackInfo.cpp:51
bool operator==(const WaveTrackLocation &a, const WaveTrackLocation &b)
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
RealtimeSince
In which versions of Audacity was an effect realtime capable?
Inherit to add a state variable to an EffectInstance subclass.
Hold values to send to effect output meters.
Interface for manipulations of an Effect's settings.
Base class for many of the effects in Audacity.
static const ComponentInterfaceSymbol Symbol
Definition: ReverbBase.h:66
Holds a msgid for the translation catalog; may also bind format arguments.
Externalized state of a plug-in.
float * wet[2]
Definition: ReverbBase.h:41
reverb_t reverb
Definition: ReverbBase.h:39
float * dry
Definition: ReverbBase.h:40
std::vector< ReverbBase::Instance > mSlaves
Definition: ReverbBase.h:132
ReverbSettings mLastAppliedSettings
Definition: ReverbBase.h:136
ReverbState mState
Definition: ReverbBase.h:131
static constexpr double toneLowDefault
Definition: ReverbBase.h:13
static constexpr double roomSizeDefault
Definition: ReverbBase.h:9
double mDryGain
Definition: ReverbBase.h:27
static constexpr double dryGainDefault
Definition: ReverbBase.h:16
double mPreDelay
Definition: ReverbBase.h:21
double mReverberance
Definition: ReverbBase.h:22
static constexpr double hfDampingDefault
Definition: ReverbBase.h:12
double mToneHigh
Definition: ReverbBase.h:25
static constexpr double reverberanceDefault
Definition: ReverbBase.h:11
static constexpr double preDelayDefault
Definition: ReverbBase.h:10
static constexpr double wetGainDefault
Definition: ReverbBase.h:15
double mWetGain
Definition: ReverbBase.h:26
double mToneLow
Definition: ReverbBase.h:24
double mHfDamping
Definition: ReverbBase.h:23
static constexpr double toneHighDefault
Definition: ReverbBase.h:14
static constexpr double stereoWidthDefault
Definition: ReverbBase.h:17
static constexpr bool wetOnlyDefault
Definition: ReverbBase.h:18
double mRoomSize
Definition: ReverbBase.h:20
double mStereoWidth
Definition: ReverbBase.h:28
unsigned mNumChans
Definition: ReverbBase.h:58
std::unique_ptr< Reverb_priv_ex[]> mP
Definition: ReverbBase.h:59