Audacity 3.2.0
NoiseReductionBase.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 NoiseReductionBase.h
6
7 Dominic Mazzoni
8 Paul Licameli
9
10**********************************************************************/
11#pragma once
12
13#include "StatefulEffect.h"
14
16{
20};
21
22class BUILTIN_EFFECTS_API NoiseReductionBase : public StatefulEffect
23{
24public:
26
28 virtual ~NoiseReductionBase();
29
31
32 // ComponentInterface implementation
33
34 ComponentInterfaceSymbol GetSymbol() const override;
35 TranslatableString GetDescription() const override;
36
37 // EffectDefinitionInterface implementation
38
39 EffectType GetType() const override;
40
41 // Effect implementation
42
43 bool Process(EffectInstance& instance, EffectSettings& settings) override;
44
45 // This object is the memory of the effect between uses
46 // (other than noise profile statistics)
47 class BUILTIN_EFFECTS_API Settings
48 {
49 public:
50 Settings();
52 {
53 }
54
55 bool PrefsIO(bool read);
56 bool Validate(NoiseReductionBase* effect) const;
57
58 size_t WindowSize() const
59 {
60 return 1u << (3 + mWindowSizeChoice);
61 }
62 unsigned StepsPerWindow() const
63 {
64 return 1u << (1 + mStepsPerWindowChoice);
65 }
66 size_t SpectrumSize() const
67 {
68 return 1 + WindowSize() / 2;
69 }
70 size_t StepSize() const
71 {
72 return WindowSize() / StepsPerWindow();
73 }
74
76
77 // Stored in preferences:
78
79 // Basic:
80 double mNewSensitivity; // - log10 of a probability... yeah.
81 double mFreqSmoothingBands; // really an integer
82 double mNoiseGain; // in dB, positive
83 double mAttackTime; // in secs
84 double mReleaseTime; // in secs
85
86 // Advanced:
87 double mOldSensitivity; // in dB, plus or minus
88
89 // Basic:
91
92 // Advanced:
97 };
98
99 class Statistics;
100 class Worker;
101
102protected:
103 std::unique_ptr<Settings> mSettings;
104 std::unique_ptr<Statistics> mStatistics;
105};
EffectType
NoiseReductionChoice
@ NRC_REDUCE_NOISE
@ NRC_LEAVE_RESIDUE
@ NRC_ISOLATE_NOISE
static Settings & settings()
Definition: TrackInfo.cpp:51
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
virtual EffectType GetType() const =0
Type determines how it behaves.
TranslatableString GetDescription() const override
Definition: Effect.cpp:64
bool TrackProgress(int whichTrack, double frac, const TranslatableString &={}) const
Definition: Effect.cpp:343
ComponentInterfaceSymbol GetSymbol() const override
Definition: Effect.cpp:49
Performs effect computation.
A two-pass effect to reduce background noise.
std::unique_ptr< Settings > mSettings
static const ComponentInterfaceSymbol Symbol
std::unique_ptr< Statistics > mStatistics
virtual bool Process(EffectInstance &instance, EffectSettings &settings)=0
Holds a msgid for the translation catalog; may also bind format arguments.
Externalized state of a plug-in.