Audacity  2.3.1
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
EffectNormalize Class Referencefinal

An Effect to bring the peak level up to a chosen level. More...

#include <Normalize.h>

Inheritance diagram for EffectNormalize:
Effect EffectClientInterface EffectUIClientInterface EffectHostInterface EffectDefinitionInterface ConfigClientInterface ComponentInterface

Public Member Functions

 EffectNormalize ()
 
virtual ~EffectNormalize ()
 
ComponentInterfaceSymbol GetSymbol () override
 
wxString GetDescription () override
 
wxString ManualPage () override
 
EffectType GetType () override
 
bool DefineParams (ShuttleParams &S) override
 
bool GetAutomationParameters (CommandParameters &parms) override
 
bool SetAutomationParameters (CommandParameters &parms) override
 
bool CheckWhetherSkipEffect () override
 
bool Startup () override
 
bool Process () override
 
void PopulateOrExchange (ShuttleGui &S) override
 
bool TransferDataToWindow () override
 
bool TransferDataFromWindow () override
 
- Public Member Functions inherited from Effect
 Effect ()
 
virtual ~Effect ()
 
wxString GetPath () override
 
ComponentInterfaceSymbol GetVendor () override
 
wxString GetVersion () override
 
ComponentInterfaceSymbol GetFamilyId () override
 
bool IsInteractive () override
 
bool IsDefault () override
 
bool IsLegacy () override
 
bool SupportsRealtime () override
 
bool SupportsAutomation () override
 
bool SetHost (EffectHostInterface *host) override
 
unsigned GetAudioInCount () override
 
unsigned GetAudioOutCount () override
 
int GetMidiInCount () override
 
int GetMidiOutCount () override
 
sampleCount GetLatency () override
 
size_t GetTailSize () override
 
void SetSampleRate (double rate) override
 
size_t SetBlockSize (size_t maxBlockSize) override
 
bool IsReady () override
 
bool ProcessInitialize (sampleCount totalLen, ChannelNames chanMap=NULL) override
 
bool ProcessFinalize () override
 
size_t ProcessBlock (float **inBlock, float **outBlock, size_t blockLen) override
 
bool RealtimeInitialize () override
 
bool RealtimeAddProcessor (unsigned numChannels, float sampleRate) override
 
bool RealtimeFinalize () override
 
bool RealtimeSuspend () override
 
bool RealtimeResume () override
 
bool RealtimeProcessStart () override
 
size_t RealtimeProcess (int group, float **inbuf, float **outbuf, size_t numSamples) override
 
bool RealtimeProcessEnd () override
 
bool ShowInterface (wxWindow *parent, bool forceModal=false) override
 
bool LoadUserPreset (const wxString &name) override
 
bool SaveUserPreset (const wxString &name) override
 
wxArrayString GetFactoryPresets () override
 
bool LoadFactoryPreset (int id) override
 
bool LoadFactoryDefaults () override
 
void SetHostUI (EffectUIHostInterface *host) override
 
bool PopulateUI (wxWindow *parent) override
 
bool IsGraphicalUI () override
 
bool ValidateUI () override
 
bool HideUI () override
 
bool CloseUI () override
 
bool CanExportPresets () override
 
void ExportPresets () override
 
void ImportPresets () override
 
bool HasOptions () override
 
void ShowOptions () override
 
double GetDefaultDuration () override
 
double GetDuration () override
 
NumericFormatId GetDurationFormat () override
 
virtual NumericFormatId GetSelectionFormat ()
 
void SetDuration (double duration) override
 
bool Apply () override
 
void Preview () override
 
wxDialog * CreateUI (wxWindow *parent, EffectUIClientInterface *client) override
 
wxString GetUserPresetsGroup (const wxString &name) override
 
wxString GetCurrentSettingsGroup () override
 
wxString GetFactoryDefaultsGroup () override
 
virtual wxString GetSavedStateGroup ()
 
bool HasSharedConfigGroup (const wxString &group) override
 
bool GetSharedConfigSubgroups (const wxString &group, wxArrayString &subgroups) override
 
bool GetSharedConfig (const wxString &group, const wxString &key, wxString &value, const wxString &defval=wxEmptyString) override
 
bool GetSharedConfig (const wxString &group, const wxString &key, int &value, int defval=0) override
 
bool GetSharedConfig (const wxString &group, const wxString &key, bool &value, bool defval=false) override
 
bool GetSharedConfig (const wxString &group, const wxString &key, float &value, float defval=0.0) override
 
bool GetSharedConfig (const wxString &group, const wxString &key, double &value, double defval=0.0) override
 
bool SetSharedConfig (const wxString &group, const wxString &key, const wxString &value) override
 
bool SetSharedConfig (const wxString &group, const wxString &key, const int &value) override
 
bool SetSharedConfig (const wxString &group, const wxString &key, const bool &value) override
 
bool SetSharedConfig (const wxString &group, const wxString &key, const float &value) override
 
bool SetSharedConfig (const wxString &group, const wxString &key, const double &value) override
 
bool RemoveSharedConfigSubgroup (const wxString &group) override
 
bool RemoveSharedConfig (const wxString &group, const wxString &key) override
 
bool HasPrivateConfigGroup (const wxString &group) override
 
bool GetPrivateConfigSubgroups (const wxString &group, wxArrayString &subgroups) override
 
bool GetPrivateConfig (const wxString &group, const wxString &key, wxString &value, const wxString &defval=wxEmptyString) override
 
bool GetPrivateConfig (const wxString &group, const wxString &key, int &value, int defval=0) override
 
bool GetPrivateConfig (const wxString &group, const wxString &key, bool &value, bool defval=false) override
 
bool GetPrivateConfig (const wxString &group, const wxString &key, float &value, float defval=0.0) override
 
bool GetPrivateConfig (const wxString &group, const wxString &key, double &value, double defval=0.0) override
 
bool SetPrivateConfig (const wxString &group, const wxString &key, const wxString &value) override
 
bool SetPrivateConfig (const wxString &group, const wxString &key, const int &value) override
 
bool SetPrivateConfig (const wxString &group, const wxString &key, const bool &value) override
 
bool SetPrivateConfig (const wxString &group, const wxString &key, const float &value) override
 
bool SetPrivateConfig (const wxString &group, const wxString &key, const double &value) override
 
bool RemovePrivateConfigSubgroup (const wxString &group) override
 
