Audacity  3.0.3
Amplify.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  Amplify.h
6 
7  Dominic Mazzoni
8 
9  This rewritten class supports a smart Amplify effect - it calculates
10  the maximum amount of gain that can be applied to all tracks without
11  causing clipping and selects this as the default parameter.
12 
13 **********************************************************************/
14 
15 #ifndef __AUDACITY_EFFECT_AMPLIFY__
16 #define __AUDACITY_EFFECT_AMPLIFY__
17 
18 #include "Effect.h"
19 
20 
21 class wxSlider;
22 class wxCheckBox;
23 class wxTextCtrl;
24 class ShuttleGui;
25 
26 class EffectAmplify final : public Effect
27 {
28 public:
30 
31  EffectAmplify();
32  virtual ~EffectAmplify();
33 
34  // ComponentInterface implementation
35 
38  wxString ManualPage() override;
39 
40  // EffectDefinitionInterface implementation
41 
42  EffectType GetType() override;
43 
44  // EffectClientInterface implementation
45 
46  unsigned GetAudioInCount() override;
47  unsigned GetAudioOutCount() override;
48  size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
49  bool DefineParams( ShuttleParams & S ) override;
50  bool GetAutomationParameters(CommandParameters & parms) override;
51  bool SetAutomationParameters(CommandParameters & parms) override;
52  bool LoadFactoryDefaults() override;
53 
54  // Effect implementation
55 
56  bool Init() override;
57  void Preview(bool dryOnly) override;
58  void PopulateOrExchange(ShuttleGui & S) override;
59  bool TransferDataToWindow() override;
60  bool TransferDataFromWindow() override;
61 
62 private:
63  // EffectAmplify implementation
64 
65  void OnAmpText(wxCommandEvent & evt);
66  void OnPeakText(wxCommandEvent & evt);
67  void OnAmpSlider(wxCommandEvent & evt);
68  void OnClipCheckBox(wxCommandEvent & evt);
69  void CheckClip();
70 
71 private:
72  double mPeak;
73 
74  double mRatio;
75  double mRatioClip; // maximum value of mRatio which does not cause clipping
76  double mAmp;
77  double mNewPeak;
78  bool mCanClip;
79 
80  wxSlider *mAmpS;
81  wxTextCtrl *mAmpT;
82  wxTextCtrl *mNewPeakT;
83  wxCheckBox *mClip;
84 
85  DECLARE_EVENT_TABLE()
86 };
87 
88 #endif // __AUDACITY_EFFECT_AMPLIFY__
EffectAmplify::GetAudioOutCount
unsigned GetAudioOutCount() override
Definition: Amplify.cpp:121
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
EffectAmplify::mRatio
double mRatio
Definition: Amplify.h:74
CommandParameters
CommandParameters, derived from wxFileConfig, is essentially doing the same things as the Shuttle cla...
Definition: EffectAutomationParameters.h:67
EffectAmplify::GetDescription
TranslatableString GetDescription() override
Definition: Amplify.cpp:96
Effect.h
EffectAmplify::OnPeakText
void OnPeakText(wxCommandEvent &evt)
Definition: Amplify.cpp:360
EffectAmplify::EffectAmplify
EffectAmplify()
Definition: Amplify.cpp:74
Effect
Base class for many of the effects in Audacity.
Definition: Effect.h:70
EffectAmplify::CheckClip
void CheckClip()
Definition: Amplify.cpp:337
EffectAmplify::mRatioClip
double mRatioClip
Definition: Amplify.h:75
EffectAmplify::mAmp
double mAmp
Definition: Amplify.h:76
EffectAmplify::SetAutomationParameters
bool SetAutomationParameters(CommandParameters &parms) override
Definition: Amplify.cpp:151
ShuttleParams
Shuttle that deals with parameters. This is a base class with lots of virtual functions that do nothi...
Definition: Shuttle.h:61
EffectAmplify::Symbol
static const ComponentInterfaceSymbol Symbol
Definition: Amplify.h:29
EffectAmplify::GetAudioInCount
unsigned GetAudioInCount() override
Definition: Amplify.cpp:116
EffectAmplify::mNewPeakT
wxTextCtrl * mNewPeakT
Definition: Amplify.h:82
ComponentInterfaceSymbol
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Definition: ComponentInterface.h:61
EffectAmplify::mCanClip
bool mCanClip
Definition: Amplify.h:78
EffectAmplify::LoadFactoryDefaults
bool LoadFactoryDefaults() override
Definition: Amplify.cpp:166
EffectAmplify::mAmpT
wxTextCtrl * mAmpT
Definition: Amplify.h:81
EffectAmplify::GetType
EffectType GetType() override
Definition: Amplify.cpp:109
EffectAmplify::DefineParams
bool DefineParams(ShuttleParams &S) override
Definition: Amplify.cpp:135
EffectAmplify::ProcessBlock
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override
Definition: Amplify.cpp:126
EffectAmplify::mNewPeak
double mNewPeak
Definition: Amplify.h:77
EffectAmplify::OnAmpSlider
void OnAmpSlider(wxCommandEvent &evt)
Definition: Amplify.cpp:385
EffectAmplify::mPeak
double mPeak
Definition: Amplify.h:72
EffectAmplify::OnClipCheckBox
void OnClipCheckBox(wxCommandEvent &evt)
Definition: Amplify.cpp:407
EffectAmplify::TransferDataToWindow
bool TransferDataToWindow() override
Definition: Amplify.cpp:293
EffectAmplify::Init
bool Init() override
Definition: Amplify.cpp:187
EffectAmplify::GetAutomationParameters
bool GetAutomationParameters(CommandParameters &parms) override
Definition: Amplify.cpp:142
EffectAmplify::ManualPage
wxString ManualPage() override
Definition: Amplify.cpp:102
EffectAmplify::mClip
wxCheckBox * mClip
Definition: Amplify.h:83
EffectAmplify::OnAmpText
void OnAmpText(wxCommandEvent &evt)
Definition: Amplify.cpp:342
EffectAmplify::mAmpS
wxSlider * mAmpS
Definition: Amplify.h:80
EffectAmplify::PopulateOrExchange
void PopulateOrExchange(ShuttleGui &S) override
Definition: Amplify.cpp:214
EffectAmplify::GetSymbol
ComponentInterfaceSymbol GetSymbol() override
Definition: Amplify.cpp:91
EffectAmplify
An Effect that makes a sound louder or softer.
Definition: Amplify.h:27
EffectAmplify::Preview
void Preview(bool dryOnly) override
Definition: Amplify.cpp:206
EffectAmplify::~EffectAmplify
virtual ~EffectAmplify()
Definition: Amplify.cpp:85
EffectType
EffectType
Definition: EffectInterface.h:55
EffectAmplify::TransferDataFromWindow
bool TransferDataFromWindow() override
Definition: Amplify.cpp:316
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:625