Audacity  2.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 <wx/event.h>
20 #include <wx/slider.h>
21 #include <wx/string.h>
22 #include <wx/textctrl.h>
23 
24 #include "Effect.h"
25 
26 class Envelope;
27 class ShuttleGui;
28 
29 #define CLICKREMOVAL_PLUGIN_SYMBOL XO("Click Removal")
30 
31 class EffectClickRemoval final : public Effect
32 {
33 public:
35  virtual ~EffectClickRemoval();
36 
37  // IdentInterface implementation
38 
39  wxString GetSymbol() override;
40  wxString GetDescription() override;
41  wxString ManualPage() override;
42 
43  // EffectIdentInterface implementation
44 
45  EffectType GetType() override;
46 
47  // EffectClientInterface implementation
48 
49  bool GetAutomationParameters(EffectAutomationParameters & parms) override;
50  bool SetAutomationParameters(EffectAutomationParameters & parms) override;
51 
52  // Effect implementation
53 
54  bool CheckWhetherSkipEffect() override;
55  bool Startup() override;
56  bool Process() override;
57  void PopulateOrExchange(ShuttleGui & S) override;
58  bool TransferDataToWindow() override;
59  bool TransferDataFromWindow() override;
60 
61 private:
62  bool ProcessOne(int count, WaveTrack * track,
63  sampleCount start, sampleCount len);
64 
65  bool RemoveClicks(size_t len, float *buffer);
66 
67  void OnWidthText(wxCommandEvent & evt);
68  void OnThreshText(wxCommandEvent & evt);
69  void OnWidthSlider(wxCommandEvent & evt);
70  void OnThreshSlider(wxCommandEvent & evt);
71 
72 private:
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  DECLARE_EVENT_TABLE()
87 };
88 
89 #endif
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:369
int mClickWidth
Definition: ClickRemoval.h:78
Envelope * mEnvelope
Definition: ClickRemoval.h:73
bool SetAutomationParameters(EffectAutomationParameters &parms) override
Definition: ClickRemoval.cpp:110
wxSlider * mWidthS
Definition: ClickRemoval.h:81
bool TransferDataToWindow() override
Definition: ClickRemoval.cpp:371
void OnWidthText(wxCommandEvent &evt)
Definition: ClickRemoval.cpp:391
bool TransferDataFromWindow() override
Definition: ClickRemoval.cpp:381
Draggable curve used in TrackPanel for varying amplification.
Definition: Envelope.h:78
virtual ~EffectClickRemoval()
Definition: ClickRemoval.cpp:72
wxSlider * mThreshS
Definition: ClickRemoval.h:82
Base class for many of the effects in Audacity.
Definition: Effect.h:62
wxTextCtrl * mWidthT
Definition: ClickRemoval.h:83
int sep
Definition: ClickRemoval.h:79
size_t windowSize
Definition: ClickRemoval.h:76
void OnThreshSlider(wxCommandEvent &evt)
Definition: ClickRemoval.cpp:409
EffectClickRemoval()
Definition: ClickRemoval.cpp:61
wxString GetDescription() override
Definition: ClickRemoval.cpp:83
An Effect for removing clicks.
Definition: ClickRemoval.h:31
A Track that contains audio waveform data.
Definition: WaveTrack.h:76
void OnWidthSlider(wxCommandEvent &evt)
Definition: ClickRemoval.cpp:403
wxString ManualPage() override
Definition: ClickRemoval.cpp:88
bool mbDidSomething
Definition: ClickRemoval.h:75
bool ProcessOne(int count, WaveTrack *track, sampleCount start, sampleCount len)
Definition: ClickRemoval.cpp:204
void OnThreshText(wxCommandEvent &evt)
Definition: ClickRemoval.cpp:397
wxTextCtrl * mThreshT
Definition: ClickRemoval.h:84
bool Process() override
Definition: ClickRemoval.cpp:164
EffectType GetType() override
Definition: ClickRemoval.cpp:95
int mThresholdLevel
Definition: ClickRemoval.h:77
bool RemoveClicks(size_t len, float *buffer)
Definition: ClickRemoval.cpp:260
wxString GetSymbol() override
Definition: ClickRemoval.cpp:78
void PopulateOrExchange(ShuttleGui &S) override
Definition: ClickRemoval.cpp:330
bool GetAutomationParameters(EffectAutomationParameters &parms) override
Definition: ClickRemoval.cpp:102
bool Startup() override
Definition: ClickRemoval.cpp:128
bool CheckWhetherSkipEffect() override
Definition: ClickRemoval.cpp:123