bool RemovePrivateConfig (const wxString &group, const wxString &key) override
 
virtual PluginID GetID ()
 
virtual bool Startup (EffectClientInterface *client)
 
virtual bool GetAutomationParameters (wxString &parms)
 
virtual bool SetAutomationParameters (const wxString &parms)
 
virtual wxArrayString GetUserPresets ()
 
virtual bool HasCurrentSettings ()
 
virtual bool HasFactoryDefaults ()
 
virtual wxString GetPreset (wxWindow *parent, const wxString &parms)
 
virtual wxString HelpPage ()
 
virtual bool IsBatchProcessing ()
 
virtual void SetBatchProcessing (bool start)
 
void SetPresetParameters (const wxArrayString *Names, const wxArrayString *Values)
 
bool DoEffect (wxWindow *parent, double projectRate, TrackList *list, TrackFactory *factory, SelectedRegion *selectedRegion, bool shouldPrompt=true)
 
bool Delegate (Effect &delegate, wxWindow *parent, bool shouldPrompt)
 
bool RealtimeAddProcessor (int group, unsigned chans, float rate)
 
size_t RealtimeProcess (int group, unsigned chans, float **inbuf, float **outbuf, size_t numSamples)
 
bool IsRealtimeActive ()
 
virtual bool IsHidden ()
 
int MessageBox (const wxString &message, long style=DefaultMessageBoxStyle, const wxString &titleStr=wxString{})
 
- Public Member Functions inherited from EffectClientInterface
virtual ~EffectClientInterface ()
 
- Public Member Functions inherited from EffectDefinitionInterface
virtual ~EffectDefinitionInterface ()
 
virtual EffectType GetClassification ()
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
const wxString & GetTranslatedName ()
 
virtual bool DefineParams (ShuttleParams &WXUNUSED(S))
 
- Public Member Functions inherited from EffectUIClientInterface
virtual ~EffectUIClientInterface ()
 
- Public Member Functions inherited from EffectHostInterface
virtual ~EffectHostInterface ()
 
- Public Member Functions inherited from ConfigClientInterface
virtual ~ConfigClientInterface ()
 

Private Types

enum  AnalyseOperation { ANALYSE_DC, ANALYSE_LOUDNESS, ANALYSE_LOUDNESS_DC }
 

Private Member Functions

bool ProcessOne (WaveTrack *t, const wxString &msg, double &progress, float offset)
 
bool AnalyseTrack (const WaveTrack *track, const wxString &msg, double &progress, float &offset, float &extent)
 
bool AnalyseTrackData (const WaveTrack *track, const wxString &msg, double &progress, AnalyseOperation op, float &offset)
 
void AnalyseDataDC (float *buffer, size_t len)
 
void ProcessData (float *buffer, size_t len, float offset)
 
void OnUpdateUI (wxCommandEvent &evt)
 
void UpdateUI ()
 

Private Attributes

double mPeakLevel
 
bool mGain
 
bool mDC
 
bool mStereoInd
 
double mCurT0
 
double mCurT1
 
float mMult
 
double mSum
 
sampleCount mCount
 
wxCheckBox * mGainCheckBox
 
wxCheckBox * mDCCheckBox
 
wxTextCtrl * mLevelTextCtrl
 
wxStaticText * mLeveldB
 
wxStaticText * mWarning
 
wxCheckBox * mStereoIndCheckBox
 
bool mCreating
 

Additional Inherited Members

- Public Types inherited from Effect
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
- Static Public Member Functions inherited from Effect
static void IncEffectCounter ()
 
- Protected Member Functions inherited from Effect
virtual bool Init ()
 
virtual bool PromptUser (wxWindow *parent)
 
virtual bool ProcessPass ()
 
virtual bool InitPass1 ()
 
virtual bool InitPass2 ()
 
virtual int GetPass ()
 
virtual void End ()
 
virtual double CalcPreviewInputLength (double previewLength)
 
virtual void Preview (bool dryOnly)
 
virtual bool EnableApply (bool enable=true)
 
virtual bool EnablePreview (bool enable=true)
 
virtual void EnableDebug (bool enable=true)
 
bool TotalProgress (double frac, const wxString &=wxEmptyString)
 
bool TrackProgress (int whichTrack, double frac, const wxString &=wxEmptyString)
 
bool TrackGroupProgress (int whichGroup, double frac, const wxString &=wxEmptyString)
 
int GetNumWaveTracks ()
 
int GetNumWaveGroups ()
 
void GetSamples (const WaveTrack *track, sampleCount *start, sampleCount *len)
 
void SetLinearEffectFlag (bool linearEffectFlag)
 
void SetPreviewFullSelectionFlag (bool previewDurationFlag)
 
bool IsPreviewing ()
 
void IncludeNotSelectedPreviewTracks (bool includeNotSelected)
 
void CopyInputTracks (bool allSyncLockSelected=false)
 
std::shared_ptr
< AddedAnalysisTrack
AddAnalysisTrack (const wxString &name=wxString())
 
ModifiedAnalysisTrack ModifyAnalysisTrack (const LabelTrack *pOrigTrack, const wxString &name=wxString())
 
void ReplaceProcessedTracks (const bool bGoodResult)
 
TrackAddToOutputTracks (std::unique_ptr< Track > &&t)
 
const TrackListinputTracks () const
 
- Protected Attributes inherited from Effect
ProgressDialogmProgress
 
double mProjectRate
 
double mSampleRate
 
SelectedRegionmpSelectedRegion {}
 
TrackFactorymFactory
 
std::shared_ptr< TrackListmOutputTracks
 
double mT0
 
double mT1
 
double mF0
 
double mF1
 
wxArrayString mPresetNames
 
wxArrayString mPresetValues
 
int mPass
 
wxDialog * mUIDialog
 
wxWindow * mUIParent
 
int mUIResultID
 
sampleCount mSampleCnt
 
- Static Protected Attributes inherited from Effect
static int nEffectsDone =0
 

Detailed Description

An Effect to bring the peak level up to a chosen level.

Definition at line 29 of file Normalize.h.

Member Enumeration Documentation

Enumerator
ANALYSE_DC 
ANALYSE_LOUDNESS 
ANALYSE_LOUDNESS_DC 

Definition at line 63 of file Normalize.h.

Constructor & Destructor Documentation

EffectNormalize::EffectNormalize ( )

