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"
20#include "ShuttleAutomation.h"
21#include <wx/weakref.h>
22
23class wxSlider;
24class wxTextCtrl;
25class Envelope;
26class ShuttleGui;
27class WaveChannel;
28
30{
31public:
32 static inline EffectClickRemoval *
35
37 virtual ~EffectClickRemoval();
38
39 // ComponentInterface implementation
40
41 ComponentInterfaceSymbol GetSymbol() const override;
42 TranslatableString GetDescription() const override;
43 ManualPageID ManualPage() const override;
44
45 // EffectDefinitionInterface implementation
46
47 EffectType GetType() const override;
48
49 // Effect implementation
50
51 bool CheckWhetherSkipEffect(const EffectSettings &settings) const override;
52 bool Process(EffectInstance &instance, EffectSettings &settings) override;
53 std::unique_ptr<EffectEditor> PopulateOrExchange(
54 ShuttleGui & S, EffectInstance &instance,
55 EffectSettingsAccess &access, const EffectOutputs *pOutputs) override;
56 bool TransferDataToWindow(const EffectSettings &settings) override;
58
59private:
60 bool ProcessOne(int count, WaveChannel &track,
61 sampleCount start, sampleCount len);
62
63 bool RemoveClicks(size_t len, float *buffer);
64
65 void OnWidthText(wxCommandEvent & evt);
66 void OnThreshText(wxCommandEvent & evt);
67 void OnWidthSlider(wxCommandEvent & evt);
68 void OnThreshSlider(wxCommandEvent & evt);
69
70private:
71 wxWeakRef<wxWindow> mUIParent{};
72
74
75 bool mbDidSomething; // This effect usually does nothing on real-world data.
76 size_t windowSize;
79 int sep;
80
81 wxSlider *mWidthS;
82 wxSlider *mThreshS;
83 wxTextCtrl *mWidthT;
84 wxTextCtrl *mThreshT;
85
86 const EffectParameterMethods& Parameters() const override;
87 DECLARE_EVENT_TABLE()
88
90 L"Threshold", 200, 0, 900, 1 };
92 L"Width", 20, 0, 40, 1 };
93};
94
95#endif
EffectType
#define S(N)
Definition: ToChars.cpp:64
static Settings & settings()
Definition: TrackInfo.cpp:69
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
An Effect for removing clicks.
Definition: ClickRemoval.h:30
bool RemoveClicks(size_t len, float *buffer)
wxTextCtrl * mThreshT
Definition: ClickRemoval.h:84
static constexpr EffectParameter Width
Definition: ClickRemoval.h:91
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:33
wxWeakRef< wxWindow > mUIParent
Definition: ClickRemoval.h:71
void OnThreshSlider(wxCommandEvent &evt)
EffectType GetType() const override
Type determines how it behaves.
wxTextCtrl * mWidthT
Definition: ClickRemoval.h:83
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:34
wxSlider * mThreshS
Definition: ClickRemoval.h:82
TranslatableString GetDescription() const override
Envelope * mEnvelope
Definition: ClickRemoval.h:73
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:89
wxSlider * mWidthS
Definition: ClickRemoval.h:81
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.