Audacity 3.2.0
WahWahBase.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 Wahwah
6
7 Nasca Octavian Paul (Paul Nasca)
8
9**********************************************************************/
10#pragma once
11
12#include "PerTrackEffect.h"
13#include "ShuttleAutomation.h"
14
16{
17public:
19 double depth;
20 double freqofs;
21 double phase;
22 double outgain;
23 double lfoskip;
24 unsigned long skipcount;
25 double xn1, xn2, yn1, yn2;
26 double b0, b1, b2, a0, a1, a2;
27};
28
30{
31 /* Parameters:
32 mFreq - LFO frequency
33 mPhase - LFO startphase in RADIANS - useful for stereo WahWah
34 mDepth - Wah depth
35 mRes - Resonance
36 mFreqOfs - Wah frequency offset
37 mOutGain - output gain
38
39 !!!!!!!!!!!!! IMPORTANT!!!!!!!!! :
40 mDepth and mFreqOfs should be from 0(min) to 1(max) !
41 mRes should be greater than 0 ! */
42
43 static constexpr double freqDefault = 1.5;
44 static constexpr double phaseDefault = 0.0;
45 static constexpr int depthDefault = 70;
46 static constexpr double resDefault = 2.5;
47 static constexpr int freqOfsDefault = 30;
48 static constexpr double outGainDefault = -6.0;
49
50 double mFreq { freqDefault };
51 double mPhase { phaseDefault };
53 double mRes { resDefault };
56};
57
58class BUILTIN_EFFECTS_API WahWahBase :
59 public EffectWithSettings<EffectWahwahSettings, PerTrackEffect>
60{
61public:
63
64 WahWahBase();
65 virtual ~WahWahBase();
66
67 // ComponentInterface implementation
68
69 ComponentInterfaceSymbol GetSymbol() const override;
70 TranslatableString GetDescription() const override;
71 ManualPageID ManualPage() const override;
72
73 // EffectDefinitionInterface implementation
74
75 EffectType GetType() const override;
76 RealtimeSince RealtimeSupport() const override;
77
78 // Effect implementation
79
80 struct BUILTIN_EFFECTS_API Instance :
83 {
84 explicit Instance(const PerTrackEffect& effect)
85 : PerTrackEffect::Instance { effect }
86 {
87 }
88
89 bool ProcessInitialize(
91 ChannelNames chanMap) override;
92
93 size_t ProcessBlock(
94 EffectSettings& settings, const float* const* inBlock,
95 float* const* outBlock, size_t blockLen) override;
96
97 // bool ProcessFinalize() noexcept override;
98
99 bool RealtimeInitialize(EffectSettings& settings, double) override;
100
101 bool RealtimeAddProcessor(
103 unsigned numChannels, float sampleRate) override;
104
105 bool RealtimeFinalize(EffectSettings& settings) noexcept override;
106
107 size_t RealtimeProcess(
108 size_t group, EffectSettings& settings, const float* const* inbuf,
109 float* const* outbuf, size_t numSamples) override;
110
111 void InstanceInit(
113
114 size_t InstanceProcess(
116 const float* const* inBlock, float* const* outBlock, size_t blockLen);
117
118 unsigned GetAudioInCount() const override;
119 unsigned GetAudioOutCount() const override;
120
122 std::vector<WahWahBase::Instance> mSlaves;
123 };
124
125 std::shared_ptr<EffectInstance> MakeInstance() const override;
126
127protected:
128 // WahWahBase implementation
129
130 const EffectParameterMethods& Parameters() const override;
131
133 L"Freq",
135 0.1,
136 4.0,
137 10 };
139 L"Phase",
141 0.0,
142 360.0,
143 1 };
144 static constexpr EffectParameter Depth {
146 L"Depth",
148 0,
149 100,
150 1
151 }; // scaled to 0-1 before processing
153 L"Resonance",
155 0.1,
156 10.0,
157 10 };
158 static constexpr EffectParameter FreqOfs {
160 L"Offset",
162 0,
163 100,
164 1
165 }; // scaled to 0-1 before processing
166 static constexpr EffectParameter OutGain {
168 L"Gain",
170 -30.0,
171 30.0,
172 1
173 };
174};
EffectType
ChannelName
static Settings & settings()
Definition: TrackInfo.cpp:51
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.
unsigned long skipcount
Definition: WahWahBase.h:24
Base class for many of the effects in Audacity.
Holds a msgid for the translation catalog; may also bind format arguments.
static const ComponentInterfaceSymbol Symbol
Definition: WahWahBase.h:62
Externalized state of a plug-in.
static constexpr int depthDefault
Definition: WahWahBase.h:45
static constexpr int freqOfsDefault
Definition: WahWahBase.h:47
static constexpr double outGainDefault
Definition: WahWahBase.h:48
static constexpr double resDefault
Definition: WahWahBase.h:46
static constexpr double freqDefault
Definition: WahWahBase.h:43
static constexpr double phaseDefault
Definition: WahWahBase.h:44
std::vector< WahWahBase::Instance > mSlaves
Definition: WahWahBase.h:122
Instance(const PerTrackEffect &effect)
Definition: WahWahBase.h:84
EffectWahwahState mState
Definition: WahWahBase.h:121