Definition at line 50 of file Normalize.cpp.

51 {
52  mPeakLevel = DEF_PeakLevel;
53  mDC = DEF_RemoveDC;
54  mGain = DEF_ApplyGain;
55  mStereoInd = DEF_StereoInd;
56 #ifdef EXPERIMENTAL_R128_NORM
57  mLUFSLevel = DEF_LUFSLevel;
58  mUseLoudness = DEF_UseLoudness;
59 #endif
60 
61  SetLinearEffectFlag(false);
62 }
void SetLinearEffectFlag(bool linearEffectFlag)
Definition: Effect.cpp:1973
double mPeakLevel
Definition: Normalize.h:90
EffectNormalize::~EffectNormalize ( )
virtual

Definition at line 64 of file Normalize.cpp.

65 {
66 }

Member Function Documentation

void EffectNormalize::AnalyseDataDC ( float *  buffer,
size_t  len 
)
private
See Also
AnalyseDataLoudnessDC

Definition at line 648 of file Normalize.cpp.

References mCount, and mSum.

Referenced by AnalyseTrackData().

649 {
650  for(decltype(len) i = 0; i < len; i++)
651  mSum += (double)buffer[i];
652  mCount += len;
653 }
sampleCount mCount
Definition: Normalize.h:107
bool EffectNormalize::AnalyseTrack ( const WaveTrack track,
const wxString &  msg,
double &  progress,
float &  offset,
float &  extent 
)
private

Definition at line 440 of file Normalize.cpp.

References _(), ANALYSE_DC, ANALYSE_LOUDNESS, ANALYSE_LOUDNESS_DC, AnalyseTrackData(), sampleCount::as_double(), Cancelled, WaveTrack::GetMinMax(), WaveTrack::GetODFlags(), WaveTrack::GetRate(), mCount, mCurT0, mCurT1, mDC, mGain, min(), Effect::mProgress, and ProgressDialog::Update().

Referenced by Process().

442 {
443  bool result = true;
444  float min, max;
445 
446  if(mGain)
447  {
448 #ifdef EXPERIMENTAL_R128_NORM
449  if(mUseLoudness)
450  {
451  CalcEBUR128HPF(track->GetRate());
452  CalcEBUR128HSF(track->GetRate());
453  if(mDC)
454  {
455  result = AnalyseTrackData(track, msg, progress, ANALYSE_LOUDNESS_DC, offset);
456  }
457  else
458  {
459  result = AnalyseTrackData(track, msg, progress, ANALYSE_LOUDNESS, offset);
460  offset = 0.0;
461  }
462 
463  // EBU R128: z_i = mean square without root
464  extent = mSqSum / mCount.as_double();
465  }
466  else
467  {
468 #endif
469  // Since we need complete summary data, we need to block until the OD tasks are done for this track
470  // This is needed for track->GetMinMax
471  // TODO: should we restrict the flags to just the relevant block files (for selections)
472  while (track->GetODFlags()) {
473  // update the gui
475  0, _("Waiting for waveform to finish computing...")) )
476  return false;
477  wxMilliSleep(100);
478  }
479 
480  // set mMin, mMax. No progress bar here as it's fast.
481  auto pair = track->GetMinMax(mCurT0, mCurT1); // may throw
482  min = pair.first, max = pair.second;
483 
484  if(mDC)
485  {
486  result = AnalyseTrackData(track, msg, progress, ANALYSE_DC, offset);
487  min += offset;
488  max += offset;
489  }
490 #ifdef EXPERIMENTAL_R128_NORM
491  }
492 #endif
493  }
494  else if(mDC)
495  {
496  min = -1.0, max = 1.0; // sensible defaults?
497  result = AnalyseTrackData(track, msg, progress, ANALYSE_DC, offset);
498  min += offset;
499  max += offset;
500  }
501  else
502  {
503  wxFAIL_MSG("Analysing Track when nothing to do!");
504  min = -1.0, max = 1.0; // sensible defaults?
505  offset = 0.0;
506  }
507 #ifdef EXPERIMENTAL_R128_NORM
508  if(!mUseLoudness)
509 #endif
510  extent = fmax(fabs(min), fabs(max));
511 
512  return result;
513 }
ProgressDialog * mProgress
Definition: Effect.h:456
unsigned int GetODFlags() const
gets an int with OD flags so that we can determine which ODTasks should be run on this track after sa...
Definition: WaveTrack.cpp:1604
double as_double() const
Definition: Types.h:88
ProgressResult Update(int value, const wxString &message=wxEmptyString)
bool AnalyseTrackData(const WaveTrack *track, const wxString &msg, double &progress, AnalyseOperation op, float &offset)
Definition: Normalize.cpp:517
int min(int a, int b)
sampleCount mCount
Definition: Normalize.h:107
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
std::pair< float, float > GetMinMax(double t0, double t1, bool mayThrow=true) const
Definition: WaveTrack.cpp:1919
double GetRate() const
Definition: WaveTrack.cpp:401
bool EffectNormalize::AnalyseTrackData ( const WaveTrack track,
const wxString &  msg,
double &  progress,
AnalyseOperation  op,
float &  offset 
)
private

Definition at line 517 of file Normalize.cpp.

References ANALYSE_DC, ANALYSE_LOUDNESS, ANALYSE_LOUDNESS_DC, AnalyseDataDC(), sampleCount::as_double(), fillZero, floatSample, WaveTrack::Get(), WaveTrack::GetBestBlockSize(), WaveTrack::GetMaxBlockSize(), Effect::GetNumWaveTracks(), limitSampleBufferSize(), mCount, mCurT0, mCurT1, mSum, WaveTrack::TimeToLongSamples(), and Effect::TotalProgress().

Referenced by AnalyseTrack().

