29#include <wx/weakref.h>
32#include "../widgets/valnum.h"
43#define lfoskipsamples 30
141 const float*
const* inBlock,
float*
const* outBlock,
size_t blockLen)
override;
153 const float*
const* inbuf,
float*
const* outbuf,
size_t numSamples)
160 const float*
const* inBlock,
float*
const* outBlock,
size_t blockLen);
172 return std::make_shared<Instance>(*
this);
193 return XO(
"Rapid tone quality variations, like that guitar sound so popular in the 1970's");
223 const float *
const *inBlock,
float *
const *outBlock,
size_t blockLen)
225 return InstanceProcess(
settings,
mState, inBlock, outBlock, blockLen);
242 mSlaves.push_back(slave);
255 const float *
const *inbuf,
float *
const *outbuf,
size_t numSamples)
257 if (group >= mSlaves.size())
259 return InstanceProcess(
settings, mSlaves[group].
mState, inbuf, outbuf, numSamples);
270 auto result = std::make_unique<Editor>(*
this, access, myEffSettings);
271 result->PopulateOrExchange(
S);
277 mUIParent =
S.GetParent();
278 auto& ms = mSettings;
283 S.StartMultiColumn(3, wxEXPAND);
288 .Validator<FloatingPointValidator<double>>(
289 5, &ms.mFreq, NumValidatorStyle::ONE_TRAILING_ZERO,
Freq.
min,
Freq.
max)
290 .AddTextBox(
XXO(
"LFO Freq&uency (Hz):"), L
"", 12);
294 .Name(
XO(
"LFO frequency in hertz"))
295 .Style(wxSL_HORIZONTAL)
296 .MinSize( { 100, -1 } )
301 .Validator<FloatingPointValidator<double>>(
303 .AddTextBox(
XXO(
"LFO Sta&rt Phase (deg.):"), L
"", 12);
307 .Name(
XO(
"LFO start phase in degrees"))
308 .Style(wxSL_HORIZONTAL)
309 .MinSize( { 100, -1 } )
311 mPhaseS->SetLineSize(10);
315 .Validator<IntegerValidator<int>>(
317 .AddTextBox(
XXO(
"Dept&h (%):"), L
"", 12);
321 .Name(
XO(
"Depth in percent"))
322 .Style(wxSL_HORIZONTAL)
323 .MinSize( { 100, -1 } )
328 .Validator<FloatingPointValidator<double>>(
329 1, &ms.mRes, NumValidatorStyle::DEFAULT,
Res.
min,
Res.
max)
330 .AddTextBox(
XXO(
"Reso&nance:"), L
"", 12);
334 .Name(
XO(
"Resonance"))
335 .Style(wxSL_HORIZONTAL)
336 .MinSize( { 100, -1 } )
341 .Validator<IntegerValidator<int>>(
343 .AddTextBox(
XXO(
"Wah Frequency Offse&t (%):"), L
"", 12);
347 .Name(
XO(
"Wah frequency offset in percent"))
348 .Style(wxSL_HORIZONTAL)
349 .MinSize( { 100, -1 } )
354 .Validator<FloatingPointValidator<double>>(
356 .AddTextBox(
XXO(
"&Output gain (dB):"), L
"", 12);
360 .Name(
XO(
"Output gain (dB)"))
361 .Style(wxSL_HORIZONTAL)
362 .MinSize( { 100, -1 } )
372 const auto&
settings = mAccess.Get();
376 auto& ms = mSettings;
378 mFreqS->SetValue((
int)(ms.mFreq *
Freq.
scale));
379 mPhaseS->SetValue((
int)(ms.mPhase *
Phase.
scale));
380 mDepthS->SetValue((
int)(ms.mDepth *
Depth.
scale));
381 mResS->SetValue((
int)(ms.mRes *
Res.
scale));
382 mFreqOfsS->SetValue((
int)(ms.mFreqOfs *
FreqOfs.
scale));
383 mOutGainS->SetValue((
int)(ms.mOutGain *
OutGain.
scale));
408 data.
depth = ms.mDepth / 100.0;
409 data.
freqofs = ms.mFreqOfs / 100.0;
416 const float *
const *inBlock,
float *
const *outBlock,
size_t blockLen)
420 const float *ibuf = inBlock[0];
421 float *obuf = outBlock[0];
422 double frequency, omega, sn, cs, alpha;
426 data.
depth = ms.mDepth / 100.0;
427 data.
freqofs = ms.mFreqOfs / 100.0;
432 for (
decltype(blockLen) i = 0; i < blockLen; i++)
434 in = (double) ibuf[i];
440 frequency = exp((frequency - 1) * 6);
441 omega =
M_PI * frequency;
444 alpha = sn / (2 * ms.mRes);
445 data.
b0 = (1 - cs) / 2;
447 data.
b2 = (1 - cs) / 2;
459 obuf[i] = (
float) out;
477 auto& ms = mSettings;
479 ms.mFreq = (double)evt.GetInt() /
Freq.
scale;
480 mFreqT->GetValidator()->TransferToWindow();
482 EnableApplyFromValidate();
489 auto& ms = mSettings;
491 int val = ((evt.GetInt() + 5) / 10) * 10;
493 mPhaseS->SetValue(val);
495 mPhaseT->GetValidator()->TransferToWindow();
497 EnableApplyFromValidate();
504 auto& ms = mSettings;
507 mDepthT->GetValidator()->TransferToWindow();
509 EnableApplyFromValidate();
516 auto& ms = mSettings;
518 ms.mRes = (double)evt.GetInt() /
Res.
scale;
519 mResT->GetValidator()->TransferToWindow();
521 EnableApplyFromValidate();
528 auto& ms = mSettings;
531 mFreqOfsT->GetValidator()->TransferToWindow();
533 EnableApplyFromValidate();
540 auto& ms = mSettings;
543 mOutGainT->GetValidator()->TransferToWindow();
545 EnableApplyFromValidate();
552 auto& ms = mSettings;
554 if (!EnableApplyFromTransferDataToWindow())
559 mFreqS->SetValue((
int)(ms.mFreq *
Freq.
scale));
566 auto& ms = mSettings;
568 if (!EnableApplyFromTransferDataToWindow())
573 mPhaseS->SetValue((
int)(ms.mPhase *
Phase.
scale));
580 auto& ms = mSettings;
582 if (!EnableApplyFromTransferDataToWindow())
587 mDepthS->SetValue((
int)(ms.mDepth *
Depth.
scale));
594 auto& ms = mSettings;
596 if (!EnableApplyFromTransferDataToWindow())
601 mResS->SetValue((
int)(ms.mRes *
Res.
scale));
608 auto& ms = mSettings;
610 if (!EnableApplyFromTransferDataToWindow())
615 mFreqOfsS->SetValue((
int)(ms.mFreqOfs *
FreqOfs.
scale));
622 auto& ms = mSettings;
624 if (!EnableApplyFromTransferDataToWindow())
629 mOutGainS->SetValue((
int)(ms.mOutGain *
OutGain.
scale));
XXO("&Cut/Copy/Paste Toolbar")
static Settings & settings()
bool ValidateUI(const EffectPlugin &context, EffectSettings &) const override
Generates EffectParameterMethods overrides from variadic template arguments.
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
void SetLinearEffectFlag(bool linearEffectFlag)
RealtimeSince
In which versions of Audacity was an effect realtime capable?
static bool EnableApply(wxWindow *parent, bool enable=true)
Enable or disable the Apply button of the dialog that contains parent.
EffectSettingsAccess & mAccess
Performs effect computation.
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.
void ModifySettings(Function &&function)
Do a correct read-modify-write of settings.
virtual const EffectSettings & Get()=0
static constexpr EffectParameter Freq
static constexpr EffectParameter FreqOfs
static constexpr EffectParameter Res
static constexpr EffectParameter Depth
const EffectParameterMethods & Parameters() const override
static const ComponentInterfaceSymbol Symbol
ComponentInterfaceSymbol GetSymbol() const override
ManualPageID ManualPage() const override
Name of a page in the Audacity alpha manual, default is empty.
EffectType GetType() const override
Type determines how it behaves.
std::shared_ptr< EffectInstance > MakeInstance() const override
Make an object maintaining short-term state of an Effect.
static constexpr EffectParameter Phase
TranslatableString GetDescription() const override
static constexpr EffectParameter OutGain
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.
RealtimeSince RealtimeSupport() const override
Since which version of Audacity has the effect supported realtime?
static EffectWahwahSettings & GetSettings(EffectSettings &settings)
Assume settings originated from MakeSettings() and copies thereof.
Base class for many of the effects in Audacity.
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Holds a msgid for the translation catalog; may also bind format arguments.
constexpr auto sampleRate
BuiltinEffectsModule::Registration< EffectWahwah > reg
const Type scale
Scaling factor, for slider control.
const Type def
Default value.
const Type min
Minimum value.
const Type max
Maximum value.
Message sent by EffectEditor when a setting is changed by the user.
Externalized state of a plug-in.
void EnableApplyFromValidate()
virtual ~Editor()=default
void OnFreqOffText(wxCommandEvent &evt)
Editor(const EffectUIServices &services, EffectSettingsAccess &access, const EffectWahwahSettings &settings)
void OnResonanceSlider(wxCommandEvent &evt)
void OnGainSlider(wxCommandEvent &evt)
void OnFreqOffSlider(wxCommandEvent &evt)
EffectWahwahSettings mSettings
bool UpdateUI() override
Update appearance of the panel for changes in settings.
bool EnableApplyFromTransferDataToWindow()
void OnPhaseSlider(wxCommandEvent &evt)
void OnFreqSlider(wxCommandEvent &evt)
void OnDepthSlider(wxCommandEvent &evt)
void OnDepthText(wxCommandEvent &evt)
bool ValidateUI() override
Get settings data from the panel; may make error dialogs and return false.
void OnFreqText(wxCommandEvent &evt)
void OnGainText(wxCommandEvent &evt)
void PopulateOrExchange(ShuttleGui &S)
void OnResonanceText(wxCommandEvent &evt)
void OnPhaseText(wxCommandEvent &evt)
wxWeakRef< wxWindow > mUIParent
bool ProcessInitialize(EffectSettings &settings, double sampleRate, ChannelNames chanMap) override
void InstanceInit(EffectSettings &settings, EffectWahwahState &data, float sampleRate)
size_t RealtimeProcess(size_t group, EffectSettings &settings, const float *const *inbuf, float *const *outbuf, size_t numSamples) override
bool RealtimeInitialize(EffectSettings &settings, double) override
size_t InstanceProcess(EffectSettings &settings, EffectWahwahState &data, const float *const *inBlock, float *const *outBlock, size_t blockLen)
size_t ProcessBlock(EffectSettings &settings, const float *const *inBlock, float *const *outBlock, size_t blockLen) override
Called for destructive effect computation.
unsigned GetAudioInCount() const override
How many input buffers to allocate at once.
bool RealtimeAddProcessor(EffectSettings &settings, EffectOutputs *pOutputs, unsigned numChannels, float sampleRate) override
Instance(const PerTrackEffect &effect)
std::vector< EffectWahwah::Instance > mSlaves
unsigned GetAudioOutCount() const override
How many output buffers to allocate at once.
bool RealtimeFinalize(EffectSettings &settings) noexcept override