Audacity 3.2.0
ClickRemoval.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 ClickRemoval.h
6
7 Craig DeForest
8
9 (Structure largely stolen from NoiseRemoval.h by Dominic Mazzoni)
10
11 This file is intended to become part of Audacity. You may modify and/or
12 distribute it under the same terms as Audacity itself.
13
14**********************************************************************/
15
16#ifndef __AUDACITY_EFFECT_CLICK_REMOVAL__
17#define __AUDACITY_EFFECT_CLICK_REMOVAL__
18
19#include "StatefulEffect.h"
21#include "ShuttleAutomation.h"
22#include <wx/weakref.h>
23
24class wxSlider;
25class wxTextCtrl;
26class Envelope;
27class ShuttleGui;
28class WaveChannel;
29
30class EffectClickRemoval final :
31 public StatefulEffect,
33{
34public:
35 static inline EffectClickRemoval *
38
40 virtual ~EffectClickRemoval();
41
42 // ComponentInterface implementation
43
44 ComponentInterfaceSymbol GetSymbol() const override;
45 TranslatableString GetDescription() const override;
46 ManualPageID ManualPage() const override;
47
48 // EffectDefinitionInterface implementation
49
50 EffectType GetType() const override;
51
52 // Effect implementation
53
54 bool CheckWhetherSkipEffect(const EffectSettings &settings) const override;
55 bool Process(EffectInstance &instance, EffectSettings &settings) override;
56 std::unique_ptr<EffectEditor> PopulateOrExchange(
57 ShuttleGui & S, EffectInstance &instance,
58 EffectSettingsAccess &access, const EffectOutputs *pOutputs) override;
59 bool TransferDataToWindow(const EffectSettings &settings) override;
61
62private:
63 bool ProcessOne(int count, WaveChannel &track,
64 sampleCount start, sampleCount len);
65
66 bool RemoveClicks(size_t len, float *buffer);
67
68 void OnWidthText(wxCommandEvent & evt);
69 void OnThreshText(wxCommandEvent & evt);
70 void OnWidthSlider(wxCommandEvent & evt);
71 void OnThreshSlider(wxCommandEvent & evt);
72
73private:
74 wxWeakRef<wxWindow> mUIParent{};
75
77
78 bool mbDidSomething; // This effect usually does nothing on real-world data.
79 size_t windowSize;
82 int sep;
83
84 wxSlider *mWidthS;
85 wxSlider *mThreshS;
86 wxTextCtrl *mWidthT;
87 wxTextCtrl *mThreshT;
88
89 const EffectParameterMethods& Parameters() const override;
90 DECLARE_EVENT_TABLE()
91
93 L"Threshold", 200, 0, 900, 1 };
95 L"Width", 20, 0, 40, 1 };
96};
97
98#endif
EffectType
#define S(N)
Definition: ToChars.cpp:64
static Settings & settings()
Definition: TrackInfo.cpp:51
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
An Effect for removing clicks.
Definition: ClickRemoval.h:33
bool RemoveClicks(size_t len, float *buffer)
wxTextCtrl * mThreshT
Definition: ClickRemoval.h:87
static constexpr EffectParameter Width
Definition: ClickRemoval.h:94
const EffectParameterMethods & Parameters() const override
void OnWidthSlider(wxCommandEvent &evt)
bool CheckWhetherSkipEffect(const EffectSettings &settings) const override
After Init(), tell whether Process() should be skipped.
static EffectClickRemoval * FetchParameters(EffectClickRemoval &e, EffectSettings &)
Definition: ClickRemoval.h:36
wxWeakRef< wxWindow > mUIParent
Definition: ClickRemoval.h:74
void OnThreshSlider(wxCommandEvent &evt)
EffectType GetType() const override
Type determines how it behaves.
wxTextCtrl * mWidthT
Definition: ClickRemoval.h:86
ManualPageID ManualPage() const override
Name of a page in the Audacity alpha manual, default is empty.
virtual ~EffectClickRemoval()
bool ProcessOne(int count, WaveChannel &track, sampleCount start, sampleCount len)
bool TransferDataToWindow(const EffectSettings &settings) override
static const ComponentInterfaceSymbol Symbol
Definition: ClickRemoval.h:37
wxSlider * mThreshS
Definition: ClickRemoval.h:85
TranslatableString GetDescription() const override
Envelope * mEnvelope
Definition: ClickRemoval.h:76
ComponentInterfaceSymbol GetSymbol() const override
std::unique_ptr< EffectEditor > PopulateOrExchange(ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) override
Add controls to effect panel; always succeeds.
void OnWidthText(wxCommandEvent &evt)
bool Process(EffectInstance &instance, EffectSettings &settings) override
static constexpr EffectParameter Threshold
Definition: ClickRemoval.h:92
wxSlider * mWidthS
Definition: ClickRemoval.h:84
void OnThreshText(wxCommandEvent &evt)
bool TransferDataFromWindow(EffectSettings &settings) override
Performs effect computation.
Hold values to send to effect output meters.
Interface for manipulations of an Effect's settings.
Piecewise linear or piecewise exponential function from double to double.
Definition: Envelope.h:72
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.
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:19
Externalized state of a plug-in.