519 {
520  bool rc = true;
521 
522  //Transform the marker timepoints to samples
523  auto start = track->TimeToLongSamples(mCurT0);
524  auto end = track->TimeToLongSamples(mCurT1);
525 
526  //Get the length of the buffer (as double). len is
527  //used simply to calculate a progress meter, so it is easier
528  //to make it a double now than it is to do it later
529  auto len = (end - start).as_double();
530 
531  //Initiate a processing buffer. This buffer will (most likely)
532  //be shorter than the length of the track being processed.
533  Floats buffer{ track->GetMaxBlockSize() };
534 
535  mSum = 0.0; // dc offset inits
536  mCount = 0;
537 #ifdef EXPERIMENTAL_R128_NORM
538  mSqSum = 0.0; // rms init
539 #endif
540 
541  sampleCount blockSamples;
542  sampleCount totalSamples = 0;
543 
544  //Go through the track one buffer at a time. s counts which
545  //sample the current buffer starts at.
546  auto s = start;
547  while (s < end) {
548  //Get a block of samples (smaller than the size of the buffer)
549  //Adjust the block size if it is the final block in the track
550  const auto block = limitSampleBufferSize(
551  track->GetBestBlockSize(s),
552  end - s
553  );
554 
555  //Get the samples from the track and put them in the buffer
556  track->Get((samplePtr) buffer.get(), floatSample, s, block, fillZero, true, &blockSamples);
557  totalSamples += blockSamples;
558 
559  //Process the buffer.
560  if(op == ANALYSE_DC)
561  AnalyseDataDC(buffer.get(), block);
562 #ifdef EXPERIMENTAL_R128_NORM
563  else if(op == ANALYSE_LOUDNESS)
564  AnalyseDataLoudness(buffer.get(), block);
565  else if(op == ANALYSE_LOUDNESS_DC)
566  AnalyseDataLoudnessDC(buffer.get(), block);
567 #endif
568 
569  //Increment s one blockfull of samples
570  s += block;
571 
572  //Update the Progress meter
573  if (TotalProgress(progress +
574  ((s - start).as_double() / len)/double(2*GetNumWaveTracks()), msg)) {
575  rc = false; //lda .. break, not return, so that buffer is deleted
576  break;
577  }
578  }
579  if( totalSamples > 0 )
580  offset = -mSum / totalSamples.as_double(); // calculate actual offset (amount that needs to be added on)
581  else
582  offset = 0.0;
583 
584  progress += 1.0/double(2*GetNumWaveTracks());
585  //Return true because the effect processing succeeded ... unless cancelled
586  return rc;
587 }
double as_double() const
Definition: Types.h:88
size_t GetBestBlockSize(sampleCount t) const
Definition: WaveTrack.cpp:1628
size_t limitSampleBufferSize(size_t bufferSize, sampleCount limit)
Definition: Types.h:178
bool TotalProgress(double frac, const wxString &=wxEmptyString)
Definition: Effect.cpp:1989
char * samplePtr
Definition: Types.h:203
size_t GetMaxBlockSize() const
Definition: WaveTrack.cpp:1646
sampleCount mCount
Definition: Normalize.h:107
int GetNumWaveTracks()
Definition: Effect.h:345
sampleCount TimeToLongSamples(double t0) const
Convert correctly between an (absolute) time in seconds and a number of samples.
Definition: WaveTrack.cpp:1864
void AnalyseDataDC(float *buffer, size_t len)
Definition: Normalize.cpp:648
bool Get(samplePtr buffer, sampleFormat format, sampleCount start, size_t len, fillFormat fill=fillZero, bool mayThrow=true, sampleCount *pNumCopied=nullptr) const
Definition: WaveTrack.cpp:1992
bool EffectNormalize::CheckWhetherSkipEffect ( )
overridevirtual

Reimplemented from Effect.

Definition at line 148 of file Normalize.cpp.

References mDC, and mGain.

149 {
150  return ((mGain == false) && (mDC == false));
151 }
bool EffectNormalize::DefineParams ( ShuttleParams S)
override

Definition at line 97 of file Normalize.cpp.

References mDC, mGain, mPeakLevel, and mStereoInd.

97  {
98  S.SHUTTLE_PARAM( mPeakLevel, PeakLevel );
99  S.SHUTTLE_PARAM( mGain, ApplyGain );
100  S.SHUTTLE_PARAM( mDC, RemoveDC );
101  S.SHUTTLE_PARAM( mStereoInd, StereoInd );
102 #ifdef EXPERIMENTAL_R128_NORM
103  S.SHUTTLE_PARAM( mLUFSLevel, LUFSLevel );
104  S.SHUTTLE_PARAM( mUseLoudness, UseLoudness );
105 #endif
106  return true;
107 }
double mPeakLevel
Definition: Normalize.h:90
bool EffectNormalize::GetAutomationParameters ( CommandParameters parms)
overridevirtual

Reimplemented from Effect.

Definition at line 109 of file Normalize.cpp.

References mDC, mGain, mPeakLevel, and mStereoInd.

110 {
111  parms.Write(KEY_PeakLevel, mPeakLevel);
112  parms.Write(KEY_ApplyGain, mGain);
113  parms.Write(KEY_RemoveDC, mDC);
114  parms.Write(KEY_StereoInd, mStereoInd);
115 #ifdef EXPERIMENTAL_R128_NORM
116  parms.Write(KEY_LUFSLevel, mLUFSLevel);
117  parms.Write(KEY_UseLoudness, mUseLoudness);
118 #endif
119 
120  return true;
121 }
double mPeakLevel
Definition: Normalize.h:90
wxString EffectNormalize::GetDescription ( )
overridevirtual

Reimplemented from Effect.

Definition at line 75 of file Normalize.cpp.

References _().

76 {
77 #ifdef EXPERIMENTAL_R128_NORM
78  return _("Sets the peak amplitude or loudness of one or more tracks");
79 #else
80  return _("Sets the peak amplitude of one or more tracks");
81 #endif
82 }
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
ComponentInterfaceSymbol EffectNormalize::GetSymbol ( )
overridevirtual

Reimplemented from Effect.

Definition at line 70 of file Normalize.cpp.

References NORMALIZE_PLUGIN_SYMBOL.

71 {
73 }
#define NORMALIZE_PLUGIN_SYMBOL
Definition: Normalize.h:27
EffectType EffectNormalize::GetType ( )
overridevirtual

Reimplemented from Effect.

Definition at line 91 of file Normalize.cpp.

References EffectTypeProcess.

92 {
93  return EffectTypeProcess;
94 }
wxString EffectNormalize::ManualPage ( )
overridevirtual

Reimplemented from Effect.

Definition at line 84 of file Normalize.cpp.

85 {
86  return wxT("Normalize");
87 }
void EffectNormalize::OnUpdateUI ( wxCommandEvent &  evt)
private

Definition at line 747 of file Normalize.cpp.

References UpdateUI().

