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 "../ShuttleGui.h"
|
2010-01-23 19:44:49 +00:00
|
|
|
|
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-04-17 03:53:42 +00:00
|
|
|
class EffectAmplify : public Effect
|
|
|
|
{
|
|
|
|
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
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
virtual wxString GetSymbol();
|
|
|
|
virtual wxString GetDescription();
|
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
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
virtual EffectType GetType();
|
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
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
virtual int GetAudioInCount();
|
|
|
|
virtual int GetAudioOutCount();
|
|
|
|
virtual sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen);
|
|
|
|
virtual bool GetAutomationParameters(EffectAutomationParameters & parms);
|
|
|
|
virtual bool SetAutomationParameters(EffectAutomationParameters & parms);
|
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
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
virtual bool Init();
|
2015-05-11 19:04:02 +00:00
|
|
|
virtual void Preview(bool dryOnly);
|
2015-04-17 03:53:42 +00:00
|
|
|
virtual void PopulateOrExchange(ShuttleGui & S);
|
|
|
|
virtual bool TransferDataToWindow();
|
|
|
|
virtual bool TransferDataFromWindow();
|
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-04-17 03:53:42 +00:00
|
|
|
float mPeak;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
float mRatio;
|
|
|
|
float mAmp;
|
|
|
|
float 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;
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __AUDACITY_EFFECT_AMPLIFY__
|