2010-01-23 19:44:49 +00:00
|
|
|
/**********************************************************************
|
|
|
|
|
|
|
|
Audacity: A Digital Audio Editor
|
|
|
|
|
|
|
|
Amplify.h
|
|
|
|
|
|
|
|
Dominic Mazzoni
|
2014-06-03 20:30:19 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
This rewritten class supports a smart Amplify effect - it calculates
|
|
|
|
the maximum amount of gain that can be applied to all tracks without
|
|
|
|
causing clipping and selects this as the default parameter.
|
|
|
|
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
#ifndef __AUDACITY_EFFECT_AMPLIFY__
|
|
|
|
#define __AUDACITY_EFFECT_AMPLIFY__
|
|
|
|
|
|
|
|
#include <wx/checkbox.h>
|
2015-04-17 03:53:42 +00:00
|
|
|
#include <wx/event.h>
|
2010-01-23 19:44:49 +00:00
|
|
|
#include <wx/slider.h>
|
2015-04-17 03:53:42 +00:00
|
|
|
#include <wx/string.h>
|
2010-01-23 19:44:49 +00:00
|
|
|
#include <wx/textctrl.h>
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
#include "Effect.h"
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-19 03:49:05 +00:00
|
|
|
#define AMPLIFY_PLUGIN_SYMBOL XO("Amplify")
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-06-18 14:24:36 +00:00
|
|
|
class ShuttleGui;
|
|
|
|
|
2016-02-24 06:06:39 +00:00
|
|
|
class EffectAmplify final : public Effect
|
2015-04-17 03:53:42 +00:00
|
|
|
{
|
|
|
|
public:
|
2010-01-23 19:44:49 +00:00
|
|
|
EffectAmplify();
|
2015-04-17 03:53:42 +00:00
|
|
|
virtual ~EffectAmplify();
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// IdentInterface implementation
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2016-02-24 06:06:47 +00:00
|
|
|
wxString GetSymbol() override;
|
|
|
|
wxString GetDescription() override;
|
2017-05-19 17:20:05 +00:00
|
|
|
wxString ManualPage() override;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// EffectIdentInterface implementation
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2016-02-24 06:06:47 +00:00
|
|
|
EffectType GetType() override;
|
2014-06-03 20:30:19 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// EffectClientInterface implementation
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2016-09-02 19:53:09 +00:00
|
|
|
unsigned GetAudioInCount() override;
|
|
|
|
unsigned GetAudioOutCount() override;
|
2016-09-06 13:19:27 +00:00
|
|
|
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
|
2016-02-24 06:06:47 +00:00
|
|
|
bool GetAutomationParameters(EffectAutomationParameters & parms) override;
|
|
|
|
bool SetAutomationParameters(EffectAutomationParameters & parms) override;
|
|
|
|
bool LoadFactoryDefaults() override;
|
2014-06-03 20:30:19 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// Effect implementation
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2016-02-24 06:06:47 +00:00
|
|
|
bool Init() override;
|
|
|
|
void Preview(bool dryOnly) override;
|
|
|
|
void PopulateOrExchange(ShuttleGui & S) override;
|
|
|
|
bool TransferDataToWindow() override;
|
|
|
|
bool TransferDataFromWindow() override;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
private:
|
|
|
|
// EffectAmplify implementation
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
void OnAmpText(wxCommandEvent & evt);
|
|
|
|
void OnPeakText(wxCommandEvent & evt);
|
|
|
|
void OnAmpSlider(wxCommandEvent & evt);
|
|
|
|
void OnClipCheckBox(wxCommandEvent & evt);
|
|
|
|
void CheckClip();
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2013-02-23 04:33:20 +00:00
|
|
|
private:
|
2015-05-17 23:17:36 +00:00
|
|
|
double mPeak;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-05-17 23:17:36 +00:00
|
|
|
double mRatio;
|
2015-05-19 14:25:49 +00:00
|
|
|
double mRatioClip; // maximum value of mRatio which does not cause clipping
|
2015-05-17 23:17:36 +00:00
|
|
|
double mAmp;
|
|
|
|
double mNewPeak;
|
2015-04-27 08:44:10 +00:00
|
|
|
bool mCanClip;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
wxSlider *mAmpS;
|
|
|
|
wxTextCtrl *mAmpT;
|
2015-04-17 03:53:42 +00:00
|
|
|
wxTextCtrl *mNewPeakT;
|
2010-01-23 19:44:49 +00:00
|
|
|
wxCheckBox *mClip;
|
|
|
|
|
2016-09-18 14:26:29 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
2010-01-23 19:44:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __AUDACITY_EFFECT_AMPLIFY__
|