Audacity 3.2.0
Phaser.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 Phaser.cpp
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*******************************************************************//*******************************************************************/
20#include "Phaser.h"
21#include "EffectEditor.h"
22#include "LoadEffects.h"
23
24#include <math.h>
25
26#include <wx/slider.h>
27
28#include "ShuttleGui.h"
29#include "../widgets/valnum.h"
30#include <wx/weakref.h>
31
33{
36 > parameters{
37
38 [](EffectPhaser &, EffectSettings &, EffectPhaserSettings &e, bool updating)
39 {
40 if (updating)
41 e.mStages &= ~1; // must be even, but don't complain about it
42 return true;
43 },
44 };
45 return parameters;
46}
47
48//
49#define phaserlfoshape 4.0
50
51// How many samples are processed before recomputing the lfo value again
52#define lfoskipsamples 20
53
54//
55// EffectPhaser
56//
57
59{ XO("Phaser") };
60
62
63
66{
67 Editor(const EffectUIServices& services,
69 ) : EffectEditor{ services, access }
71 {}
72 virtual ~Editor() = default;
73
74 bool ValidateUI() override;
75 bool UpdateUI() override;
76
78
79 wxWeakRef<wxWindow> mUIParent;
81
82 wxTextCtrl* mStagesT;
83 wxTextCtrl* mDryWetT;
84 wxTextCtrl* mFreqT;
85 wxTextCtrl* mPhaseT;
86 wxTextCtrl* mDepthT;
87 wxTextCtrl* mFeedbackT;
88 wxTextCtrl* mOutGainT;
89
90 wxSlider* mStagesS;
91 wxSlider* mDryWetS;
92 wxSlider* mFreqS;
93 wxSlider* mPhaseS;
94 wxSlider* mDepthS;
95 wxSlider* mFeedbackS;
96 wxSlider* mOutGainS;
97
98 void OnStagesSlider(wxCommandEvent& evt);
99 void OnDryWetSlider(wxCommandEvent& evt);
100 void OnFeedbackSlider(wxCommandEvent& evt);
101 void OnDepthSlider(wxCommandEvent& evt);
102 void OnPhaseSlider(wxCommandEvent& evt);
103 void OnFreqSlider(wxCommandEvent& evt);
104 void OnGainSlider(wxCommandEvent& evt);
105
106 void OnStagesText(wxCommandEvent& evt);
107 void OnDryWetText(wxCommandEvent& evt);
108 void OnFeedbackText(wxCommandEvent& evt);
109 void OnDepthText(wxCommandEvent& evt);
110 void OnPhaseText(wxCommandEvent& evt);
111 void OnFreqText(wxCommandEvent& evt);
112 void OnGainText(wxCommandEvent& evt);
113
114
116 {
117 EnableApply(mUIParent, mUIParent->Validate());
118 }
119
121 {
122 return EnableApply(mUIParent, mUIParent->TransferDataFromWindow());
123 }
124
125};
126
127
131{
132 explicit Instance(const PerTrackEffect& effect)
133 : PerTrackEffect::Instance{ effect }
134 {}
135
137 double sampleRate,
138 ChannelNames chanMap) override;
139
141 const float* const* inBlock, float* const* outBlock, size_t blockLen) override;
142
143 bool RealtimeInitialize(EffectSettings& settings, double) override;
144
146 EffectOutputs *pOutputs, unsigned numChannels, float sampleRate) override;
147
148 bool RealtimeFinalize(EffectSettings& settings) noexcept override;
149
150 size_t RealtimeProcess(size_t group, EffectSettings& settings,
151 const float* const* inbuf, float* const* outbuf, size_t numSamples)
152 override;
153
154 unsigned GetAudioInCount() const override;
155 unsigned GetAudioOutCount() const override;
156
158
160 EffectPhaserState& data,
161 const float* const* inBlock,
162 float* const* outBlock,
163 size_t blockLen);
164
165 void Coefficients(double hz, double slope, double gain, double samplerate, int type,
166 double& a0, double& a1, double& a2, double& b0, double& b1, double& b2);
167
168 float DoFilter(EffectPhaserState& data, float in);
169
171 std::vector<EffectPhaser::Instance> mSlaves;
172};
173
174
175std::shared_ptr<EffectInstance>
177{
178 return std::make_shared<Instance>(*this);
179}
180
181
182
184{
186}
187
189{
190}
191
192// ComponentInterface implementation
193
195{
196 return Symbol;
197}
198
200{
201 return XO("Combines phase-shifted signals with the original signal");
202}
203
205{
206 return L"Phaser";
207}
208
209// EffectDefinitionInterface implementation
210
212{
213 return EffectTypeProcess;
214}
215
217{
219}
220
222{
223 return 1;
224}
225
227{
228 return 1;
229}
230
233{
234 InstanceInit(settings, mState, sampleRate);
235 if (chanMap[0] == ChannelNameFrontRight)
236 mState.phase += M_PI;
237 return true;
238}
239
241 const float *const *inBlock, float *const *outBlock, size_t blockLen)
242{
243 return InstanceProcess(settings, mState, inBlock, outBlock, blockLen);
244}
245
247{
248 SetBlockSize(512);
249 mSlaves.clear();
250 return true;
251}
252
254 EffectSettings& settings, EffectOutputs *, unsigned, float sampleRate)
255{
256 EffectPhaser::Instance slave(mProcessor);
257
258 InstanceInit(settings, slave.mState, sampleRate);
259
260 mSlaves.push_back(slave);
261
262 return true;
263}
264
266{
267 mSlaves.clear();
268
269 return true;
270}
271
273 const float *const *inbuf, float *const *outbuf, size_t numSamples)
274{
275 if (group >= mSlaves.size())
276 return 0;
277 return InstanceProcess(settings, mSlaves[group].mState, inbuf, outbuf, numSamples);
278}
279
280// Effect implementation
281std::unique_ptr<EffectEditor> EffectPhaser::MakeEditor(
283 const EffectOutputs *) const
284{
285 auto& settings = access.Get();
286 auto& myEffSettings = GetSettings(settings);
287
288 auto result = std::make_unique<Editor>(*this, access, myEffSettings);
289 result->PopulateOrExchange(S);
290 return result;
291}
292
294{
295 mUIParent = S.GetParent();
296 auto& ms = mSettings;
297
298 S.SetBorder(5);
299 S.AddSpace(0, 5);
300
301 S.StartMultiColumn(3, wxEXPAND);
302 {
303 S.SetStretchyCol(2);
304
305 mStagesT = S
306 .Validator<IntegerValidator<int>>(
307 &ms.mStages, NumValidatorStyle::DEFAULT, Stages.min, Stages.max)
308 .AddTextBox(XXO("&Stages:"), L"", 15);
309 BindTo(*mStagesT, wxEVT_TEXT, &Editor::OnStagesText);
310
311 mStagesS = S
312 .Name(XO("Stages"))
313 .Style(wxSL_HORIZONTAL)
314 .MinSize( { 100, -1 } )
315 .AddSlider( {}, Stages.def * Stages.scale, Stages.max * Stages.scale, Stages.min * Stages.scale);
316 mStagesS->SetLineSize(2);
317 BindTo(*mStagesS, wxEVT_SLIDER, &Editor::OnStagesSlider);
318
319 mDryWetT = S
320 .Validator<IntegerValidator<int>>(
321 &ms.mDryWet, NumValidatorStyle::DEFAULT, DryWet.min, DryWet.max)
322 .AddTextBox(XXO("&Dry/Wet:"), L"", 15);
323 BindTo(*mDryWetT, wxEVT_TEXT, &Editor::OnDryWetText);
324
325 mDryWetS = S
326 .Name(XO("Dry Wet"))
327 .Style(wxSL_HORIZONTAL)
328 .MinSize( { 100, -1 } )
329 .AddSlider( {}, DryWet.def * DryWet.scale, DryWet.max * DryWet.scale, DryWet.min * DryWet.scale);
330 BindTo(*mDryWetS, wxEVT_SLIDER, &Editor::OnDryWetSlider);
331
332 mFreqT = S
333 .Validator<FloatingPointValidator<double>>(
334 5, &ms.mFreq, NumValidatorStyle::ONE_TRAILING_ZERO, Freq.min, Freq.max)
335 .AddTextBox(XXO("LFO Freq&uency (Hz):"), L"", 15);
336 BindTo(*mFreqT, wxEVT_TEXT, &Editor::OnFreqText);
337
338 mFreqS = S
339 .Name(XO("LFO frequency in hertz"))
340 .Style(wxSL_HORIZONTAL)
341 .MinSize( { 100, -1 } )
342 .AddSlider( {}, Freq.def * Freq.scale, Freq.max * Freq.scale, 0.0);
343 BindTo(*mFreqS, wxEVT_SLIDER, &Editor::OnFreqSlider);
344
345 mPhaseT = S
346 .Validator<FloatingPointValidator<double>>(
347 1, &ms.mPhase, NumValidatorStyle::DEFAULT, Phase.min, Phase.max)
348 .AddTextBox(XXO("LFO Sta&rt Phase (deg.):"), L"", 15);
349 BindTo(*mPhaseT, wxEVT_TEXT, &Editor::OnPhaseText);
350
351 mPhaseS = S
352 .Name(XO("LFO start phase in degrees"))
353 .Style(wxSL_HORIZONTAL)
354 .MinSize( { 100, -1 } )
355 .AddSlider( {}, Phase.def * Phase.scale, Phase.max * Phase.scale, Phase.min * Phase.scale);
356 mPhaseS->SetLineSize(10);
357 BindTo(*mPhaseS, wxEVT_SLIDER, &Editor::OnPhaseSlider);
358
359 mDepthT = S
360 .Validator<IntegerValidator<int>>(
361 &ms.mDepth, NumValidatorStyle::DEFAULT, Depth.min, Depth.max)
362 .AddTextBox(XXO("Dept&h:"), L"", 15);
363 BindTo(*mDepthT, wxEVT_TEXT, &Editor::OnDepthText);
364
365 mDepthS = S
366 .Name(XO("Depth in percent"))
367 .Style(wxSL_HORIZONTAL)
368 .MinSize( { 100, -1 } )
369 .AddSlider( {}, Depth.def * Depth.scale, Depth.max * Depth.scale, Depth.min * Depth.scale);
370 BindTo(*mDepthS, wxEVT_SLIDER, &Editor::OnDepthSlider);
371
372 mFeedbackT = S
373 .Validator<IntegerValidator<int>>(
374 &ms.mFeedback, NumValidatorStyle::DEFAULT, Feedback.min, Feedback.max)
375 .AddTextBox(XXO("Feedbac&k (%):"), L"", 15);
376 BindTo(*mFeedbackT, wxEVT_TEXT, &Editor::OnFeedbackText);
377
378 mFeedbackS = S
379 .Name(XO("Feedback in percent"))
380 .Style(wxSL_HORIZONTAL)
381 .MinSize( { 100, -1 } )
383 mFeedbackS->SetLineSize(10);
384 BindTo(*mFeedbackS, wxEVT_SLIDER, &Editor::OnFeedbackSlider);
385
386 mOutGainT = S
387 .Validator<FloatingPointValidator<double>>(
388 1, &ms.mOutGain, NumValidatorStyle::DEFAULT, OutGain.min, OutGain.max)
389 .AddTextBox(XXO("&Output gain (dB):"), L"", 12);
390 BindTo(*mOutGainT, wxEVT_TEXT, &Editor::OnGainText);
391
392 mOutGainS = S
393 .Name(XO("Output gain (dB)"))
394 .Style(wxSL_HORIZONTAL)
395 .MinSize( { 100, -1 } )
397 BindTo(*mOutGainS, wxEVT_SLIDER, &Editor::OnGainSlider);
398 }
399 S.EndMultiColumn();
400
401}
402
404{
405 // get the settings from the MessageBuffer and write them to our local copy
406 const auto& settings = mAccess.Get();
407
408 mSettings = GetSettings(settings);
409
410 if (!mUIParent->TransferDataToWindow())
411 {
412 return false;
413 }
414
415 mStagesS-> SetValue((int) (mSettings.mStages * Stages.scale));
416 mDryWetS-> SetValue((int) (mSettings.mDryWet * DryWet.scale));
417 mFreqS-> SetValue((int) (mSettings.mFreq * Freq.scale));
418 mPhaseS-> SetValue((int) (mSettings.mPhase * Phase.scale));
419 mDepthS-> SetValue((int) (mSettings.mDepth * Depth.scale));
420 mFeedbackS->SetValue((int) (mSettings.mFeedback * Feedback.scale));
421 mOutGainS-> SetValue((int) (mSettings.mOutGain * OutGain.scale));
422
423 return true;
424}
425
426
428{
429 // This bit was copied from the original override of TransferDataFromWindow
430 if (!mUIParent->Validate() || !mUIParent->TransferDataFromWindow())
431 {
432 return false;
433 }
434
435 auto& ms = mSettings;
436
437 if (ms.mStages & 1) // must be even
438 {
439 ms.mStages &= ~1;
440 mStagesT->GetValidator()->TransferToWindow();
441 }
442
443 mAccess.ModifySettings
444 (
445 [this](EffectSettings& settings)
446 {
447 // pass back the modified settings to the MessageBuffer
448
449 GetSettings(settings) = mSettings;
450 return nullptr;
451 }
452 );
453
454 return true;
455}
456
457
458// EffectPhaser implementation
459
461{
462 auto& ms = GetSettings(settings);
463
464 data.samplerate = sampleRate;
465
466 for (int j = 0; j < ms.mStages; j++)
467 {
468 data.old[j] = 0;
469 }
470
471 data.skipcount = 0;
472 data.gain = 0;
473 data.fbout = 0;
474 data.laststages = 0;
475 data.outgain = 0;
476
477 return;
478}
479
481 EffectPhaserState & data,
482 const float *const *inBlock, float *const *outBlock, size_t blockLen)
483{
484 auto& ms = GetSettings(settings);
485
486 const float *ibuf = inBlock[0];
487 float *obuf = outBlock[0];
488
489 for (int j = data.laststages; j < ms.mStages; j++)
490 {
491 data.old[j] = 0;
492 }
493 data.laststages = ms.mStages;
494
495 data.lfoskip = ms.mFreq * 2 * M_PI / data.samplerate;
496 data.phase = ms.mPhase * M_PI / 180;
497 data.outgain = DB_TO_LINEAR(ms.mOutGain);
498
499 for (decltype(blockLen) i = 0; i < blockLen; i++)
500 {
501 double in = ibuf[i];
502
503 double m = in + data.fbout * ms.mFeedback / 101; // Feedback must be less than 100% to avoid infinite gain.
504
505 if (((data.skipcount++) % lfoskipsamples) == 0)
506 {
507 //compute sine between 0 and 1
508 data.gain =
509 (1.0 +
510 cos(data.skipcount.as_double() * data.lfoskip
511 + data.phase)) / 2.0;
512
513 // change lfo shape
514 data.gain = expm1(data.gain * phaserlfoshape) / expm1(phaserlfoshape);
515
516 // attenuate the lfo
517 data.gain = 1.0 - data.gain / 255.0 * ms.mDepth;
518 }
519
520 // phasing routine
521 for (int j = 0; j < ms.mStages; j++)
522 {
523 double tmp = data.old[j];
524 data.old[j] = data.gain * tmp + m;
525 m = tmp - data.gain * data.old[j];
526 }
527 data.fbout = m;
528
529 obuf[i] = (float) (data.outgain * (m * ms.mDryWet + in * (255 - ms.mDryWet)) / 255);
530 }
531
532 return blockLen;
533}
534
535void EffectPhaser::Editor::OnStagesSlider(wxCommandEvent & evt)
536{
537 auto& ms = mSettings;
538
539 ms.mStages = (evt.GetInt() / Stages.scale) & ~1; // must be even;
540 mStagesT->GetValidator()->TransferToWindow();
541 EnableApplyFromValidate();
542
543 ValidateUI();
544 Publish(EffectSettingChanged{});
545}
546
547void EffectPhaser::Editor::OnDryWetSlider(wxCommandEvent & evt)
548{
549 auto& ms = mSettings;
550
551 ms.mDryWet = evt.GetInt() / DryWet.scale;
552 mDryWetT->GetValidator()->TransferToWindow();
553 EnableApplyFromValidate();
554
555 ValidateUI();
556 Publish(EffectSettingChanged{});
557}
558
559void EffectPhaser::Editor::OnFreqSlider(wxCommandEvent & evt)
560{
561 auto& ms = mSettings;
562
563 ms.mFreq = (double) evt.GetInt() / Freq.scale;
564 if (ms.mFreq < Freq.min) ms.mFreq = Freq.min;
565 mFreqT->GetValidator()->TransferToWindow();
566 EnableApplyFromValidate();
567
568 ValidateUI();
569 Publish(EffectSettingChanged{});
570}
571
572void EffectPhaser::Editor::OnPhaseSlider(wxCommandEvent & evt)
573{
574 auto& ms = mSettings;
575
576 int val = ((evt.GetInt() + 5) / 10) * 10; // round to nearest multiple of 10
577 val = val > Phase.max * Phase.scale ? Phase.max * Phase.scale : val;
578 mPhaseS->SetValue(val);
579 ms.mPhase = (double) val / Phase.scale;
580 mPhaseT->GetValidator()->TransferToWindow();
581 EnableApplyFromValidate();
582
583 ValidateUI();
584 Publish(EffectSettingChanged{});
585}
586
587void EffectPhaser::Editor::OnDepthSlider(wxCommandEvent & evt)
588{
589 auto& ms = mSettings;
590
591 ms.mDepth = evt.GetInt() / Depth.scale;
592 mDepthT->GetValidator()->TransferToWindow();
593 EnableApplyFromValidate();
594
595 ValidateUI();
596 Publish(EffectSettingChanged{});
597}
598
600{
601 auto& ms = mSettings;
602
603 int val = evt.GetInt();
604 val = ((val + (val > 0 ? 5 : -5)) / 10) * 10; // round to nearest multiple of 10
605 val = val > Feedback.max * Feedback.scale ? Feedback.max * Feedback.scale : val;
606 mFeedbackS->SetValue(val);
607 ms.mFeedback = val / Feedback.scale;
608 mFeedbackT->GetValidator()->TransferToWindow();
609 EnableApplyFromValidate();
610
611 ValidateUI();
612 Publish(EffectSettingChanged{});
613}
614
615void EffectPhaser::Editor::OnGainSlider(wxCommandEvent & evt)
616{
617 auto& ms = mSettings;
618
619 ms.mOutGain = evt.GetInt() / OutGain.scale;
620 mOutGainT->GetValidator()->TransferToWindow();
621 EnableApplyFromValidate();
622
623 ValidateUI();
624 Publish(EffectSettingChanged{});
625}
626
627void EffectPhaser::Editor::OnStagesText(wxCommandEvent & WXUNUSED(evt))
628{
629 auto& ms = mSettings;
630
631 if (!EnableApplyFromTransferDataFromWindow())
632 {
633 return;
634 }
635
636 mStagesS->SetValue((int) (ms.mStages * Stages.scale));
637
638 ValidateUI();
639 Publish(EffectSettingChanged{});
640}
641
642void EffectPhaser::Editor::OnDryWetText(wxCommandEvent & WXUNUSED(evt))
643{
644 auto& ms = mSettings;
645
646 if (!EnableApplyFromTransferDataFromWindow())
647 {
648 return;
649 }
650
651 mDryWetS->SetValue((int) (ms.mDryWet * DryWet.scale));
652
653 ValidateUI();
654 Publish(EffectSettingChanged{});
655}
656
657void EffectPhaser::Editor::OnFreqText(wxCommandEvent & WXUNUSED(evt))
658{
659 auto& ms = mSettings;
660
661 if (!EnableApplyFromTransferDataFromWindow())
662 {
663 return;
664 }
665
666 mFreqS->SetValue((int) (ms.mFreq * Freq.scale));
667
668 ValidateUI();
669 Publish(EffectSettingChanged{});
670}
671
672void EffectPhaser::Editor::OnPhaseText(wxCommandEvent & WXUNUSED(evt))
673{
674 auto& ms = mSettings;
675
676 if (!EnableApplyFromTransferDataFromWindow())
677 {
678 return;
679 }
680
681 mPhaseS->SetValue((int) (ms.mPhase * Phase.scale));
682
683 ValidateUI();
684 Publish(EffectSettingChanged{});
685}
686
687void EffectPhaser::Editor::OnDepthText(wxCommandEvent & WXUNUSED(evt))
688{
689 auto& ms = mSettings;
690
691 if (!EnableApplyFromTransferDataFromWindow())
692 {
693 return;
694 }
695
696 mDepthS->SetValue((int) (ms.mDepth * Depth.scale));
697
698 ValidateUI();
699 Publish(EffectSettingChanged{});
700}
701
702void EffectPhaser::Editor::OnFeedbackText(wxCommandEvent & WXUNUSED(evt))
703{
704 auto& ms = mSettings;
705
706 if (!EnableApplyFromTransferDataFromWindow())
707 {
708 return;
709 }
710
711 mFeedbackS->SetValue((int) (ms.mFeedback * Feedback.scale));
712
713 ValidateUI();
714 Publish(EffectSettingChanged{});
715}
716
717void EffectPhaser::Editor::OnGainText(wxCommandEvent & WXUNUSED(evt))
718{
719 auto& ms = mSettings;
720
721 if (!EnableApplyFromTransferDataFromWindow())
722 {
723 return;
724 }
725
726 mOutGainS->SetValue((int) (ms.mOutGain * OutGain.scale));
727
728 ValidateUI();
729 Publish(EffectSettingChanged{});
730}
#define M_PI
Definition: Distortion.cpp:30
struct State mState
EffectType
@ EffectTypeProcess
ChannelName
@ ChannelNameFrontRight
XO("Cut/Copy/Paste")
XXO("&Cut/Copy/Paste Toolbar")
#define DB_TO_LINEAR(x)
Definition: MemoryX.h:337
#define phaserlfoshape
Definition: Phaser.cpp:49
#define lfoskipsamples
Definition: Phaser.cpp:52
#define S(N)
Definition: ToChars.cpp:64
static Settings & settings()
Definition: TrackInfo.cpp:69
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)
Definition: EffectBase.cpp:210
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.
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.
An Effect that changes frequencies in a time varying manner.
Definition: Phaser.h:76
static constexpr EffectParameter Feedback
Definition: Phaser.h:135
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.
Definition: Phaser.cpp:281
static constexpr EffectParameter DryWet
Definition: Phaser.h:119
static constexpr EffectParameter Stages
Definition: Phaser.h:115
static constexpr EffectParameter Phase
Definition: Phaser.h:127
std::shared_ptr< EffectInstance > MakeInstance() const override
Make an object maintaining short-term state of an Effect.
Definition: Phaser.cpp:176
static const ComponentInterfaceSymbol Symbol
Definition: Phaser.h:79
RealtimeSince RealtimeSupport() const override
Since which version of Audacity has the effect supported realtime?
Definition: Phaser.cpp:216
static constexpr EffectParameter Depth
Definition: Phaser.h:131
static constexpr EffectParameter Freq
Definition: Phaser.h:123
const EffectParameterMethods & Parameters() const override
Definition: Phaser.cpp:32
virtual ~EffectPhaser()
Definition: Phaser.cpp:188
TranslatableString GetDescription() const override
Definition: Phaser.cpp:199
ComponentInterfaceSymbol GetSymbol() const override
Definition: Phaser.cpp:194
EffectType GetType() const override
Type determines how it behaves.
Definition: Phaser.cpp:211
static constexpr EffectParameter OutGain
Definition: Phaser.h:139
ManualPageID ManualPage() const override
Name of a page in the Audacity alpha manual, default is empty.
Definition: Phaser.cpp:204
double outgain
Definition: Phaser.h:35
double lfoskip
Definition: Phaser.h:36
double fbout
Definition: Phaser.h:34
double gain
Definition: Phaser.h:33
double phase
Definition: Phaser.h:37
double old[NUM_STAGES]
Definition: Phaser.h:32
float samplerate
Definition: Phaser.h:30
sampleCount skipcount
Definition: Phaser.h:31
virtual const EffectSettings & Get()=0
static EffectPhaserSettings & GetSettings(EffectSettings &settings)
Assume settings originated from MakeSettings() and copies thereof.
Definition: Effect.h:166
Base class for many of the effects in Audacity.
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
Holds a msgid for the translation catalog; may also bind format arguments.
double as_double() const
Definition: SampleCount.h:46
BuiltinEffectsModule::Registration< EffectPhaser > reg
Definition: Phaser.cpp:61
const Type scale
Scaling factor, for slider control.
const Type def
Default value.
const Type min
Minimum value.
const Type max
Maximum value.
wxWeakRef< wxWindow > mUIParent
Definition: Phaser.cpp:79
bool EnableApplyFromTransferDataFromWindow()
Definition: Phaser.cpp:120
wxSlider * mPhaseS
Definition: Phaser.cpp:93
bool ValidateUI() override
Get settings data from the panel; may make error dialogs and return false.
Definition: Phaser.cpp:427
void OnGainSlider(wxCommandEvent &evt)
Definition: Phaser.cpp:615
bool UpdateUI() override
Update appearance of the panel for changes in settings.
Definition: Phaser.cpp:403
void OnStagesSlider(wxCommandEvent &evt)
Definition: Phaser.cpp:535
wxSlider * mFreqS
Definition: Phaser.cpp:92
Editor(const EffectUIServices &services, EffectSettingsAccess &access, const EffectPhaserSettings &settings)
Definition: Phaser.cpp:67
wxTextCtrl * mDryWetT
Definition: Phaser.cpp:83
wxTextCtrl * mOutGainT
Definition: Phaser.cpp:88
wxSlider * mOutGainS
Definition: Phaser.cpp:96
void OnFreqSlider(wxCommandEvent &evt)
Definition: Phaser.cpp:559
void OnGainText(wxCommandEvent &evt)
Definition: Phaser.cpp:717
wxSlider * mDepthS
Definition: Phaser.cpp:94
void OnFeedbackSlider(wxCommandEvent &evt)
Definition: Phaser.cpp:599
EffectPhaserSettings mSettings
Definition: Phaser.cpp:80
void OnPhaseSlider(wxCommandEvent &evt)
Definition: Phaser.cpp:572
wxSlider * mFeedbackS
Definition: Phaser.cpp:95
void OnPhaseText(wxCommandEvent &evt)
Definition: Phaser.cpp:672
wxTextCtrl * mFeedbackT
Definition: Phaser.cpp:87
wxSlider * mDryWetS
Definition: Phaser.cpp:91
void OnFeedbackText(wxCommandEvent &evt)
Definition: Phaser.cpp:702
void OnDryWetText(wxCommandEvent &evt)
Definition: Phaser.cpp:642
wxTextCtrl * mDepthT
Definition: Phaser.cpp:86
wxTextCtrl * mFreqT
Definition: Phaser.cpp:84
void EnableApplyFromValidate()
Definition: Phaser.cpp:115
void OnDryWetSlider(wxCommandEvent &evt)
Definition: Phaser.cpp:547
void OnDepthSlider(wxCommandEvent &evt)
Definition: Phaser.cpp:587
void OnFreqText(wxCommandEvent &evt)
Definition: Phaser.cpp:657
wxTextCtrl * mStagesT
Definition: Phaser.cpp:82
virtual ~Editor()=default
void OnStagesText(wxCommandEvent &evt)
Definition: Phaser.cpp:627
void OnDepthText(wxCommandEvent &evt)
Definition: Phaser.cpp:687
wxTextCtrl * mPhaseT
Definition: Phaser.cpp:85
void PopulateOrExchange(ShuttleGui &S)
Definition: Phaser.cpp:293
wxSlider * mStagesS
Definition: Phaser.cpp:90
Instance(const PerTrackEffect &effect)
Definition: Phaser.cpp:132
size_t RealtimeProcess(size_t group, EffectSettings &settings, const float *const *inbuf, float *const *outbuf, size_t numSamples) override
Definition: Phaser.cpp:272
bool RealtimeInitialize(EffectSettings &settings, double) override
Definition: Phaser.cpp:246
void InstanceInit(EffectSettings &settings, EffectPhaserState &data, float sampleRate)
Definition: Phaser.cpp:460
bool RealtimeFinalize(EffectSettings &settings) noexcept override
Definition: Phaser.cpp:265
std::vector< EffectPhaser::Instance > mSlaves
Definition: Phaser.cpp:171
bool ProcessInitialize(EffectSettings &settings, double sampleRate, ChannelNames chanMap) override
Definition: Phaser.cpp:231
float DoFilter(EffectPhaserState &data, float in)
unsigned GetAudioInCount() const override
How many input buffers to allocate at once.
Definition: Phaser.cpp:221
size_t ProcessBlock(EffectSettings &settings, const float *const *inBlock, float *const *outBlock, size_t blockLen) override
Called for destructive effect computation.
Definition: Phaser.cpp:240
unsigned GetAudioOutCount() const override
How many output buffers to allocate at once.
Definition: Phaser.cpp:226
void Coefficients(double hz, double slope, double gain, double samplerate, int type, double &a0, double &a1, double &a2, double &b0, double &b1, double &b2)
size_t InstanceProcess(EffectSettings &settings, EffectPhaserState &data, const float *const *inBlock, float *const *outBlock, size_t blockLen)
Definition: Phaser.cpp:480
bool RealtimeAddProcessor(EffectSettings &settings, EffectOutputs *pOutputs, unsigned numChannels, float sampleRate) override
Definition: Phaser.cpp:253
EffectPhaserState mState
Definition: Phaser.cpp:170
Message sent by EffectEditor when a setting is changed by the user.
Definition: EffectEditor.h:26
Externalized state of a plug-in.