Audacity 3.2.0
Phaser.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 Phaser
6
7 Effect programming:
8 Nasca Octavian Paul (Paul Nasca)
9
10 UI programming:
11 Dominic Mazzoni (with the help of wxDesigner)
12 Vaughan Johnson (Preview)
13
14**********************************************************************/
15
16#ifndef __AUDACITY_EFFECT_PHASER__
17#define __AUDACITY_EFFECT_PHASER__
18
20#include "ShuttleAutomation.h"
21
22class ShuttleGui;
23
24#define NUM_STAGES 24
25
27{
28public:
29 // state variables
32 double old[NUM_STAGES]; // must be as large as MAX_STAGES
33 double gain;
34 double fbout;
35 double outgain;
36 double lfoskip;
37 double phase;
39};
40
41
43{
44 /*
45 Phaser Parameters
46
47 mFreq - Phaser's LFO frequency
48 mPhase - Phaser's LFO startphase (radians), needed for stereo Phasers
49 mDepth - Phaser depth (0 - no depth, 255 - max depth)
50 mStages - Phaser stages (recomanded from 2 to 16-24, and EVEN NUMBER)
51 mDryWet - Dry/wet mix, (0 - dry, 128 - dry=wet, 255 - wet)
52 mFeedback - Phaser FeedBack (0 - no feedback, 100 = 100% Feedback,
53 -100 = -100% FeedBack)
54 */
55
56 static constexpr int stagesDefault = 2;
57 static constexpr int dryWetDefault = 128;
58 static constexpr double freqDefault = 0.4;
59 static constexpr double phaseDefault = 0.0;
60 static constexpr int depthDefault = 100;
61 static constexpr int feedbackDefault = 0;
62 static constexpr double outGainDefault = -6.0;
63
66 double mFreq { freqDefault };
67 double mPhase { phaseDefault };
71};
72
73class EffectPhaser final : public EffectWithSettings<
74 EffectPhaserSettings, StatelessPerTrackEffect
75>
76{
77public:
78
80
82 virtual ~EffectPhaser();
83
84 // ComponentInterface implementation
85
86 ComponentInterfaceSymbol GetSymbol() const override;
87 TranslatableString GetDescription() const override;
88 ManualPageID ManualPage() const override;
89
90 // EffectDefinitionInterface implementation
91
92 EffectType GetType() const override;
93 RealtimeSince RealtimeSupport() const override;
94
95
96 // Effect implementation
97
98 std::unique_ptr<EffectEditor> MakeEditor(
99 ShuttleGui & S, EffectInstance &instance,
100 EffectSettingsAccess &access, const EffectOutputs *pOutputs)
101 const override;
102
103 struct Editor;
104
105private:
106 // EffectPhaser implementation
107
108 struct Instance;
109
110 std::shared_ptr<EffectInstance> MakeInstance() const override;
111
112 const EffectParameterMethods& Parameters() const override;
113
114static constexpr EffectParameter Stages
117
118static constexpr EffectParameter DryWet
121
122static constexpr EffectParameter Freq
124 EffectPhaserSettings::freqDefault, 0.001, 4.0, 10.0 };
125
126static constexpr EffectParameter Phase
128 EffectPhaserSettings::phaseDefault, 0.0, 360.0, 1 };
129
130static constexpr EffectParameter Depth
133
134static constexpr EffectParameter Feedback
135{ &EffectPhaserSettings::mFeedback, L"Feedback",
137
138static constexpr EffectParameter OutGain
140 EffectPhaserSettings::outGainDefault, -30.0, 30.0, 1 };
141};
142
143#endif
EffectType
#define NUM_STAGES
Definition: Phaser.h:24
#define S(N)
Definition: ToChars.cpp:64
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
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.
An Effect that changes frequencies in a time varying manner.
Definition: Phaser.h:76
static constexpr EffectParameter Feedback
Definition: Phaser.h:135
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: Phaser.cpp:281
static constexpr EffectParameter DryWet
Definition: Phaser.h:119
static constexpr EffectParameter Stages
Definition: Phaser.h:115
static constexpr EffectParameter Phase
Definition: Phaser.h:127
std::shared_ptr< EffectInstance > MakeInstance() const override
Make an object maintaining short-term state of an Effect.
Definition: Phaser.cpp:176
static const ComponentInterfaceSymbol Symbol
Definition: Phaser.h:79
RealtimeSince RealtimeSupport() const override
Since which version of Audacity has the effect supported realtime?
Definition: Phaser.cpp:216
static constexpr EffectParameter Depth
Definition: Phaser.h:131
static constexpr EffectParameter Freq
Definition: Phaser.h:123
const EffectParameterMethods & Parameters() const override
Definition: Phaser.cpp:32
virtual ~EffectPhaser()
Definition: Phaser.cpp:188
TranslatableString GetDescription() const override
Definition: Phaser.cpp:199
ComponentInterfaceSymbol GetSymbol() const override
Definition: Phaser.cpp:194
EffectType GetType() const override
Type determines how it behaves.
Definition: Phaser.cpp:211
static constexpr EffectParameter OutGain
Definition: Phaser.h:139
ManualPageID ManualPage() const override
Name of a page in the Audacity alpha manual, default is empty.
Definition: Phaser.cpp:204
double outgain
Definition: Phaser.h:35
double lfoskip
Definition: Phaser.h:36
double fbout
Definition: Phaser.h:34
double gain
Definition: Phaser.h:33
double phase
Definition: Phaser.h:37
double old[NUM_STAGES]
Definition: Phaser.h:32
float samplerate
Definition: Phaser.h:30
sampleCount skipcount
Definition: Phaser.h:31
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.
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:19
static constexpr int depthDefault
Definition: Phaser.h:60
static constexpr int stagesDefault
Definition: Phaser.h:56
static constexpr double outGainDefault
Definition: Phaser.h:62
static constexpr double phaseDefault
Definition: Phaser.h:59
static constexpr int dryWetDefault
Definition: Phaser.h:57
static constexpr int feedbackDefault
Definition: Phaser.h:61
static constexpr double freqDefault
Definition: Phaser.h:58