748 {
749  UpdateUI();
750 }
void EffectNormalize::PopulateOrExchange ( ShuttleGui S)
overridevirtual

Reimplemented from Effect.

Definition at line 350 of file Normalize.cpp.

References _(), ShuttleGuiBase::AddCheckBox(), ShuttleGuiBase::AddTextBox(), ShuttleGuiBase::AddVariableText(), ShuttleGuiBase::EndHorizontalLay(), ShuttleGuiBase::EndMultiColumn(), ShuttleGuiBase::EndVerticalLay(), mCreating, mDC, mDCCheckBox, mGain, mGainCheckBox, mLeveldB, mLevelTextCtrl, mPeakLevel, mStereoInd, mStereoIndCheckBox, mWarning, ShuttleGuiBase::StartHorizontalLay(), ShuttleGuiBase::StartMultiColumn(), and ShuttleGuiBase::StartVerticalLay().

351 {
352  mCreating = true;
353 
354  S.StartVerticalLay(0);
355  {
356  S.StartMultiColumn(2, wxALIGN_CENTER);
357  {
358  S.StartVerticalLay(false);
359  {
360  mDCCheckBox = S.AddCheckBox(_("Remove DC offset (center on 0.0 vertically)"),
361  mDC ? wxT("true") : wxT("false"));
362  mDCCheckBox->SetValidator(wxGenericValidator(&mDC));
363 
364  S.StartHorizontalLay(wxALIGN_LEFT, false);
365  {
366  // The checkbox needs to be sized for the longer prompt, and
367  // which that is will depend on translation. So decide that here.
368  // (strictly we should count pixels, not characters).
369  wxString prompt1 = _("Normalize peak amplitude to");
370 #ifdef EXPERIMENTAL_R128_NORM
371  wxString prompt2 = _("Normalize loudness to");
372  wxString longerPrompt = ((prompt1.Length() > prompt2.Length()) ? prompt1 : prompt2) + " ";
373 #else
374  wxString longerPrompt = prompt1 + " ";
375 #endif
376  // Now make the checkbox.
377  mGainCheckBox = S.AddCheckBox(longerPrompt,
378  mGain ? wxT("true") : wxT("false"));
379  mGainCheckBox->SetValidator(wxGenericValidator(&mGain));
380  mGainCheckBox->SetMinSize( mGainCheckBox->GetSize());
381 
382  FloatingPointValidator<double> vldLevel(2, &mPeakLevel,
383  NumValidatorStyle::ONE_TRAILING_ZERO);
384  vldLevel.SetRange( MIN_PeakLevel, MAX_PeakLevel);
385 
386  mLevelTextCtrl = S.AddTextBox( {}, wxT(""), 10);
387  mLevelTextCtrl->SetName( _("Peak amplitude dB"));
388  mLevelTextCtrl->SetValidator(vldLevel);
389  mLeveldB = S.AddVariableText(_("dB"), false,
390  wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
391  mWarning = S.AddVariableText( {}, false,
392  wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
393  }
394  S.EndHorizontalLay();
395 #ifdef EXPERIMENTAL_R128_NORM
396  mUseLoudnessCheckBox = S.AddCheckBox(_("Use loudness instead of peak amplitude"),
397  mUseLoudness ? wxT("true") : wxT("false"));
398  mUseLoudnessCheckBox->SetValidator(wxGenericValidator(&mGUIUseLoudness));
399 #endif
400  mStereoIndCheckBox = S.AddCheckBox(_("Normalize stereo channels independently"),
401  mStereoInd ? wxT("true") : wxT("false"));
402  mStereoIndCheckBox->SetValidator(wxGenericValidator(&mStereoInd));
403  }
404  S.EndVerticalLay();
405  }
406  S.EndMultiColumn();
407  }
408  S.EndVerticalLay();
409 #ifdef EXPERIMENTAL_R128_NORM
410  // To ensure that the UpdateUI on creation sets the prompts correctly.
411  mUseLoudness = !mGUIUseLoudness;
412 #endif
413  mCreating = false;
414 }
wxCheckBox * mDCCheckBox
Definition: Normalize.h:110
void EndMultiColumn()
wxCheckBox * mGainCheckBox
Definition: Normalize.h:109
double mPeakLevel
Definition: Normalize.h:90
wxTextCtrl * mLevelTextCtrl
Definition: Normalize.h:111
void EndHorizontalLay()
void EndVerticalLay()
wxTextCtrl * AddTextBox(const wxString &Caption, const wxString &Value, const int nChars)
Definition: ShuttleGui.cpp:548
wxStaticText * mWarning
Definition: Normalize.h:113
wxCheckBox * AddCheckBox(const wxString &Prompt, const wxString &Selected)
Definition: ShuttleGui.cpp:298
void StartHorizontalLay(int PositionFlags=wxALIGN_CENTRE, int iProp=1)
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
wxStaticText * mLeveldB
Definition: Normalize.h:112
wxStaticText * AddVariableText(const wxString &Str, bool bCenter=false, int PositionFlags=0)
Definition: ShuttleGui.cpp:422
wxCheckBox * mStereoIndCheckBox
Definition: Normalize.h:114
void StartVerticalLay(int iProp=1)
bool EffectNormalize::Process ( )
overridevirtual

Reimplemented from Effect.

Definition at line 192 of file Normalize.cpp.

References _(), AnalyseTrack(), Track::Any(), TrackList::Channels(), Effect::CopyInputTracks(), DB_TO_LINEAR(), Track::IsLeader(), mCurT0, mCurT1, mDC, mGain, mMult, Effect::mOutputTracks, mPeakLevel, mStereoInd, Effect::mT0, Effect::mT1, ProcessOne(), Effect::ReplaceProcessedTracks(), TrackList::SingletonRange(), and TrapDouble().

193 {
194  if (mGain == false && mDC == false)
195  return true;
196 
197  float ratio;
198  if( mGain )
199  {
200 #ifdef EXPERIMENTAL_R128_NORM
201  if(mUseLoudness) {
202  // LU use 10*log10(...) instead of 20*log10(...)
203  // so multiply level by 2 and use standard DB_TO_LINEAR macro.
204  ratio = DB_TO_LINEAR(TrapDouble(mLUFSLevel*2, MIN_LUFSLevel, MAX_LUFSLevel));
205  }
206  else {
207  // same value used for all tracks
208  ratio = DB_TO_LINEAR(TrapDouble(mPeakLevel, MIN_PeakLevel, MAX_PeakLevel));
209  }
210 #else
211  // same value used for all tracks
212  ratio = DB_TO_LINEAR(TrapDouble(mPeakLevel, MIN_PeakLevel, MAX_PeakLevel));
213 #endif
214  }
215  else {
216  ratio = 1.0;
217  }
218 
219  //Iterate over each track
220  this->CopyInputTracks(); // Set up mOutputTracks.
221  bool bGoodResult = true;
222  double progress = 0;
223  wxString topMsg;
224  if(mDC && mGain)
225  topMsg = _("Removing DC offset and Normalizing...\n");
226  else if(mDC && !mGain)
227  topMsg = _("Removing DC offset...\n");
228  else if(!mDC && mGain)
229  topMsg = _("Normalizing without removing DC offset...\n");
230  else if(!mDC && !mGain)
231  topMsg = _("Not doing anything...\n"); // shouldn't get here
232 
233  for ( auto track : mOutputTracks->Selected< WaveTrack >()
234  + ( mStereoInd ? &Track::Any : &Track::IsLeader ) ) {
235  //Get start and end times from track
236  // PRL: No accounting for multiple channels?
237  double trackStart = track->GetStartTime();
238  double trackEnd = track->GetEndTime();
239 
240  //Set the current bounds to whichever left marker is
241  //greater and whichever right marker is less:
242  mCurT0 = mT0 < trackStart? trackStart: mT0;
243  mCurT1 = mT1 > trackEnd? trackEnd: mT1;
244 
245  auto range = mStereoInd
247  : TrackList::Channels(track);
248 
249  // Process only if the right marker is to the right of the left marker
250  if (mCurT1 > mCurT0) {
251  wxString trackName = track->GetName();
252 
253  float extent;
254 #ifdef EXPERIMENTAL_R128_NORM
255  if (mUseLoudness)
256  // Loudness: use sum of both tracks.
257  // As a result, stereo tracks appear about 3 LUFS louder,
258  // as specified.
259  extent = 0;
260  else
261 #endif
262  // Will compute a maximum
263  extent = std::numeric_limits<float>::lowest();
264  std::vector<float> offsets;
265 
266  wxString msg;
267  if (range.size() == 1)
268  // mono or 'stereo tracks independently'
269  msg = topMsg +
270  wxString::Format( _("Analyzing: %s"), trackName );
271  else
272  msg = topMsg +
273  // TODO: more-than-two-channels-message
274  wxString::Format( _("Analyzing first track of stereo pair: %s"), trackName);
275 
276  // Analysis loop over channels collects offsets and extent
277  for (auto channel : range) {
278  float offset = 0;
279  float extent2 = 0;
280  bGoodResult =
281  AnalyseTrack( channel, msg, progress, offset, extent2 );
282  if ( ! bGoodResult )
283  goto break2;
284 #ifdef EXPERIMENTAL_R128_NORM
285  if (mUseLoudness)
286  extent += extent2;
287  else
288 #endif
289  extent = std::max( extent, extent2 );
290  offsets.push_back(offset);
291  // TODO: more-than-two-channels-message
292  msg = topMsg +
293  wxString::Format( _("Analyzing second track of stereo pair: %s"), trackName );
294  }
295 
296  // Compute the multiplier using extent
297  if( (extent > 0) && mGain ) {
298  mMult = ratio / extent;
299 #ifdef EXPERIMENTAL_R128_NORM
300  if(mUseLoudness) {
301  // PRL: See commit 9cbb67a for the origin of the next line,
302  // which has no effect because mMult is again overwritten. What
303  // was the intent?
304 
305  // LUFS is defined as -0.691 dB + 10*log10(sum(channels))
306  mMult /= 0.8529037031;
307  // LUFS are related to square values so the multiplier must be the root.
308  mMult = sqrt(ratio / extent);
309  }
310 #endif
311  }
312  else
313  mMult = 1.0;
314 
315  if (range.size() == 1) {
316  if (TrackList::Channels(track).size() == 1)
317  // really mono
318  msg = topMsg +
319  wxString::Format( _("Processing: %s"), trackName );
320  else
321  //'stereo tracks independently'
322  // TODO: more-than-two-channels-message
323  msg = topMsg +
324  wxString::Format( _("Processing stereo channels independently: %s"), trackName);
325  }
326  else
327  msg = topMsg +
328  // TODO: more-than-two-channels-message
329  wxString::Format( _("Processing first track of stereo pair: %s"), trackName);
330 
331  // Use multiplier in the second, processing loop over channels
332  auto pOffset = offsets.begin();
333  for (auto channel : range) {
334  if (false ==
335  (bGoodResult = ProcessOne(channel, msg, progress, *pOffset++)) )
336  goto break2;
337  // TODO: more-than-two-channels-message
338  msg = topMsg +
339  wxString::Format( _("Processing second track of stereo pair: %s"), trackName);
340  }
341  }
342  }
343 
344  break2:
345 
346  this->ReplaceProcessedTracks(bGoodResult);
347  return bGoodResult;
348 }
double mT1
Definition: Effect.h:465
void ReplaceProcessedTracks(const bool bGoodResult)
Definition: Effect.cpp:2169
static auto SingletonRange(TrackType *pTrack) -> TrackIterRange< TrackType >
Definition: Track.h:1314
double mPeakLevel
Definition: Normalize.h:90
bool ProcessOne(WaveTrack *t, const wxString &msg, double &progress, float offset)
Definition: Normalize.cpp:593
bool Any() const
Definition: Track.cpp:439
A Track that contains audio waveform data.
Definition: WaveTrack.h:60
bool AnalyseTrack(const WaveTrack *track, const wxString &msg, double &progress, float &offset, float &extent)
Definition: Normalize.cpp:440
void CopyInputTracks(bool allSyncLockSelected=false)
Definition: Effect.cpp:2049
double TrapDouble(double x, double min, double max)
Definition: Effect.h:730
bool IsLeader() const
Definition: Track.cpp:448
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
const double MIN_Threshold_Linear DB_TO_LINEAR(MIN_Threshold_dB)
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
Definition: Track.h:1356
std::shared_ptr< TrackList > mOutputTracks
Definition: Effect.h:463
double mT0
Definition: Effect.h:464
void EffectNormalize::ProcessData ( float *  buffer,
size_t  len,
float  offset 
)
private

Definition at line 689 of file Normalize.cpp.

References mMult.

Referenced by ProcessOne().

690 {
691  for(decltype(len) i = 0; i < len; i++) {
692  float adjFrame = (buffer[i] + offset) * mMult;
693  buffer[i] = adjFrame;
694  }
695 }
bool EffectNormalize::ProcessOne ( WaveTrack t,
const wxString &  msg,
double &  progress,
float  offset 
)
private

Definition at line 593 of file Normalize.cpp.

References floatSample, WaveTrack::Get(), WaveTrack::GetBestBlockSize(), WaveTrack::GetMaxBlockSize(), Effect::GetNumWaveTracks(), limitSampleBufferSize(), mCurT0, mCurT1, ProcessData(), WaveTrack::Set(), WaveTrack::TimeToLongSamples(), and Effect::TotalProgress().

Referenced by Process().

595 {
596  bool rc = true;
597 
598  //Transform the marker timepoints to samples
599  auto start = track->TimeToLongSamples(mCurT0);
600  auto end = track->TimeToLongSamples(mCurT1);
601 
602  //Get the length of the buffer (as double). len is
603  //used simply to calculate a progress meter, so it is easier
604  //to make it a double now than it is to do it later
605  auto len = (end - start).as_double();
606 
607  //Initiate a processing buffer. This buffer will (most likely)
608  //be shorter than the length of the track being processed.
609  Floats buffer{ track->GetMaxBlockSize() };
610 
611  //Go through the track one buffer at a time. s counts which
612  //sample the current buffer starts at.
613  auto s = start;
614  while (s < end) {
615  //Get a block of samples (smaller than the size of the buffer)
616  //Adjust the block size if it is the final block in the track
617  const auto block = limitSampleBufferSize(
618  track->GetBestBlockSize(s),
619  end - s
620  );
621 
622  //Get the samples from the track and put them in the buffer
623  track->Get((samplePtr) buffer.get(), floatSample, s, block);
624 
625  //Process the buffer.
626  ProcessData(buffer.get(), block, offset);
627 
628  //Copy the newly-changed samples back onto the track.
629  track->Set((samplePtr) buffer.get(), floatSample, s, block);
630 
631  //Increment s one blockfull of samples
632  s += block;
633 
634  //Update the Progress meter
635  if (TotalProgress(progress +
636  ((s - start).as_double() / len)/double(2*GetNumWaveTracks()), msg)) {
637  rc = false; //lda .. break, not return, so that buffer is deleted
638  break;
639  }
640  }
641  progress += 1.0/double(2*GetNumWaveTracks());
642 
643  //Return true because the effect processing succeeded ... unless cancelled
644  return rc;
645 }
void ProcessData(float *buffer, size_t len, float offset)
Definition: Normalize.cpp:689
size_t limitSampleBufferSize(size_t bufferSize, sampleCount limit)
Definition: Types.h:178
bool TotalProgress(double frac, const wxString &=wxEmptyString)
Definition: Effect.cpp:1989
char * samplePtr
Definition: Types.h:203
int GetNumWaveTracks()
Definition: Effect.h:345
bool EffectNormalize::SetAutomationParameters ( CommandParameters parms)
overridevirtual

Reimplemented from Effect.

Definition at line 123 of file Normalize.cpp.

References mDC, mGain, mPeakLevel, mStereoInd, ReadAndVerifyBool, and ReadAndVerifyDouble.

124 {
125  ReadAndVerifyDouble(PeakLevel);
126  ReadAndVerifyBool(ApplyGain);
127  ReadAndVerifyBool(RemoveDC);
128  ReadAndVerifyBool(StereoInd);
129 #ifdef EXPERIMENTAL_R128_NORM
130  ReadAndVerifyDouble(LUFSLevel);
131  ReadAndVerifyBool(UseLoudness);
132 #endif
133 
134  mPeakLevel = PeakLevel;
135  mGain = ApplyGain;
136  mDC = RemoveDC;
137  mStereoInd = StereoInd;
138 #ifdef EXPERIMENTAL_R128_NORM
139  mLUFSLevel = LUFSLevel;
140  mUseLoudness = UseLoudness;
141 #endif
142 
143  return true;
144 }
double mPeakLevel
Definition: Normalize.h:90
#define ReadAndVerifyDouble(name)
Definition: Effect.h:799
#define ReadAndVerifyBool(name)
Definition: Effect.h:801
bool EffectNormalize::Startup ( )
overridevirtual

Reimplemented from Effect.

Definition at line 153 of file Normalize.cpp.

References Effect::GetCurrentSettingsGroup(), gPrefs, mDC, mGain, mPeakLevel, mStereoInd, and Effect::SaveUserPreset().

154 {
155  wxString base = wxT("/Effects/Normalize/");
156 
157  // Migrate settings from 2.1.0 or before
158 
159  // Already migrated, so bail
160  if (gPrefs->Exists(base + wxT("Migrated")))
161  {
162  return true;
163  }
164 
165  // Load the old "current" settings
166  if (gPrefs->Exists(base))
167  {
168  int boolProxy = gPrefs->Read(base + wxT("RemoveDcOffset"), 1);
169  mDC = (boolProxy == 1);
170  boolProxy = gPrefs->Read(base + wxT("Normalize"), 1);
171  mGain = (boolProxy == 1);
172  gPrefs->Read(base + wxT("Level"), &mPeakLevel, -1.0);
173  if(mPeakLevel > 0.0) // this should never happen
175  boolProxy = gPrefs->Read(base + wxT("StereoIndependent"), 0L);
176  mStereoInd = (boolProxy == 1);
177 #ifdef EXPERIMENTAL_R128_NORM
178  mUseLoudness = false;
179  mLUFSLevel = DEF_LUFSLevel;
180 #endif
181 
183 
184  // Do not migrate again
185  gPrefs->Write(base + wxT("Migrated"), true);
186  gPrefs->Flush();
187  }
188 
189  return true;
190 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
bool SaveUserPreset(const wxString &name) override
Definition: Effect.cpp:603
wxString GetCurrentSettingsGroup() override
Definition: Effect.cpp:805
double mPeakLevel
Definition: Normalize.h:90
bool EffectNormalize::TransferDataFromWindow ( )
overridevirtual

Reimplemented from Effect.

Definition at line 428 of file Normalize.cpp.

References Effect::mUIParent.

429 {
430  if (!mUIParent->Validate() || !mUIParent->TransferDataFromWindow())
431  {
432  return false;
433  }
434 
435  return true;
436 }
wxWindow * mUIParent
Definition: Effect.h:476
bool EffectNormalize::TransferDataToWindow ( )
overridevirtual

Reimplemented from Effect.

Definition at line 416 of file Normalize.cpp.

References Effect::mUIParent, and UpdateUI().

417 {
418  if (!mUIParent->TransferDataToWindow())
419  {
420  return false;
421  }
422 
423  UpdateUI();
424 
425  return true;
426 }
wxWindow * mUIParent
Definition: Effect.h:476
void EffectNormalize::UpdateUI ( void  )
private

Definition at line 752 of file Normalize.cpp.

References _(), Effect::EnableApply(), mDC, mGain, mGainCheckBox, mLeveldB, mLevelTextCtrl, mPeakLevel, mStereoIndCheckBox, Effect::mUIParent, and mWarning.

Referenced by OnUpdateUI(), and TransferDataToWindow().

753 {
754 
755  if (!mUIParent->TransferDataFromWindow())
756  {
757  mWarning->SetLabel(_("(Maximum 0dB)"));
758  EnableApply(false);
759  return;
760  }
761  mWarning->SetLabel(wxT(""));
762 
763 #ifdef EXPERIMENTAL_R128_NORM
764  // Changing the prompts causes an unwanted UpdateUI event.
765  // This 'guard' stops that becoming an infinite recursion.
766  if (mUseLoudness != mGUIUseLoudness)
767  {
768  mUseLoudness = mGUIUseLoudness;
769  if (mUseLoudness)
770  {
771  FloatingPointValidator<double> vldLevel(2, &mLUFSLevel, NumValidatorStyle::ONE_TRAILING_ZERO);
772  vldLevel.SetRange(MIN_LUFSLevel, MAX_LUFSLevel);
773  mLevelTextCtrl->SetValidator(vldLevel);
774  /* i18n-hint: LUFS is a particular method for measuring loudnesss */
775  mLevelTextCtrl->SetName(_("Loudness LUFS"));
776  mLevelTextCtrl->SetValue(wxString::FromDouble(mLUFSLevel));
777  /* i18n-hint: LUFS is a particular method for measuring loudnesss */
778  mLeveldB->SetLabel(_("LUFS"));
779  mGainCheckBox->SetLabelText(_("Normalize loudness to"));
780  }
781  else
782  {
783  FloatingPointValidator<double> vldLevel(2, &mPeakLevel, NumValidatorStyle::ONE_TRAILING_ZERO);
784  vldLevel.SetRange(MIN_PeakLevel, MAX_PeakLevel);
785  mLevelTextCtrl->SetValidator(vldLevel);
786  mLevelTextCtrl->SetName(_("Peak amplitude dB"));
787  mLevelTextCtrl->SetValue(wxString::FromDouble(mPeakLevel));
788  mLeveldB->SetLabel(_("dB"));
789  mGainCheckBox->SetLabelText(_("Normalize peak amplitude to"));
790  }
791  }
792 #endif
793 
794  // Disallow level stuff if not normalizing
795  mLevelTextCtrl->Enable(mGain);
796  mLeveldB->Enable(mGain);
797  mStereoIndCheckBox->Enable(mGain);
798 #ifdef EXPERIMENTAL_R128_NORM
799  mUseLoudnessCheckBox->Enable(mGain);
800 #endif
801 
802  // Disallow OK/Preview if doing nothing
803  EnableApply(mGain || mDC);
804 }
wxCheckBox * mGainCheckBox
Definition: Normalize.h:109
double mPeakLevel
Definition: Normalize.h:90
wxTextCtrl * mLevelTextCtrl
Definition: Normalize.h:111
wxStaticText * mWarning
Definition: Normalize.h:113
wxWindow * mUIParent
Definition: Effect.h:476
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
wxStaticText * mLeveldB
Definition: Normalize.h:112
wxCheckBox * mStereoIndCheckBox
Definition: Normalize.h:114
virtual bool EnableApply(bool enable=true)
Definition: Effect.cpp:1898

Member Data Documentation

sampleCount EffectNormalize::mCount
private

Definition at line 107 of file Normalize.h.

Referenced by AnalyseDataDC(), AnalyseTrack(), and AnalyseTrackData().

bool EffectNormalize::mCreating
private

Definition at line 121 of file Normalize.h.

Referenced by PopulateOrExchange().

double EffectNormalize::mCurT0
private

Definition at line 100 of file Normalize.h.

Referenced by AnalyseTrack(), AnalyseTrackData(), Process(), and ProcessOne().

double EffectNormalize::mCurT1
private

Definition at line 101 of file Normalize.h.

Referenced by AnalyseTrack(), AnalyseTrackData(), Process(), and ProcessOne().

bool EffectNormalize::mDC
private
wxCheckBox* EffectNormalize::mDCCheckBox
private

Definition at line 110 of file Normalize.h.

Referenced by PopulateOrExchange().

bool EffectNormalize::mGain
private
wxCheckBox* EffectNormalize::mGainCheckBox
private

Definition at line 109 of file Normalize.h.

Referenced by PopulateOrExchange(), and UpdateUI().

wxStaticText* EffectNormalize::mLeveldB
private

Definition at line 112 of file Normalize.h.

Referenced by PopulateOrExchange(), and UpdateUI().

wxTextCtrl* EffectNormalize::mLevelTextCtrl
private

Definition at line 111 of file Normalize.h.

Referenced by PopulateOrExchange(), and UpdateUI().

float EffectNormalize::mMult
private

Definition at line 102 of file Normalize.h.

Referenced by Process(), and ProcessData().

double EffectNormalize::mPeakLevel
private
bool EffectNormalize::mStereoInd
private
wxCheckBox* EffectNormalize::mStereoIndCheckBox
private

Definition at line 114 of file Normalize.h.

Referenced by PopulateOrExchange(), and UpdateUI().

double EffectNormalize::mSum
private

Definition at line 103 of file Normalize.h.

Referenced by AnalyseDataDC(), and AnalyseTrackData().

wxStaticText* EffectNormalize::mWarning
private

Definition at line 113 of file Normalize.h.

Referenced by PopulateOrExchange(), and UpdateUI().


The documentation for this class was generated from the following files: