Audacity  3.0.3
Wahwah.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  Wahwah
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_WAHWAH__
17 #define __AUDACITY_EFFECT_WAHWAH__
18 
19 #include "Effect.h"
20 
21 class wxSlider;
22 class wxTextCtrl;
23 class ShuttleGui;
24 
26 {
27 public:
28  float samplerate;
29  double depth;
30  double freqofs;
31  double phase;
32  double outgain;
33  double lfoskip;
34  unsigned long skipcount;
35  double xn1, xn2, yn1, yn2;
36  double b0, b1, b2, a0, a1, a2;
37 };
38 
39 class EffectWahwah final : public Effect
40 {
41 public:
43 
44  EffectWahwah();
45  virtual ~EffectWahwah();
46 
47  // ComponentInterface implementation
48 
51  ManualPageID ManualPage() override;
52 
53  // EffectDefinitionInterface implementation
54 
55  EffectType GetType() override;
56  bool SupportsRealtime() override;
57 
58  // EffectClientInterface implementation
59 
60  unsigned GetAudioInCount() override;
61  unsigned GetAudioOutCount() override;
62  bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
63  size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
64  bool RealtimeInitialize() override;
65  bool RealtimeAddProcessor(unsigned numChannels, float sampleRate) override;
66  bool RealtimeFinalize() override;
67  size_t RealtimeProcess(int group,
68  float **inbuf,
69  float **outbuf,
70  size_t numSamples) override;
71  bool DefineParams( ShuttleParams & S ) override;
72  bool GetAutomationParameters(CommandParameters & parms) override;
73  bool SetAutomationParameters(CommandParameters & parms) override;
74 
75  // Effect implementation
76 
77  void PopulateOrExchange(ShuttleGui & S) override;
78  bool TransferDataToWindow() override;
79  bool TransferDataFromWindow() override;
80 
81 private:
82  // EffectWahwah implementation
83 
84  void InstanceInit(EffectWahwahState & data, float sampleRate);
85  size_t InstanceProcess(EffectWahwahState & data, float **inBlock, float **outBlock, size_t blockLen);
86 
87  void OnFreqSlider(wxCommandEvent & evt);
88  void OnPhaseSlider(wxCommandEvent & evt);
89  void OnDepthSlider(wxCommandEvent & evt);
90  void OnResonanceSlider(wxCommandEvent & evt);
91  void OnFreqOffSlider(wxCommandEvent & evt);
92  void OnGainSlider(wxCommandEvent & evt);
93 
94  void OnFreqText(wxCommandEvent & evt);
95  void OnPhaseText(wxCommandEvent & evt);
96  void OnDepthText(wxCommandEvent & evt);
97  void OnResonanceText(wxCommandEvent & evt);
98  void OnFreqOffText(wxCommandEvent & evt);
99  void OnGainText(wxCommandEvent & evt);
100 
101 private:
103  std::vector<EffectWahwahState> mSlaves;
104 
105  /* Parameters:
106  mFreq - LFO frequency
107  mPhase - LFO startphase in RADIANS - useful for stereo WahWah
108  mDepth - Wah depth
109  mRes - Resonance
110  mFreqOfs - Wah frequency offset
111  mOutGain - output gain
112 
113  !!!!!!!!!!!!! IMPORTANT!!!!!!!!! :
114  mDepth and mFreqOfs should be from 0(min) to 1(max) !
115  mRes should be greater than 0 ! */
116 
117  double mFreq;
118  double mPhase;
119  int mDepth;
120  double mRes;
121  int mFreqOfs;
122  double mOutGain;
123 
124  wxTextCtrl *mFreqT;
125  wxTextCtrl *mPhaseT;
126  wxTextCtrl *mDepthT;
127  wxTextCtrl *mResT;
128  wxTextCtrl *mFreqOfsT;
129  wxTextCtrl *mOutGainT;
130 
131  wxSlider *mFreqS;
132  wxSlider *mPhaseS;
133  wxSlider *mDepthS;
134  wxSlider *mResS;
135  wxSlider *mFreqOfsS;
136  wxSlider *mOutGainS;
137 
138  DECLARE_EVENT_TABLE()
139 };
140 
141 #endif
142 
EffectWahwah::mSlaves
std::vector< EffectWahwahState > mSlaves
Definition: Wahwah.h:103
EffectWahwah
An Effect that adds a 'spectral glide'.
Definition: Wahwah.h:40
EffectWahwah::OnFreqSlider
void OnFreqSlider(wxCommandEvent &evt)
Definition: Wahwah.cpp:415
EffectWahwah::mFreqOfsT
wxTextCtrl * mFreqOfsT
Definition: Wahwah.h:128
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
CommandParameters
CommandParameters, derived from wxFileConfig, is essentially doing the same things as the Shuttle cla...
Definition: EffectAutomationParameters.h:67
EffectWahwah::mOutGain
double mOutGain
Definition: Wahwah.h:122
Effect.h
EffectWahwah::RealtimeProcess
size_t RealtimeProcess(int group, float **inbuf, float **outbuf, size_t numSamples) override
Definition: Wahwah.cpp:186
EffectWahwahState::samplerate
float samplerate
Definition: Wahwah.h:28
EffectWahwah::RealtimeFinalize
bool RealtimeFinalize() override
Definition: Wahwah.cpp:179
EffectWahwah::OnFreqOffSlider
void OnFreqOffSlider(wxCommandEvent &evt)
Definition: Wahwah.cpp:446
Effect
Base class for many of the effects in Audacity.
Definition: Effect.h:72
EffectWahwah::OnResonanceText
void OnResonanceText(wxCommandEvent &evt)
Definition: Wahwah.cpp:490
EffectWahwah::OnFreqOffText
void OnFreqOffText(wxCommandEvent &evt)
Definition: Wahwah.cpp:500
EffectWahwah::RealtimeInitialize
bool RealtimeInitialize() override
Definition: Wahwah.cpp:159
EffectWahwahState::depth
double depth
Definition: Wahwah.h:29
EffectWahwah::mResT
wxTextCtrl * mResT
Definition: Wahwah.h:127
EffectWahwahState::b1
double b1
Definition: Wahwah.h:36
EffectWahwah::ProcessBlock
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override
Definition: Wahwah.cpp:154
EffectWahwah::PopulateOrExchange
void PopulateOrExchange(ShuttleGui &S) override
Definition: Wahwah.cpp:238
EffectWahwah::mDepth
int mDepth
Definition: Wahwah.h:119
ShuttleParams
Shuttle that deals with parameters. This is a base class with lots of virtual functions that do nothi...
Definition: Shuttle.h:62
EffectWahwahState::a2
double a2
Definition: Wahwah.h:36
EffectWahwahState::freqofs
double freqofs
Definition: Wahwah.h:30
EffectWahwah::mDepthS
wxSlider * mDepthS
Definition: Wahwah.h:133
EffectWahwah::mPhaseS
wxSlider * mPhaseS
Definition: Wahwah.h:132
ComponentInterfaceSymbol
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Definition: ComponentInterfaceSymbol.h:27
EffectWahwah::EffectWahwah
EffectWahwah()
Definition: Wahwah.cpp:81
EffectWahwah::RealtimeAddProcessor
bool RealtimeAddProcessor(unsigned numChannels, float sampleRate) override
Definition: Wahwah.cpp:168
EffectWahwah::SupportsRealtime
bool SupportsRealtime() override
Definition: Wahwah.cpp:121
EffectWahwahState::b2
double b2
Definition: Wahwah.h:36
EffectWahwahState::skipcount
unsigned long skipcount
Definition: Wahwah.h:34
EffectWahwah::mPhaseT
wxTextCtrl * mPhaseT
Definition: Wahwah.h:125
EffectWahwahState::outgain
double outgain
Definition: Wahwah.h:32
EffectWahwah::mOutGainS
wxSlider * mOutGainS
Definition: Wahwah.h:136
EffectWahwah::SetAutomationParameters
bool SetAutomationParameters(CommandParameters &parms) override
Definition: Wahwah.cpp:217
EffectWahwah::ManualPage
ManualPageID ManualPage() override
Definition: Wahwah.cpp:109
EffectWahwahState::phase
double phase
Definition: Wahwah.h:31
EffectWahwah::mFreqT
wxTextCtrl * mFreqT
Definition: Wahwah.h:124
EffectWahwah::GetSymbol
ComponentInterfaceSymbol GetSymbol() override
Definition: Wahwah.cpp:99
EffectWahwah::DefineParams
bool DefineParams(ShuttleParams &S) override
Definition: Wahwah.cpp:195
EffectWahwah::mRes
double mRes
Definition: Wahwah.h:120
EffectWahwah::OnDepthSlider
void OnDepthSlider(wxCommandEvent &evt)
Definition: Wahwah.cpp:432
EffectWahwah::OnGainText
void OnGainText(wxCommandEvent &evt)
Definition: Wahwah.cpp:510
EffectWahwah::GetAudioOutCount
unsigned GetAudioOutCount() override
Definition: Wahwah.cpp:137
EffectWahwah::mFreqOfsS
wxSlider * mFreqOfsS
Definition: Wahwah.h:135
EffectWahwah::GetAudioInCount
unsigned GetAudioInCount() override
Definition: Wahwah.cpp:132
EffectWahwahState::xn2
double xn2
Definition: Wahwah.h:35
EffectWahwahState::yn1
double yn1
Definition: Wahwah.h:35
ChannelNames
enum ChannelName * ChannelNames
EffectWahwah::ProcessInitialize
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap=NULL) override
Definition: Wahwah.cpp:142
EffectWahwahState::lfoskip
double lfoskip
Definition: Wahwah.h:33
EffectWahwah::OnGainSlider
void OnGainSlider(wxCommandEvent &evt)
Definition: Wahwah.cpp:453
EffectWahwah::mDepthT
wxTextCtrl * mDepthT
Definition: Wahwah.h:126
EffectWahwah::mFreqOfs
int mFreqOfs
Definition: Wahwah.h:121
EffectWahwah::TransferDataToWindow
bool TransferDataToWindow() override
Definition: Wahwah.cpp:317
EffectWahwah::mFreqS
wxSlider * mFreqS
Definition: Wahwah.h:131
EffectWahwah::mMaster
EffectWahwahState mMaster
Definition: Wahwah.h:102
TaggedIdentifier< ManualPageIDTag >
EffectWahwah::Symbol
static const ComponentInterfaceSymbol Symbol
Definition: Wahwah.h:42
sampleCount
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:18
EffectWahwah::OnResonanceSlider
void OnResonanceSlider(wxCommandEvent &evt)
Definition: Wahwah.cpp:439
EffectWahwah::GetAutomationParameters
bool GetAutomationParameters(CommandParameters &parms) override
Definition: Wahwah.cpp:205
EffectWahwahState::a1
double a1
Definition: Wahwah.h:36
EffectWahwah::OnFreqText
void OnFreqText(wxCommandEvent &evt)
Definition: Wahwah.cpp:460
EffectWahwahState::xn1
double xn1
Definition: Wahwah.h:35
EffectWahwah::OnPhaseText
void OnPhaseText(wxCommandEvent &evt)
Definition: Wahwah.cpp:470
EffectWahwah::mResS
wxSlider * mResS
Definition: Wahwah.h:134
EffectWahwah::InstanceInit
void InstanceInit(EffectWahwahState &data, float sampleRate)
Definition: Wahwah.cpp:346
EffectWahwahState::a0
double a0
Definition: Wahwah.h:36
EffectWahwah::TransferDataFromWindow
bool TransferDataFromWindow() override
Definition: Wahwah.cpp:334
EffectWahwahState::yn2
double yn2
Definition: Wahwah.h:35
EffectWahwah::GetDescription
TranslatableString GetDescription() override
Definition: Wahwah.cpp:104
EffectWahwah::mOutGainT
wxTextCtrl * mOutGainT
Definition: Wahwah.h:129
EffectType
EffectType
Definition: EffectInterface.h:55
EffectWahwah::mFreq
double mFreq
Definition: Wahwah.h:117
EffectWahwah::GetType
EffectType GetType() override
Definition: Wahwah.cpp:116
EffectWahwahState::b0
double b0
Definition: Wahwah.h:36
EffectWahwah::mPhase
double mPhase
Definition: Wahwah.h:118
EffectWahwahState
Definition: Wahwah.h:26
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631
EffectWahwah::InstanceProcess
size_t InstanceProcess(EffectWahwahState &data, float **inBlock, float **outBlock, size_t blockLen)
Definition: Wahwah.cpp:368
EffectWahwah::~EffectWahwah
virtual ~EffectWahwah()
Definition: Wahwah.cpp:93
EffectWahwah::OnDepthText
void OnDepthText(wxCommandEvent &evt)
Definition: Wahwah.cpp:480
EffectWahwah::OnPhaseSlider
void OnPhaseSlider(wxCommandEvent &evt)
Definition: Wahwah.cpp:422