1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-16 08:34:10 +02:00
audacity/src/effects/Wahwah.h
Paul Licameli 7824e94030 Harmlessly qualify classes as final (or explicitly comment not)...
... Should have no effect on generated code, except perhaps some slight faster
virtual function calls.  Mostly useful as documentation of design intent.

Tried to mark every one of our classes that inherits from another, or is a
base for others, or has abstract virtual functions, and a few others besides.
2016-02-24 20:58:30 -05:00

146 lines
3.7 KiB
C++

/**********************************************************************
Audacity: A Digital Audio Editor
Wahwah
Effect programming:
Nasca Octavian Paul (Paul Nasca)
UI programming:
Dominic Mazzoni (with the help of wxDesigner)
Vaughan Johnson (Preview)
**********************************************************************/
#ifndef __AUDACITY_EFFECT_WAHWAH__
#define __AUDACITY_EFFECT_WAHWAH__
#include <wx/event.h>
#include <wx/slider.h>
#include <wx/string.h>
#include <wx/textctrl.h>
#include "Effect.h"
class ShuttleGui;
#define WAHWAH_PLUGIN_SYMBOL XO("Wahwah")
class EffectWahwahState
{
public:
float samplerate;
double depth;
double freqofs;
double phase;
double outgain;
double lfoskip;
unsigned long skipcount;
double xn1, xn2, yn1, yn2;
double b0, b1, b2, a0, a1, a2;
};
WX_DECLARE_OBJARRAY(EffectWahwahState, EffectWahwahStateArray);
class EffectWahwah final : public Effect
{
public:
EffectWahwah();
virtual ~EffectWahwah();
// IdentInterface implementation
virtual wxString GetSymbol();
virtual wxString GetDescription();
// EffectIdentInterface implementation
virtual EffectType GetType();
virtual bool SupportsRealtime();
// EffectClientInterface implementation
virtual int GetAudioInCount();
virtual int GetAudioOutCount();
virtual bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL);
virtual sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen);
virtual bool RealtimeInitialize();
virtual bool RealtimeAddProcessor(int numChannels, float sampleRate);
virtual bool RealtimeFinalize();
virtual sampleCount RealtimeProcess(int group,
float **inbuf,
float **outbuf,
sampleCount numSamples);
virtual bool GetAutomationParameters(EffectAutomationParameters & parms);
virtual bool SetAutomationParameters(EffectAutomationParameters & parms);
// Effect implementation
virtual void PopulateOrExchange(ShuttleGui & S);
virtual bool TransferDataToWindow();
virtual bool TransferDataFromWindow();
private:
// EffectWahwah implementation
void InstanceInit(EffectWahwahState & data, float sampleRate);
sampleCount InstanceProcess(EffectWahwahState & data, float **inBlock, float **outBlock, sampleCount blockLen);
void OnFreqSlider(wxCommandEvent & evt);
void OnPhaseSlider(wxCommandEvent & evt);
void OnDepthSlider(wxCommandEvent & evt);
void OnResonanceSlider(wxCommandEvent & evt);
void OnFreqOffSlider(wxCommandEvent & evt);
void OnGainSlider(wxCommandEvent & evt);
void OnFreqText(wxCommandEvent & evt);
void OnPhaseText(wxCommandEvent & evt);
void OnDepthText(wxCommandEvent & evt);
void OnResonanceText(wxCommandEvent & evt);
void OnFreqOffText(wxCommandEvent & evt);
void OnGainText(wxCommandEvent & evt);
private:
EffectWahwahState mMaster;
EffectWahwahStateArray mSlaves;
/* Parameters:
mFreq - LFO frequency
mPhase - LFO startphase in RADIANS - useful for stereo WahWah
mDepth - Wah depth
mRes - Resonance
mFreqOfs - Wah frequency offset
mOutGain - output gain
!!!!!!!!!!!!! IMPORTANT!!!!!!!!! :
mDepth and mFreqOfs should be from 0(min) to 1(max) !
mRes should be greater than 0 ! */
double mFreq;
double mPhase;
int mDepth;
double mRes;
int mFreqOfs;
double mOutGain;
wxTextCtrl *mFreqT;
wxTextCtrl *mPhaseT;
wxTextCtrl *mDepthT;
wxTextCtrl *mResT;
wxTextCtrl *mFreqOfsT;
wxTextCtrl *mOutGainT;
wxSlider *mFreqS;
wxSlider *mPhaseS;
wxSlider *mDepthS;
wxSlider *mResS;
wxSlider *mFreqOfsS;
wxSlider *mOutGainS;
DECLARE_EVENT_TABLE();
};
#endif