2010-01-23 19:44:49 +00:00
|
|
|
/**********************************************************************
|
|
|
|
|
|
|
|
Audacity: A Digital Audio Editor
|
|
|
|
|
|
|
|
Wahwah.cpp
|
|
|
|
|
|
|
|
Effect programming:
|
2013-06-21 22:23:47 +00:00
|
|
|
Nasca Octavian Paul (Paul Nasca)
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
UI programming:
|
|
|
|
Dominic Mazzoni (with the help of wxDesigner)
|
|
|
|
Vaughan Johnson (Preview)
|
|
|
|
|
|
|
|
*******************************************************************//**
|
|
|
|
|
|
|
|
\class EffectWahwah
|
2015-05-09 16:36:54 +00:00
|
|
|
\brief An Effect that adds a 'spectral glide'.
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
*//*******************************************************************/
|
|
|
|
|
|
|
|
#include "../Audacity.h"
|
2015-06-18 14:24:36 +00:00
|
|
|
#include "Wahwah.h"
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
#include <wx/intl.h>
|
2015-04-17 03:53:42 +00:00
|
|
|
|
2015-06-18 14:24:36 +00:00
|
|
|
#include "../ShuttleGui.h"
|
2015-04-17 03:53:42 +00:00
|
|
|
#include "../widgets/valnum.h"
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
ID_Freq = 10000,
|
|
|
|
ID_Phase,
|
|
|
|
ID_Depth,
|
|
|
|
ID_Res,
|
|
|
|
ID_FreqOfs
|
|
|
|
};
|
|
|
|
|
|
|
|
// Define keys, defaults, minimums, and maximums for the effect parameters
|
|
|
|
//
|
2015-04-19 03:49:05 +00:00
|
|
|
// Name Type Key Def Min Max Scale
|
|
|
|
Param( Freq, double, XO("Freq"), 1.5, 0.1, 4.0, 10 );
|
|
|
|
Param( Phase, double, XO("Phase"), 0.0, 0.0, 359.0, 1 );
|
|
|
|
Param( Depth, int, XO("Depth"), 70, 0, 100, 1 ); // scaled to 0-1 before processing
|
|
|
|
Param( Res, double, XO("Resonance"), 2.5, 0.1, 10.0, 10 );
|
|
|
|
Param( FreqOfs, int, XO("Offset"), 30, 0, 100, 1 ); // scaled to 0-1 before processing
|
2015-04-17 03:53:42 +00:00
|
|
|
|
|
|
|
// How many samples are processed before recomputing the lfo value again
|
|
|
|
#define lfoskipsamples 30
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-08-01 12:03:02 +00:00
|
|
|
#include <wx/arrimpl.cpp>
|
|
|
|
WX_DEFINE_OBJARRAY(EffectWahwahStateArray);
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
//
|
|
|
|
// EffectWahwah
|
|
|
|
//
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
BEGIN_EVENT_TABLE(EffectWahwah, wxEvtHandler)
|
|
|
|
EVT_SLIDER(ID_Freq, EffectWahwah::OnFreqSlider)
|
|
|
|
EVT_SLIDER(ID_Phase, EffectWahwah::OnPhaseSlider)
|
|
|
|
EVT_SLIDER(ID_Depth, EffectWahwah::OnDepthSlider)
|
|
|
|
EVT_SLIDER(ID_Res, EffectWahwah::OnResonanceSlider)
|
|
|
|
EVT_SLIDER(ID_FreqOfs, EffectWahwah::OnFreqOffSlider)
|
|
|
|
EVT_TEXT(ID_Freq, EffectWahwah::OnFreqText)
|
|
|
|
EVT_TEXT(ID_Phase, EffectWahwah::OnPhaseText)
|
|
|
|
EVT_TEXT(ID_Depth, EffectWahwah::OnDepthText)
|
|
|
|
EVT_TEXT(ID_Res, EffectWahwah::OnResonanceText)
|
|
|
|
EVT_TEXT(ID_FreqOfs, EffectWahwah::OnFreqOffText)
|
|
|
|
END_EVENT_TABLE();
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
EffectWahwah::EffectWahwah()
|
|
|
|
{
|
2015-04-17 03:53:42 +00:00
|
|
|
mFreq = DEF_Freq;
|
|
|
|
mPhase = DEF_Phase;
|
|
|
|
mDepth = DEF_Depth;
|
|
|
|
mRes = DEF_Res;
|
|
|
|
mFreqOfs = DEF_FreqOfs;
|
2015-05-15 11:47:51 +00:00
|
|
|
|
|
|
|
SetLinearEffectFlag(true);
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
EffectWahwah::~EffectWahwah()
|
|
|
|
{
|
2014-06-03 20:30:19 +00:00
|
|
|
}
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// IdentInterface implementation
|
|
|
|
|
|
|
|
wxString EffectWahwah::GetSymbol()
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2015-04-17 03:53:42 +00:00
|
|
|
return WAHWAH_PLUGIN_SYMBOL;
|
|
|
|
}
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
wxString EffectWahwah::GetDescription()
|
|
|
|
{
|
2015-04-19 03:49:05 +00:00
|
|
|
return XO("Rapid tone quality variations, like that guitar sound so popular in the 1970's");
|
2015-04-17 03:53:42 +00:00
|
|
|
}
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// EffectIdentInterface implementation
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
EffectType EffectWahwah::GetType()
|
|
|
|
{
|
|
|
|
return EffectTypeProcess;
|
|
|
|
}
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-08-01 12:03:02 +00:00
|
|
|
bool EffectWahwah::SupportsRealtime()
|
|
|
|
{
|
|
|
|
#if defined(EXPERIMENTAL_REALTIME_AUDACITY_EFFECTS)
|
|
|
|
return true;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// EffectClientInterface implementation
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
int EffectWahwah::GetAudioInCount()
|
|
|
|
{
|
|
|
|
return 1;
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
int EffectWahwah::GetAudioOutCount()
|
2014-06-03 20:30:19 +00:00
|
|
|
{
|
2015-04-17 03:53:42 +00:00
|
|
|
return 1;
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
bool EffectWahwah::ProcessInitialize(sampleCount WXUNUSED(totalLen), ChannelNames chanMap)
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2015-08-01 12:03:02 +00:00
|
|
|
InstanceInit(mMaster, mSampleRate);
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
if (chanMap[0] == ChannelNameFrontRight)
|
|
|
|
{
|
2015-08-01 12:03:02 +00:00
|
|
|
mMaster.phase += M_PI;
|
2015-04-17 03:53:42 +00:00
|
|
|
}
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
sampleCount EffectWahwah::ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen)
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2015-08-01 12:03:02 +00:00
|
|
|
return InstanceProcess(mMaster, inBlock, outBlock, blockLen);
|
|
|
|
}
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-08-01 12:03:02 +00:00
|
|
|
bool EffectWahwah::RealtimeInitialize()
|
|
|
|
{
|
|
|
|
SetBlockSize(512);
|
2014-06-03 20:30:19 +00:00
|
|
|
|
2015-08-01 12:03:02 +00:00
|
|
|
mSlaves.Clear();
|
2014-06-03 20:30:19 +00:00
|
|
|
|
2015-08-01 12:03:02 +00:00
|
|
|
return true;
|
|
|
|
}
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-08-01 12:03:02 +00:00
|
|
|
bool EffectWahwah::RealtimeAddProcessor(int WXUNUSED(numChannels), float sampleRate)
|
|
|
|
{
|
|
|
|
EffectWahwahState slave;
|
|
|
|
|
|
|
|
InstanceInit(slave, sampleRate);
|
|
|
|
|
|
|
|
mSlaves.Add(slave);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool EffectWahwah::RealtimeFinalize()
|
|
|
|
{
|
|
|
|
mSlaves.Clear();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
sampleCount EffectWahwah::RealtimeProcess(int group,
|
|
|
|
float **inbuf,
|
|
|
|
float **outbuf,
|
|
|
|
sampleCount numSamples)
|
|
|
|
{
|
|
|
|
|
|
|
|
return InstanceProcess(mSlaves[group], inbuf, outbuf, numSamples);
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
bool EffectWahwah::GetAutomationParameters(EffectAutomationParameters & parms)
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2015-04-17 03:53:42 +00:00
|
|
|
parms.Write(KEY_Freq, mFreq);
|
|
|
|
parms.Write(KEY_Phase, mPhase);
|
|
|
|
parms.Write(KEY_Depth, mDepth);
|
|
|
|
parms.Write(KEY_Res, mRes);
|
|
|
|
parms.Write(KEY_FreqOfs, mFreqOfs);
|
|
|
|
|
|
|
|
return true;
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
bool EffectWahwah::SetAutomationParameters(EffectAutomationParameters & parms)
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2015-04-17 03:53:42 +00:00
|
|
|
ReadAndVerifyDouble(Freq);
|
|
|
|
ReadAndVerifyDouble(Phase);
|
|
|
|
ReadAndVerifyInt(Depth);
|
|
|
|
ReadAndVerifyDouble(Res);
|
|
|
|
ReadAndVerifyInt(FreqOfs);
|
|
|
|
|
|
|
|
mFreq = Freq;
|
|
|
|
mPhase = Phase;
|
|
|
|
mDepth = Depth;
|
|
|
|
mRes = Res;
|
|
|
|
mFreqOfs = FreqOfs;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Effect implementation
|
2013-06-21 22:10:50 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
void EffectWahwah::PopulateOrExchange(ShuttleGui & S)
|
|
|
|
{
|
2010-01-23 19:44:49 +00:00
|
|
|
S.SetBorder(5);
|
2013-06-21 22:10:50 +00:00
|
|
|
S.AddSpace(0, 5);
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
S.StartMultiColumn(3, wxEXPAND);
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2015-04-17 03:53:42 +00:00
|
|
|
S.SetStretchyCol(2);
|
|
|
|
|
2015-07-20 15:29:26 +00:00
|
|
|
FloatingPointValidator<double> vldfreq(5, &mFreq, NUM_VAL_ONE_TRAILING_ZERO);
|
2015-04-17 03:53:42 +00:00
|
|
|
vldfreq.SetRange(MIN_Freq, MAX_Freq);
|
|
|
|
mFreqT = S.Id(ID_Freq).AddTextBox(_("LFO Frequency (Hz):"), wxT(""), 12);
|
|
|
|
mFreqT->SetValidator(vldfreq);
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
S.SetStyle(wxSL_HORIZONTAL);
|
2015-04-17 03:53:42 +00:00
|
|
|
mFreqS = S.Id(ID_Freq).AddSlider(wxT(""), DEF_Freq * SCL_Freq, MAX_Freq * SCL_Freq, MIN_Freq * SCL_Freq);
|
|
|
|
mFreqS->SetName(_("LFO frequency in hertz"));
|
|
|
|
mFreqS->SetMinSize(wxSize(100, -1));
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
FloatingPointValidator<double> vldphase(1, &mPhase);
|
|
|
|
vldphase.SetRange(MIN_Phase, MAX_Phase);
|
|
|
|
mPhaseT = S.Id(ID_Phase).AddTextBox(_("LFO Start Phase (deg.):"), wxT(""), 12);
|
|
|
|
mPhaseT->SetValidator(vldphase);
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
S.SetStyle(wxSL_HORIZONTAL);
|
2015-04-17 03:53:42 +00:00
|
|
|
mPhaseS = S.Id(ID_Phase).AddSlider(wxT(""), DEF_Phase * SCL_Phase, MAX_Phase * SCL_Phase, MIN_Phase * SCL_Phase);
|
|
|
|
mPhaseS->SetName(_("LFO start phase in degrees"));
|
|
|
|
mPhaseS->SetLineSize(10);
|
|
|
|
mPhaseS->SetMinSize(wxSize(100, -1));
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
IntegerValidator<int> vlddepth(&mDepth);
|
|
|
|
vlddepth.SetRange(MIN_Depth, MAX_Depth);
|
|
|
|
mDepthT = S.Id(ID_Depth).AddTextBox(_("Depth (%):"), wxT(""), 12);
|
|
|
|
mDepthT->SetValidator(vlddepth);
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
S.SetStyle(wxSL_HORIZONTAL);
|
2015-04-17 03:53:42 +00:00
|
|
|
mDepthS = S.Id(ID_Depth).AddSlider(wxT(""), DEF_Depth * SCL_Depth, MAX_Depth * SCL_Depth, MIN_Depth * SCL_Depth);
|
|
|
|
mDepthS->SetName(_("Depth in percent"));
|
|
|
|
mDepthS->SetMinSize(wxSize(100, -1));
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
FloatingPointValidator<double> vldres(1, &mRes);
|
|
|
|
vldres.SetRange(MIN_Res, MAX_Res);
|
|
|
|
mResT = S.Id(ID_Res).AddTextBox(_("Resonance:"), wxT(""), 12);
|
|
|
|
mResT->SetValidator(vldres);
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
S.SetStyle(wxSL_HORIZONTAL);
|
2015-04-17 03:53:42 +00:00
|
|
|
mResS = S.Id(ID_Res).AddSlider(wxT(""), DEF_Res * SCL_Res, MAX_Res * SCL_Res, MIN_Res * SCL_Res);
|
|
|
|
mResS->SetName(_("Resonance"));
|
|
|
|
mResS->SetMinSize(wxSize(100, -1));
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
IntegerValidator<int> vldfreqoffset(&mFreqOfs);
|
|
|
|
vldfreqoffset.SetRange(MIN_FreqOfs, MAX_FreqOfs);
|
|
|
|
mFreqOfsT = S.Id(ID_FreqOfs).AddTextBox(_("Wah Frequency Offset (%):"), wxT(""), 12);
|
|
|
|
mFreqOfsT->SetValidator(vldfreqoffset);
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
S.SetStyle(wxSL_HORIZONTAL);
|
2015-04-17 03:53:42 +00:00
|
|
|
mFreqOfsS = S.Id(ID_FreqOfs).AddSlider(wxT(""), DEF_FreqOfs * SCL_FreqOfs, MAX_FreqOfs * SCL_FreqOfs, MIN_FreqOfs * SCL_FreqOfs);
|
|
|
|
mFreqOfsT->SetName(_("Wah frequency offset in percent"));
|
|
|
|
mFreqOfsT->SetMinSize(wxSize(100, -1));
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
S.EndMultiColumn();
|
|
|
|
}
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
bool EffectWahwah::TransferDataToWindow()
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2015-04-17 03:53:42 +00:00
|
|
|
if (!mUIParent->TransferDataToWindow())
|
|
|
|
{
|
|
|
|
return false;
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2015-04-23 07:04:06 +00:00
|
|
|
mFreqS->SetValue((int) (mFreq * SCL_Freq));
|
|
|
|
mPhaseS->SetValue((int) (mPhase * SCL_Phase));
|
|
|
|
mDepthS->SetValue((int) (mDepth * SCL_Depth));
|
|
|
|
mResS->SetValue((int) (mRes * SCL_Res));
|
|
|
|
mFreqOfsS->SetValue((int) (mFreqOfs * SCL_FreqOfs));
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
return true;
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
bool EffectWahwah::TransferDataFromWindow()
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2015-04-17 03:53:42 +00:00
|
|
|
if (!mUIParent->Validate() || !mUIParent->TransferDataFromWindow())
|
|
|
|
{
|
|
|
|
return false;
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
return true;
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// EffectWahwah implementation
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-08-01 12:03:02 +00:00
|
|
|
void EffectWahwah::InstanceInit(EffectWahwahState & data, float sampleRate)
|
|
|
|
{
|
|
|
|
data.samplerate = sampleRate;
|
|
|
|
data.lfoskip = mFreq * 2 * M_PI / sampleRate;
|
|
|
|
data.skipcount = 0;
|
|
|
|
data.xn1 = 0;
|
|
|
|
data.xn2 = 0;
|
|
|
|
data.yn1 = 0;
|
|
|
|
data.yn2 = 0;
|
|
|
|
data.b0 = 0;
|
|
|
|
data.b1 = 0;
|
|
|
|
data.b2 = 0;
|
|
|
|
data.a0 = 0;
|
|
|
|
data.a1 = 0;
|
|
|
|
data.a2 = 0;
|
|
|
|
|
|
|
|
data.depth = mDepth / 100.0;
|
|
|
|
data.freqofs = mFreqOfs / 100.0;
|
|
|
|
|
|
|
|
data.phase = mPhase * M_PI / 180.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
sampleCount EffectWahwah::InstanceProcess(EffectWahwahState & data, float **inBlock, float **outBlock, sampleCount blockLen)
|
|
|
|
{
|
|
|
|
float *ibuf = inBlock[0];
|
|
|
|
float *obuf = outBlock[0];
|
|
|
|
double frequency, omega, sn, cs, alpha;
|
|
|
|
double in, out;
|
|
|
|
|
|
|
|
data.lfoskip = mFreq * 2 * M_PI / data.samplerate;
|
|
|
|
data.depth = mDepth / 100.0;
|
|
|
|
data.freqofs = mFreqOfs / 100.0;
|
|
|
|
|
|
|
|
data.phase = mPhase * M_PI / 180.0;
|
|
|
|
|
|
|
|
for (int i = 0; i < blockLen; i++)
|
|
|
|
{
|
|
|
|
in = (double) ibuf[i];
|
|
|
|
|
|
|
|
if ((data.skipcount++) % lfoskipsamples == 0)
|
|
|
|
{
|
|
|
|
frequency = (1 + cos(data.skipcount * data.lfoskip + data.phase)) / 2;
|
|
|
|
frequency = frequency * data.depth * (1 - data.freqofs) + data.freqofs;
|
|
|
|
frequency = exp((frequency - 1) * 6);
|
|
|
|
omega = M_PI * frequency;
|
|
|
|
sn = sin(omega);
|
|
|
|
cs = cos(omega);
|
|
|
|
alpha = sn / (2 * mRes);
|
|
|
|
data.b0 = (1 - cs) / 2;
|
|
|
|
data.b1 = 1 - cs;
|
|
|
|
data.b2 = (1 - cs) / 2;
|
|
|
|
data.a0 = 1 + alpha;
|
|
|
|
data.a1 = -2 * cs;
|
|
|
|
data.a2 = 1 - alpha;
|
|
|
|
};
|
|
|
|
out = (data.b0 * in + data.b1 * data.xn1 + data.b2 * data.xn2 - data.a1 * data.yn1 - data.a2 * data.yn2) / data.a0;
|
|
|
|
data.xn2 = data.xn1;
|
|
|
|
data.xn1 = in;
|
|
|
|
data.yn2 = data.yn1;
|
|
|
|
data.yn1 = out;
|
|
|
|
|
|
|
|
obuf[i] = (float) out;
|
|
|
|
}
|
|
|
|
|
|
|
|
return blockLen;
|
|
|
|
}
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
void EffectWahwah::OnFreqSlider(wxCommandEvent & evt)
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2015-04-17 03:53:42 +00:00
|
|
|
mFreq = (double) evt.GetInt() / SCL_Freq;
|
|
|
|
mFreqT->GetValidator()->TransferToWindow();
|
|
|
|
EnableApply(mUIParent->Validate());
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
void EffectWahwah::OnPhaseSlider(wxCommandEvent & evt)
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2015-04-17 03:53:42 +00:00
|
|
|
int val = ((evt.GetInt() + 5) / 10) * 10; // round to nearest multiple of 10
|
|
|
|
val = val > MAX_Phase * SCL_Phase ? MAX_Phase * SCL_Phase : val;
|
|
|
|
mPhaseS->SetValue(val);
|
|
|
|
mPhase = (double) val / SCL_Phase;
|
|
|
|
mPhaseT->GetValidator()->TransferToWindow();
|
|
|
|
EnableApply(mUIParent->Validate());
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
void EffectWahwah::OnDepthSlider(wxCommandEvent & evt)
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2015-04-17 03:53:42 +00:00
|
|
|
mDepth = evt.GetInt() / SCL_Depth;
|
|
|
|
mDepthT->GetValidator()->TransferToWindow();
|
|
|
|
EnableApply(mUIParent->Validate());
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
void EffectWahwah::OnResonanceSlider(wxCommandEvent & evt)
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2015-04-17 03:53:42 +00:00
|
|
|
mRes = (double) evt.GetInt() / SCL_Res;
|
|
|
|
mResT->GetValidator()->TransferToWindow();
|
|
|
|
EnableApply(mUIParent->Validate());
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
void EffectWahwah::OnFreqOffSlider(wxCommandEvent & evt)
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2015-04-17 03:53:42 +00:00
|
|
|
mFreqOfs = evt.GetInt() / SCL_FreqOfs;
|
|
|
|
mFreqOfsT->GetValidator()->TransferToWindow();
|
|
|
|
EnableApply(mUIParent->Validate());
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
void EffectWahwah::OnFreqText(wxCommandEvent & WXUNUSED(evt))
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2015-04-17 03:53:42 +00:00
|
|
|
if (!EnableApply(mUIParent->TransferDataFromWindow()))
|
|
|
|
{
|
|
|
|
return;
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
2015-04-17 03:53:42 +00:00
|
|
|
|
|
|
|
mFreqS->SetValue((int) (mFreq * SCL_Freq));
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
void EffectWahwah::OnPhaseText(wxCommandEvent & WXUNUSED(evt))
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2015-04-17 03:53:42 +00:00
|
|
|
if (!EnableApply(mUIParent->TransferDataFromWindow()))
|
|
|
|
{
|
|
|
|
return;
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
2015-04-17 03:53:42 +00:00
|
|
|
|
|
|
|
mPhaseS->SetValue((int) (mPhase * SCL_Phase));
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
void EffectWahwah::OnDepthText(wxCommandEvent & WXUNUSED(evt))
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2015-04-17 03:53:42 +00:00
|
|
|
if (!EnableApply(mUIParent->TransferDataFromWindow()))
|
|
|
|
{
|
|
|
|
return;
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
2015-04-17 03:53:42 +00:00
|
|
|
|
|
|
|
mDepthS->SetValue((int) (mDepth * SCL_Depth));
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
void EffectWahwah::OnResonanceText(wxCommandEvent & WXUNUSED(evt))
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2015-04-17 03:53:42 +00:00
|
|
|
if (!EnableApply(mUIParent->TransferDataFromWindow()))
|
|
|
|
{
|
|
|
|
return;
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
2015-04-17 03:53:42 +00:00
|
|
|
|
|
|
|
mResS->SetValue((int) (mRes * SCL_Res));
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
void EffectWahwah::OnFreqOffText(wxCommandEvent & WXUNUSED(evt))
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2015-04-17 03:53:42 +00:00
|
|
|
if (!EnableApply(mUIParent->TransferDataFromWindow()))
|
|
|
|
{
|
|
|
|
return;
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
mFreqOfsS->SetValue((int) (mFreqOfs * SCL_FreqOfs));
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|