Audacity  2.2.2
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
EffectCompressor Class Referencefinal

An Effect derived from EffectTwoPassSimpleMono. More...

#include <Compressor.h>

Inheritance diagram for EffectCompressor:
EffectTwoPassSimpleMono Effect EffectClientInterface EffectUIClientInterface EffectHostInterface EffectDefinitionInterface ConfigClientInterface IdentInterface ParamsInterface

Public Member Functions

 EffectCompressor ()
 
virtual ~EffectCompressor ()
 
IdentInterfaceSymbol 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 Startup () override
 
void PopulateOrExchange (ShuttleGui &S) override
 
bool TransferDataToWindow () override
 
bool TransferDataFromWindow () override
 
- Public Member Functions inherited from EffectTwoPassSimpleMono
bool Process () override
 
- Public Member Functions inherited from Effect
 Effect ()
 
virtual ~Effect ()
 
wxString GetPath () override
 
IdentInterfaceSymbol GetSymbol () override
 
IdentInterfaceSymbol GetVendor () override
 
wxString GetVersion () override
 
wxString GetDescription () override
 
EffectType GetType () override
 
IdentInterfaceSymbol 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 GetAutomationParameters (CommandParameters &parms) override
 
bool SetAutomationParameters (CommandParameters &parms) 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 ()
 
- Public Member Functions inherited from IdentInterface
virtual ~IdentInterface ()
 
const wxString & GetTranslatedName ()
 
- Public Member Functions inherited from ParamsInterface
virtual ~ParamsInterface ()
 
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 ()
 

Protected Member Functions

bool InitPass1 () override
 
bool InitPass2 () override
 
bool NewTrackPass1 () override
 
bool ProcessPass2 (float *buffer, size_t len) override
 
bool TwoBufferProcessPass1 (float *buffer1, size_t len1, float *buffer2, size_t len2) override
 
- Protected Member Functions inherited from EffectTwoPassSimpleMono
bool InitPass1 () override
 
bool InitPass2 () override
 
virtual bool NewTrackPass2 ()
 
virtual bool ProcessPass1 (float *WXUNUSED(buffer), size_t WXUNUSED(len))
 
virtual bool ProcessPass2 (float *WXUNUSED(buffer), size_t WXUNUSED(len))
 
virtual bool TwoBufferProcessPass1 (float *buffer1, size_t len1, float *WXUNUSED(buffer2), size_t WXUNUSED(len2))
 
virtual bool TwoBufferProcessPass2 (float *buffer1, size_t len1, float *WXUNUSED(buffer2), size_t WXUNUSED(len2))
 
void DisableSecondPass ()
 
- Protected Member Functions inherited from Effect
virtual bool Init ()
 
virtual bool PromptUser (wxWindow *parent)
 
virtual bool CheckWhetherSkipEffect ()
 
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)
 
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 ()
 
void CopyInputTracks (int trackType)
 
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)
 
TrackListinputTracks () const
 

Private Member Functions

void FreshenCircle ()
 
float AvgCircle (float x)
 
void Follow (float *buffer, float *env, size_t len, float *previous, size_t previous_len)
 
float DoCompression (float x, double env)
 
void OnSlider (wxCommandEvent &evt)
 
void UpdateUI ()
 

Private Attributes

double mRMSSum
 
size_t mCircleSize
 
size_t mCirclePos
 
Doubles mCircle
 
double mAttackTime
 
double mThresholdDB
 
double mNoiseFloorDB
 
double mRatio
 
bool mNormalize
 
bool mUsePeak
 
double mDecayTime
 
double mAttackFactor
 
double mAttackInverseFactor
 
double mDecayFactor
 
double mThreshold
 
double mCompression
 
double mNoiseFloor
 
int mNoiseCounter
 
double mGain
 
double mLastLevel
 
Floats mFollow1
 
Floats mFollow2
 
size_t mFollowLen
 
double mMax
 
EffectCompressorPanelmPanel
 
wxStaticText * mThresholdLabel
 
wxSlider * mThresholdSlider
 
wxStaticText * mThresholdText
 
wxStaticText * mNoiseFloorLabel
 
wxSlider * mNoiseFloorSlider
 
wxStaticText * mNoiseFloorText
 
wxStaticText * mRatioLabel
 
wxSlider * mRatioSlider
 
wxStaticText * mRatioText
 
wxStaticText * mAttackLabel
 
wxSlider * mAttackSlider
 
wxStaticText * mAttackText
 
wxStaticText * mDecayLabel
 
wxSlider * mDecaySlider
 
wxStaticText * mDecayText
 
wxCheckBox * mGainCheckBox
 
wxCheckBox * mPeakCheckBox
 

Additional Inherited Members

- Public Types inherited from Effect
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
- Protected Attributes inherited from EffectTwoPassSimpleMono
int mCurTrackNum
 
double mCurRate
 
double mCurT0
 
double mCurT1
 
int mCurChannel
 
int mPass
 
bool mSecondPassDisabled
 
- 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
 
int mOutputTracksType
 

Detailed Description

An Effect derived from EffectTwoPassSimpleMono.

Definition at line 32 of file Compressor.h.

Constructor & Destructor Documentation

EffectCompressor::EffectCompressor ( )

Definition at line 75 of file Compressor.cpp.

76 {
77  mThresholdDB = DEF_Threshold;
78  mNoiseFloorDB = DEF_NoiseFloor;
79  mAttackTime = DEF_AttackTime; // seconds
80  mDecayTime = DEF_ReleaseTime; // seconds
81  mRatio = DEF_Ratio; // positive number > 1.0
82  mNormalize = DEF_Normalize;
83  mUsePeak = DEF_UsePeak;
84 
85  mThreshold = 0.25;
86  mNoiseFloor = 0.01;
87  mCompression = 0.5;
88  mFollowLen = 0;
89 
90  SetLinearEffectFlag(false);
91 }
double mAttackTime
Definition: Compressor.h:89
void SetLinearEffectFlag(bool linearEffectFlag)
Definition: Effect.cpp:1961
double mDecayTime
Definition: Compressor.h:96
double mNoiseFloorDB
Definition: Compressor.h:91
double mThresholdDB
Definition: Compressor.h:90
double mCompression
Definition: Compressor.h:101
double mNoiseFloor
Definition: Compressor.h:102
EffectCompressor::~EffectCompressor ( )
virtual

Definition at line 93 of file Compressor.cpp.

94 {
95 }

Member Function Documentation

float EffectCompressor::AvgCircle ( float  x)
private

Definition at line 458 of file Compressor.cpp.

References mCircle, mCirclePos, mCircleSize, and mRMSSum.

Referenced by Follow().

459 {
460  float level;
461 
462  // Calculate current level from root-mean-squared of
463  // circular buffer ("RMS")
465  mCircle[mCirclePos] = value*value;
467  level = sqrt(mRMSSum/mCircleSize);
469 
470  return level;
471 }
size_t mCircleSize
Definition: Compressor.h:85
size_t mCirclePos
Definition: Compressor.h:86
Doubles mCircle
Definition: Compressor.h:87
bool EffectCompressor::DefineParams ( ShuttleParams S)
override

Definition at line 122 of file Compressor.cpp.

References mAttackTime, mDecayTime, mNoiseFloorDB, mNormalize, mRatio, mThresholdDB, and mUsePeak.

122  {
123  S.SHUTTLE_PARAM( mThresholdDB, Threshold );
124  S.SHUTTLE_PARAM( mNoiseFloorDB, NoiseFloor );
125  S.SHUTTLE_PARAM( mRatio, Ratio);
126  S.SHUTTLE_PARAM( mAttackTime, AttackTime);
127  S.SHUTTLE_PARAM( mDecayTime, ReleaseTime);
128  S.SHUTTLE_PARAM( mNormalize, Normalize);
129  S.SHUTTLE_PARAM( mUsePeak, UsePeak);
130  return true;
131 }
double mAttackTime
Definition: Compressor.h:89
double mDecayTime
Definition: Compressor.h:96
double mNoiseFloorDB
Definition: Compressor.h:91
double mThresholdDB
Definition: Compressor.h:90
float EffectCompressor::DoCompression ( float  x,
double  env 
)
private

Definition at line 586 of file Compressor.cpp.

References mCompression, mMax, mThreshold, and mUsePeak.

587 {
588  float out;
589  if(mUsePeak) {
590  // Peak values map 1.0 to 1.0 - 'upward' compression
591  out = value * pow(1.0/env, mCompression);
592  } else {
593  // With RMS-based compression don't change values below mThreshold - 'downward' compression
594  out = value * pow(mThreshold/env, mCompression);
595  }
596 
597  // Retain the maximum value for use in the normalization pass
598  if(mMax < fabs(out))
599  mMax = fabs(out);
600 
601  return out;
602 }
double mCompression
Definition: Compressor.h:101
void EffectCompressor::Follow ( float *  buffer,
float *  env,
size_t  len,
float *  previous,
size_t  previous_len 
)
private

Definition at line 473 of file Compressor.cpp.

References AvgCircle(), FreshenCircle(), mAttackFactor, mAttackInverseFactor, mDecayFactor, mLastLevel, mNoiseCounter, mNoiseFloor, mThreshold, and mUsePeak.

474 {
475  /*
476 
477  "Follow"ing algorithm by Roger B. Dannenberg, taken from
478  Nyquist. His description follows. -DMM
479 
480  Description: this is a sophisticated envelope follower.
481  The input is an envelope, e.g. something produced with
482  the AVG function. The purpose of this function is to
483  generate a smooth envelope that is generally not less
484  than the input signal. In other words, we want to "ride"
485  the peaks of the signal with a smooth function. The
486  algorithm is as follows: keep a current output value
487  (called the "value"). The value is allowed to increase
488  by at most rise_factor and decrease by at most fall_factor.
489  Therefore, the next value should be between
490  value * rise_factor and value * fall_factor. If the input
491  is in this range, then the next value is simply the input.
492  If the input is less than value * fall_factor, then the
493  next value is just value * fall_factor, which will be greater
494  than the input signal. If the input is greater than value *
495  rise_factor, then we compute a rising envelope that meets
496  the input value by working bacwards in time, changing the
497  previous values to input / rise_factor, input / rise_factor^2,
498  input / rise_factor^3, etc. until this NEW envelope intersects
499  the previously computed values. There is only a limited buffer
500  in which we can work backwards, so if the NEW envelope does not
501  intersect the old one, then make yet another pass, this time
502  from the oldest buffered value forward, increasing on each
503  sample by rise_factor to produce a maximal envelope. This will
504  still be less than the input.
505 
506  The value has a lower limit of floor to make sure value has a
507  reasonable positive value from which to begin an attack.
508  */
509  double level,last;
510 
511  if(!mUsePeak) {
512  // Update RMS sum directly from the circle buffer
513  // to avoid accumulation of rounding errors
514  FreshenCircle();
515  }
516  // First apply a peak detect with the requested decay rate
517  last = mLastLevel;
518  for(size_t i=0; i<len; i++) {
519  if(mUsePeak)
520  level = fabs(buffer[i]);
521  else // use RMS
522  level = AvgCircle(buffer[i]);
523  // Don't increase gain when signal is continuously below the noise floor
524  if(level < mNoiseFloor) {
525  mNoiseCounter++;
526  } else {
527  mNoiseCounter = 0;
528  }
529  if(mNoiseCounter < 100) {
530  last *= mDecayFactor;
531  if(last < mThreshold)
532  last = mThreshold;
533  if(level > last)
534  last = level;
535  }
536  env[i] = last;
537  }
538  mLastLevel = last;
539 
540  // Next do the same process in reverse direction to get the requested attack rate
541  last = mLastLevel;
542  for(size_t i = len; i--;) {
543  last *= mAttackInverseFactor;
544  if(last < mThreshold)
545  last = mThreshold;
546  if(env[i] < last)
547  env[i] = last;
548  else
549  last = env[i];
550  }
551 
552  if((previous != NULL) && (previous_len > 0)) {
553  // If the previous envelope was passed, propagate the rise back until we intersect
554  for(size_t i = previous_len; i--;) {
555  last *= mAttackInverseFactor;
556  if(last < mThreshold)
557  last = mThreshold;
558  if(previous[i] < last)
559  previous[i] = last;
560  else // Intersected the previous envelope buffer, so we are finished
561  return;
562  }
563  // If we can't back up far enough, project the starting level forward
564  // until we intersect the desired envelope
565  last = previous[0];
566  for(size_t i=1; i<previous_len; i++) {
567  last *= mAttackFactor;
568  if(previous[i] > last)
569  previous[i] = last;
570  else // Intersected the desired envelope, so we are finished
571  return;
572  }
573  // If we still didn't intersect, then continue ramp up into current buffer
574  for(size_t i=0; i<len; i++) {
575  last *= mAttackFactor;
576  if(buffer[i] > last)
577  buffer[i] = last;
578  else // Finally got an intersect
579  return;
580  }
581  // If we still didn't intersect, then reset mLastLevel
582  mLastLevel = last;
583  }
584 }
double mAttackInverseFactor
Definition: Compressor.h:98
double mNoiseFloor
Definition: Compressor.h:102
float AvgCircle(float x)
Definition: Compressor.cpp:458
double mDecayFactor
Definition: Compressor.h:99
double mAttackFactor
Definition: Compressor.h:97
void EffectCompressor::FreshenCircle ( )
private

Definition at line 449 of file Compressor.cpp.

References mCircle, mCircleSize, and mRMSSum.

Referenced by Follow().

450 {
451  // Recompute the RMS sum periodically to prevent accumulation of rounding errors
452  // during long waveforms
453  mRMSSum = 0;
454  for(size_t i=0; i<mCircleSize; i++)
455  mRMSSum += mCircle[i];
456 }
size_t mCircleSize
Definition: Compressor.h:85
Doubles mCircle
Definition: Compressor.h:87
bool EffectCompressor::GetAutomationParameters ( CommandParameters parms)
overridevirtual

Implements EffectClientInterface.

Definition at line 133 of file Compressor.cpp.

References mAttackTime, mDecayTime, mNoiseFloorDB, mNormalize, mRatio, mThresholdDB, and mUsePeak.

134 {
135  parms.Write(KEY_Threshold, mThresholdDB);
136  parms.Write(KEY_NoiseFloor, mNoiseFloorDB);
137  parms.Write(KEY_Ratio, mRatio);
138  parms.Write(KEY_AttackTime, mAttackTime);
139  parms.Write(KEY_ReleaseTime, mDecayTime);
140  parms.Write(KEY_Normalize, mNormalize);
141  parms.Write(KEY_UsePeak, mUsePeak);
142 
143  return true;
144 }
double mAttackTime
Definition: Compressor.h:89
double mDecayTime
Definition: Compressor.h:96
double mNoiseFloorDB
Definition: Compressor.h:91
double mThresholdDB
Definition: Compressor.h:90
wxString EffectCompressor::GetDescription ( )
overridevirtual

Implements IdentInterface.

Definition at line 104 of file Compressor.cpp.

References _().

105 {
106  return _("Compresses the dynamic range of audio");
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
IdentInterfaceSymbol EffectCompressor::GetSymbol ( )
overridevirtual

Implements IdentInterface.

Definition at line 99 of file Compressor.cpp.

References COMPRESSOR_PLUGIN_SYMBOL.

100 {
102 }
#define COMPRESSOR_PLUGIN_SYMBOL
Definition: Compressor.h:30
EffectType EffectCompressor::GetType ( )
overridevirtual

Implements EffectDefinitionInterface.

Definition at line 116 of file Compressor.cpp.

References EffectTypeProcess.

117 {
118  return EffectTypeProcess;
119 }
bool EffectCompressor::InitPass1 ( )
overrideprotectedvirtual

Reimplemented from Effect.

Definition at line 358 of file Compressor.cpp.

References EffectTwoPassSimpleMono::DisableSecondPass(), TrackListCondIterator::First(), WaveTrack::GetMaxBlockSize(), Effect::inputTracks(), mFollow1, mFollow2, mFollowLen, mMax, mNormalize, TrackListCondIterator::Next(), ArrayOf< X >::reinit(), and Track::Wave.

359 {
360  mMax=0.0;
361  if (!mNormalize)
363 
364  // Find the maximum block length required for any track
365  size_t maxlen = 0;
367  WaveTrack *track = (WaveTrack *) iter.First();
368  while (track) {
369  maxlen = std::max(maxlen, track->GetMaxBlockSize());
370  //Iterate to the next track
371  track = (WaveTrack *) iter.Next();
372  }
373  mFollow1.reset();
374  mFollow2.reset();
375  // Allocate buffers for the envelope
376  if(maxlen > 0) {
377  mFollow1.reinit(maxlen);
378  mFollow2.reinit(maxlen);
379  }
380  mFollowLen = maxlen;
381 
382  return true;
383 }
void reinit(Integral count, bool initialize=false)
Definition: MemoryX.h:117
TrackList * inputTracks() const
Definition: Effect.h:458
A Track that contains audio waveform data.
Definition: WaveTrack.h:60
size_t GetMaxBlockSize() const
Definition: WaveTrack.cpp:1625
bool EffectCompressor::InitPass2 ( )
overrideprotectedvirtual

Reimplemented from Effect.

Definition at line 385 of file Compressor.cpp.

References mNormalize.

386 {
387  // Actually, this should not even be called, because we call
388  // DisableSecondPass() before, if mNormalize is false.
389  return mNormalize;
390 }
wxString EffectCompressor::ManualPage ( )
overridevirtual

Reimplemented from Effect.

Definition at line 109 of file Compressor.cpp.

110 {
111  return wxT("Compressor");
112 }
bool EffectCompressor::NewTrackPass1 ( )
overrideprotectedvirtual

Reimplemented from EffectTwoPassSimpleMono.

Definition at line 333 of file Compressor.cpp.

References DB_TO_LINEAR(), mAttackFactor, mAttackInverseFactor, mAttackTime, mCircle, mCirclePos, mCircleSize, mCompression, EffectTwoPassSimpleMono::mCurRate, mDecayFactor, mDecayTime, mLastLevel, mNoiseCounter, mNoiseFloor, mNoiseFloorDB, mRatio, mRMSSum, mThreshold, mThresholdDB, and ArrayOf< X >::reinit().

334 {
337  mNoiseCounter = 100;
338 
339  mAttackInverseFactor = exp(log(mThreshold) / (mCurRate * mAttackTime + 0.5));
341  mDecayFactor = exp(log(mThreshold) / (mCurRate * mDecayTime + 0.5));
342 
343  if(mRatio > 1)
344  mCompression = 1.0-1.0/mRatio;
345  else
346  mCompression = 0.0;
347 
349 
350  mCircleSize = 100;
351  mCircle.reinit( mCircleSize, true );
352  mCirclePos = 0;
353  mRMSSum = 0.0;
354 
355  return true;
356 }
double mAttackInverseFactor
Definition: Compressor.h:98
double mAttackTime
Definition: Compressor.h:89
void reinit(Integral count, bool initialize=false)
Definition: MemoryX.h:117
double mDecayTime
Definition: Compressor.h:96
double mNoiseFloorDB
Definition: Compressor.h:91
double mThresholdDB
Definition: Compressor.h:90
double mCompression
Definition: Compressor.h:101
double mNoiseFloor
Definition: Compressor.h:102
double mDecayFactor
Definition: Compressor.h:99
size_t mCircleSize
Definition: Compressor.h:85
size_t mCirclePos
Definition: Compressor.h:86
double mAttackFactor
Definition: Compressor.h:97
Doubles mCircle
Definition: Compressor.h:87
const double MIN_Threshold_Linear DB_TO_LINEAR(MIN_Threshold_dB)
void EffectCompressor::OnSlider ( wxCommandEvent &  evt)
private

Definition at line 604 of file Compressor.cpp.

References TransferDataFromWindow(), and UpdateUI().

605 {
607  UpdateUI();
608 }
bool TransferDataFromWindow() override
Definition: Compressor.cpp:313
void EffectCompressor::PopulateOrExchange ( ShuttleGui S)
overridevirtual

Reimplemented from Effect.

Definition at line 202 of file Compressor.cpp.

References _(), ShuttleGuiBase::AddCheckBox(), ShuttleGuiBase::AddSlider(), ShuttleGuiBase::AddVariableText(), ShuttleGuiBase::AddWindow(), ShuttleGuiBase::EndHorizontalLay(), ShuttleGuiBase::EndMultiColumn(), ShuttleGuiBase::EndStatic(), ShuttleGuiBase::GetParent(), ShuttleGui::Id(), ID_Attack, ID_Decay, ID_NoiseFloor, ID_Ratio, ID_Threshold, mAttackLabel, mAttackSlider, mAttackText, mDecayLabel, mDecaySlider, mDecayText, mGainCheckBox, mNoiseFloorDB, mNoiseFloorLabel, mNoiseFloorSlider, mNoiseFloorText, mPanel, mPeakCheckBox, mRatio, mRatioLabel, mRatioSlider, mRatioText, mThresholdDB, mThresholdLabel, mThresholdSlider, mThresholdText, ShuttleGui::Prop(), safenew, ShuttleGuiBase::SetBorder(), ShuttleGuiBase::SetStretchyCol(), ShuttleGuiBase::SetStyle(), ShuttleGuiBase::StartHorizontalLay(), ShuttleGuiBase::StartMultiColumn(), and ShuttleGuiBase::StartStatic().

203 {
204  S.SetBorder(5);
205 
206  S.StartHorizontalLay(wxEXPAND, true);
207  {
208  S.SetBorder(10);
210  mThresholdDB,
212  mRatio);
213  mPanel->SetMinSize(wxSize(400, 200));
214  S.Prop(true).AddWindow(mPanel, wxEXPAND | wxALL);
215  S.SetBorder(5);
216  }
217  S.EndHorizontalLay();
218 
219  S.StartStatic( {} );
220  {
221  S.StartMultiColumn(3, wxEXPAND);
222  {
223  S.SetStretchyCol(1);
224  mThresholdLabel = S.AddVariableText(_("Threshold:"), true,
225  wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
226  S.SetStyle(wxSL_HORIZONTAL);
228  DEF_Threshold * SCL_Threshold,
229  MAX_Threshold * SCL_Threshold,
230  MIN_Threshold * SCL_Threshold);
231  mThresholdSlider->SetName(_("Threshold"));
232  mThresholdText = S.AddVariableText(wxT("XXX dB"), true,
233  wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
234 
235  mNoiseFloorLabel = S.AddVariableText(_("Noise Floor:"), true,
236  wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
237  S.SetStyle(wxSL_HORIZONTAL);
239  DEF_NoiseFloor / SCL_NoiseFloor,
240  MAX_NoiseFloor / SCL_NoiseFloor,
241  MIN_NoiseFloor / SCL_NoiseFloor);
242  mNoiseFloorSlider->SetName(_("Noise Floor"));
243  mNoiseFloorText = S.AddVariableText(wxT("XXX dB"), true,
244  wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
245 
246  mRatioLabel = S.AddVariableText(_("Ratio:"), true,
247  wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
248  S.SetStyle(wxSL_HORIZONTAL);
250  DEF_Ratio * SCL_Ratio,
251  MAX_Ratio * SCL_Ratio,
252  MIN_Ratio * SCL_Ratio);
253  mRatioSlider->SetName(_("Ratio"));
254  mRatioSlider->SetPageSize(5);
255  mRatioText = S.AddVariableText(wxT("XXXX:1"), true,
256  wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
257 
258  /* i18n-hint: Particularly in percussion, sounds can be regarded as having
259  * an 'attack' phase where the sound builds up and a 'decay' where the
260  * sound dies away. So this means 'onset duration'. */
261  mAttackLabel = S.AddVariableText(_("Attack Time:"), true,
262  wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
263  S.SetStyle(wxSL_HORIZONTAL);
265  DEF_AttackTime * SCL_AttackTime,
266  MAX_AttackTime * SCL_AttackTime,
267  MIN_AttackTime * SCL_AttackTime);
268  mAttackSlider->SetName(_("Attack Time"));
269  mAttackText = S.AddVariableText(wxT("XXXX secs"), true,
270  wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
271 
272  mDecayLabel = S.AddVariableText(_("Release Time:"), true,
273  wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
274  S.SetStyle(wxSL_HORIZONTAL);
276  DEF_ReleaseTime * SCL_ReleaseTime,
277  MAX_ReleaseTime * SCL_ReleaseTime,
278  MIN_ReleaseTime * SCL_ReleaseTime);
279  mDecaySlider->SetName(_("Release Time"));
280  mDecayText = S.AddVariableText(wxT("XXXX secs"), true,
281  wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
282  }
283  S.EndMultiColumn();
284  }
285  S.EndStatic();
286 
287  S.StartHorizontalLay(wxCENTER, false);
288  {
289  /* i18n-hint: Make-up, i.e. correct for any reduction, rather than fabricate it.*/
290  mGainCheckBox = S.AddCheckBox(_("Make-up gain for 0 dB after compressing"),
291  DEF_Normalize ? wxT("true") : wxT("false"));
292  mPeakCheckBox = S.AddCheckBox(_("Compress based on Peaks"),
293  DEF_UsePeak ? wxT("true") : wxT("false"));
294  }
295  S.EndHorizontalLay();
296 }
wxSlider * mRatioSlider
Definition: Compressor.h:122
wxSlider * mThresholdSlider
Definition: Compressor.h:114
wxWindow * AddWindow(wxWindow *pWindow, int Flags=wxALIGN_CENTRE|wxALL)
Definition: ShuttleGui.cpp:288
wxStaticText * mThresholdText
Definition: Compressor.h:115
wxStaticText * mThresholdLabel
Definition: Compressor.h:113
wxStaticText * mRatioLabel
Definition: Compressor.h:121
void EndMultiColumn()
double mNoiseFloorDB
Definition: Compressor.h:91
double mThresholdDB
Definition: Compressor.h:90
wxSlider * mNoiseFloorSlider
Definition: Compressor.h:118
wxStaticText * mAttackLabel
Definition: Compressor.h:125
#define safenew
Definition: Audacity.h:230
wxStaticText * mDecayLabel
Definition: Compressor.h:129
void EndHorizontalLay()
wxCheckBox * mGainCheckBox
Definition: Compressor.h:133
wxCheckBox * AddCheckBox(const wxString &Prompt, const wxString &Selected)
Definition: ShuttleGui.cpp:298
wxWindow * GetParent()
Definition: ShuttleGui.h:294
void StartHorizontalLay(int PositionFlags=wxALIGN_CENTRE, int iProp=1)
wxStaticText * mRatioText
Definition: Compressor.h:123
wxStaticText * mNoiseFloorLabel
Definition: Compressor.h:117
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
ShuttleGui & Id(int id)
wxStaticText * mDecayText
Definition: Compressor.h:131
void SetStyle(int Style)
Definition: ShuttleGui.h:287
wxSlider * mDecaySlider
Definition: Compressor.h:130
EffectCompressorPanel * mPanel
Definition: Compressor.h:111
wxStaticText * mNoiseFloorText
Definition: Compressor.h:119
_("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
wxCheckBox * mPeakCheckBox
Definition: Compressor.h:134
wxStaticText * AddVariableText(const wxString &Str, bool bCenter=false, int PositionFlags=0)
Definition: ShuttleGui.cpp:414
wxStaticBox * StartStatic(const wxString &Str, int iProp=0)
Definition: ShuttleGui.cpp:763
wxSlider * mAttackSlider
Definition: Compressor.h:126
ShuttleGui & Prop(int iProp)
Definition: ShuttleGui.h:418
wxStaticText * mAttackText
Definition: Compressor.h:127
void SetBorder(int Border)
Definition: ShuttleGui.h:286
void SetStretchyCol(int i)
Used to modify an already placed FlexGridSizer to make a column stretchy.
Definition: ShuttleGui.cpp:203
wxSlider * AddSlider(const wxString &Prompt, int pos, int Max, int Min=0)
Definition: ShuttleGui.cpp:497
bool EffectCompressor::ProcessPass2 ( float *  buffer,
size_t  len 
)
overrideprotected

Definition at line 438 of file Compressor.cpp.

References mMax.

439 {
440  if (mMax != 0)
441  {
442  for (size_t i = 0; i < len; i++)
443  buffer[i] /= mMax;
444  }
445 
446  return true;
447 }
bool EffectCompressor::SetAutomationParameters ( CommandParameters parms)
overridevirtual

Implements EffectClientInterface.

Definition at line 146 of file Compressor.cpp.

References mAttackTime, mDecayTime, mNoiseFloorDB, mNormalize, mRatio, mThresholdDB, mUsePeak, ReadAndVerifyBool, and ReadAndVerifyDouble.

147 {
148  ReadAndVerifyDouble(Threshold);
149  ReadAndVerifyDouble(NoiseFloor);
150  ReadAndVerifyDouble(Ratio);
151  ReadAndVerifyDouble(AttackTime);
152  ReadAndVerifyDouble(ReleaseTime);
153  ReadAndVerifyBool(Normalize);
154  ReadAndVerifyBool(UsePeak);
155 
156  mThresholdDB = Threshold;
157  mNoiseFloorDB = NoiseFloor;
158  mRatio = Ratio;
159  mAttackTime = AttackTime;
160  mDecayTime = ReleaseTime;
161  mNormalize = Normalize;
162  mUsePeak = UsePeak;
163 
164  return true;
165 }
double mAttackTime
Definition: Compressor.h:89
double mDecayTime
Definition: Compressor.h:96
double mNoiseFloorDB
Definition: Compressor.h:91
double mThresholdDB
Definition: Compressor.h:90
#define ReadAndVerifyDouble(name)
Definition: Effect.h:798
#define ReadAndVerifyBool(name)
Definition: Effect.h:800
bool EffectCompressor::Startup ( )
overridevirtual

Reimplemented from Effect.

Definition at line 169 of file Compressor.cpp.

References Effect::GetCurrentSettingsGroup(), gPrefs, mAttackTime, mDecayTime, mNoiseFloorDB, mNormalize, mRatio, mThresholdDB, mUsePeak, and Effect::SaveUserPreset().

170 {
171  wxString base = wxT("/Effects/Compressor/");
172 
173  // Migrate settings from 2.1.0 or before
174 
175  // Already migrated, so bail
176  if (gPrefs->Exists(base + wxT("Migrated")))
177  {
178  return true;
179  }
180 
181  // Load the old "current" settings
182  if (gPrefs->Exists(base))
183  {
184  gPrefs->Read(base + wxT("ThresholdDB"), &mThresholdDB, -12.0f );
185  gPrefs->Read(base + wxT("NoiseFloorDB"), &mNoiseFloorDB, -40.0f );
186  gPrefs->Read(base + wxT("Ratio"), &mRatio, 2.0f );
187  gPrefs->Read(base + wxT("AttackTime"), &mAttackTime, 0.2f );
188  gPrefs->Read(base + wxT("DecayTime"), &mDecayTime, 1.0f );
189  gPrefs->Read(base + wxT("Normalize"), &mNormalize, true );
190  gPrefs->Read(base + wxT("UsePeak"), &mUsePeak, false );
191 
193 
194  // Do not migrate again
195  gPrefs->Write(base + wxT("Migrated"), true);
196  gPrefs->Flush();
197  }
198 
199  return true;
200 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
bool SaveUserPreset(const wxString &name) override
Definition: Effect.cpp:600
double mAttackTime
Definition: Compressor.h:89
wxString GetCurrentSettingsGroup() override
Definition: Effect.cpp:801
double mDecayTime
Definition: Compressor.h:96
double mNoiseFloorDB
Definition: Compressor.h:91
double mThresholdDB
Definition: Compressor.h:90
bool EffectCompressor::TransferDataFromWindow ( )
overridevirtual

Reimplemented from Effect.

Definition at line 313 of file Compressor.cpp.

References mAttackSlider, mAttackTime, mDecaySlider, mDecayTime, mGainCheckBox, mNoiseFloorDB, mNoiseFloorSlider, mNormalize, mPeakCheckBox, mRatio, mRatioSlider, mThresholdDB, mThresholdSlider, Effect::mUIParent, and mUsePeak.

Referenced by OnSlider().

314 {
315  if (!mUIParent->Validate())
316  {
317  return false;
318  }
319 
320  mThresholdDB = (double) mThresholdSlider->GetValue();
321  mNoiseFloorDB = (double) mNoiseFloorSlider->GetValue() * SCL_NoiseFloor;
322  mRatio = (double) mRatioSlider->GetValue() / SCL_Ratio;
323  mAttackTime = (double) mAttackSlider->GetValue() / 100.0; //SCL_AttackTime;
324  mDecayTime = (double) mDecaySlider->GetValue() / SCL_ReleaseTime;
325  mNormalize = mGainCheckBox->GetValue();
326  mUsePeak = mPeakCheckBox->GetValue();
327 
328  return true;
329 }
wxSlider * mRatioSlider
Definition: Compressor.h:122
wxSlider * mThresholdSlider
Definition: Compressor.h:114
double mAttackTime
Definition: Compressor.h:89
double mDecayTime
Definition: Compressor.h:96
double mNoiseFloorDB
Definition: Compressor.h:91
double mThresholdDB
Definition: Compressor.h:90
wxSlider * mNoiseFloorSlider
Definition: Compressor.h:118
wxCheckBox * mGainCheckBox
Definition: Compressor.h:133
wxSlider * mDecaySlider
Definition: Compressor.h:130
wxWindow * mUIParent
Definition: Effect.h:472
wxCheckBox * mPeakCheckBox
Definition: Compressor.h:134
wxSlider * mAttackSlider
Definition: Compressor.h:126
bool EffectCompressor::TransferDataToWindow ( )
overridevirtual

Reimplemented from Effect.

Definition at line 298 of file Compressor.cpp.

References lrint, mAttackSlider, mAttackTime, mDecaySlider, mDecayTime, mGainCheckBox, mNoiseFloorDB, mNoiseFloorSlider, mNormalize, mPeakCheckBox, mRatio, mRatioSlider, mThresholdDB, mThresholdSlider, mUsePeak, and UpdateUI().

299 {
300  mThresholdSlider->SetValue(lrint(mThresholdDB));
301  mNoiseFloorSlider->SetValue(lrint(mNoiseFloorDB / SCL_NoiseFloor));
302  mRatioSlider->SetValue(lrint(mRatio * SCL_Ratio));
303  mAttackSlider->SetValue(lrint(mAttackTime * SCL_AttackTime));
304  mDecaySlider->SetValue(lrint(mDecayTime * SCL_ReleaseTime));
305  mGainCheckBox->SetValue(mNormalize);
306  mPeakCheckBox->SetValue(mUsePeak);
307 
308  UpdateUI();
309 
310  return true;
311 }
wxSlider * mRatioSlider
Definition: Compressor.h:122
wxSlider * mThresholdSlider
Definition: Compressor.h:114
double mAttackTime
Definition: Compressor.h:89
double mDecayTime
Definition: Compressor.h:96
double mNoiseFloorDB
Definition: Compressor.h:91
double mThresholdDB
Definition: Compressor.h:90
wxSlider * mNoiseFloorSlider
Definition: Compressor.h:118
wxCheckBox * mGainCheckBox
Definition: Compressor.h:133
#define lrint(dbl)
Definition: float_cast.h:136
wxSlider * mDecaySlider
Definition: Compressor.h:130
wxCheckBox * mPeakCheckBox
Definition: Compressor.h:134
wxSlider * mAttackSlider
Definition: Compressor.h:126
bool EffectCompressor::TwoBufferProcessPass1 ( float *  buffer1,
size_t  len1,
float *  buffer2,
size_t  len2 
)
overrideprotected

Definition at line 396 of file Compressor.cpp.

397 {
398  // If buffers are bigger than allocated, then abort
399  // (this should never happen, but if it does, we don't want to crash)
400  if((len1 > mFollowLen) || (len2 > mFollowLen))
401  return false;
402 
403  // This makes sure that the initial value is well-chosen
404  // buffer1 == NULL on the first and only the first call
405  if (buffer1 == NULL) {
406  // Initialize the mLastLevel to the peak level in the first buffer
407  // This avoids problems with large spike events near the beginning of the track
409  for(size_t i=0; i<len2; i++) {
410  if(mLastLevel < fabs(buffer2[i]))
411  mLastLevel = fabs(buffer2[i]);
412  }
413  }
414 
415  // buffer2 is NULL on the last and only the last call
416  if(buffer2 != NULL) {
417  Follow(buffer2, mFollow2.get(), len2, mFollow1.get(), len1);
418  }
419 
420  if(buffer1 != NULL) {
421  for (size_t i = 0; i < len1; i++) {
422  buffer1[i] = DoCompression(buffer1[i], mFollow1[i]);
423  }
424  }
425 
426 
427 #if 0
428  // Copy the envelope over the track data (for debug purposes)
429  memcpy(buffer1, mFollow1, len1*sizeof(float));
430 #endif
431 
432  // Rotate the buffer pointers
433  mFollow1.swap(mFollow2);
434 
435  return true;
436 }
float DoCompression(float x, double env)
Definition: Compressor.cpp:586
void Follow(float *buffer, float *env, size_t len, float *previous, size_t previous_len)
Definition: Compressor.cpp:473
void EffectCompressor::UpdateUI ( )
private

Definition at line 610 of file Compressor.cpp.

References _(), mAttackLabel, mAttackText, mAttackTime, mDecayLabel, mDecayText, mDecayTime, mNoiseFloorDB, mNoiseFloorLabel, mNoiseFloorText, mPanel, mRatio, mRatioLabel, mRatioSlider, mRatioText, mThresholdDB, mThresholdLabel, and mThresholdText.

Referenced by OnSlider(), and TransferDataToWindow().

611 {
612  mThresholdLabel->SetName(wxString::Format(_("Threshold %d dB"), (int) mThresholdDB));
613  /* i18n-hint: usually leave this as is as dB doesn't get translated*/
614  mThresholdText->SetLabel(wxString::Format(_("%3d dB"), (int) mThresholdDB));
615  mThresholdText->SetName(mThresholdText->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
616 
617  mNoiseFloorLabel->SetName(wxString::Format(_("Noise Floor %d dB"), (int) mNoiseFloorDB));
618  mNoiseFloorText->SetLabel(wxString::Format(_("%3d dB"), (int) mNoiseFloorDB));
619  mNoiseFloorText->SetName(mNoiseFloorText->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
620 
621  if (mRatioSlider->GetValue() % 10 == 0) {
622  mRatioLabel->SetName(wxString::Format(_("Ratio %.0f to 1"), mRatio));
623  /* i18n-hint: Unless your language has a different convention for ratios,
624  * like 8:1, leave as is.*/
625  mRatioText->SetLabel(wxString::Format(_("%.0f:1"), mRatio));
626  }
627  else {
628  mRatioLabel->SetName(wxString::Format(_("Ratio %.1f to 1"), mRatio));
629  /* i18n-hint: Unless your language has a different convention for ratios,
630  * like 8:1, leave as is.*/
631  mRatioText->SetLabel(wxString::Format(_("%.1f:1"), mRatio));
632  }
633  mRatioText->SetName(mRatioText->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
634 
635  mAttackLabel->SetName(wxString::Format(_("Attack Time %.2f secs"), mAttackTime));
636  mAttackText->SetLabel(wxString::Format(_("%.2f secs"), mAttackTime));
637  mAttackText->SetName(mAttackText->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
638 
639  mDecayLabel->SetName(wxString::Format(_("Release Time %.1f secs"), mDecayTime));
640  mDecayText->SetLabel(wxString::Format(_("%.1f secs"), mDecayTime));
641  mDecayText->SetName(mDecayText->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
642 
643  mPanel->Refresh(false);
644 
645  return;
646 }
wxSlider * mRatioSlider
Definition: Compressor.h:122
double mAttackTime
Definition: Compressor.h:89
wxStaticText * mThresholdText
Definition: Compressor.h:115
wxStaticText * mThresholdLabel
Definition: Compressor.h:113
wxStaticText * mRatioLabel
Definition: Compressor.h:121
double mDecayTime
Definition: Compressor.h:96
double mNoiseFloorDB
Definition: Compressor.h:91
double mThresholdDB
Definition: Compressor.h:90
wxStaticText * mAttackLabel
Definition: Compressor.h:125
wxStaticText * mDecayLabel
Definition: Compressor.h:129
wxStaticText * mRatioText
Definition: Compressor.h:123
wxStaticText * mNoiseFloorLabel
Definition: Compressor.h:117
wxStaticText * mDecayText
Definition: Compressor.h:131
EffectCompressorPanel * mPanel
Definition: Compressor.h:111
wxStaticText * mNoiseFloorText
Definition: Compressor.h:119
_("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 * mAttackText
Definition: Compressor.h:127

Member Data Documentation

double EffectCompressor::mAttackFactor
private

Definition at line 97 of file Compressor.h.

Referenced by Follow(), and NewTrackPass1().

double EffectCompressor::mAttackInverseFactor
private

Definition at line 98 of file Compressor.h.

Referenced by Follow(), and NewTrackPass1().

wxStaticText* EffectCompressor::mAttackLabel
private

Definition at line 125 of file Compressor.h.

Referenced by PopulateOrExchange(), and UpdateUI().

wxSlider* EffectCompressor::mAttackSlider
private

Definition at line 126 of file Compressor.h.

Referenced by PopulateOrExchange(), TransferDataFromWindow(), and TransferDataToWindow().

wxStaticText* EffectCompressor::mAttackText
private

Definition at line 127 of file Compressor.h.

Referenced by PopulateOrExchange(), and UpdateUI().

double EffectCompressor::mAttackTime
private
Doubles EffectCompressor::mCircle
private

Definition at line 87 of file Compressor.h.

Referenced by AvgCircle(), FreshenCircle(), and NewTrackPass1().

size_t EffectCompressor::mCirclePos
private

Definition at line 86 of file Compressor.h.

Referenced by AvgCircle(), and NewTrackPass1().

size_t EffectCompressor::mCircleSize
private

Definition at line 85 of file Compressor.h.

Referenced by AvgCircle(), FreshenCircle(), and NewTrackPass1().

double EffectCompressor::mCompression
private

Definition at line 101 of file Compressor.h.

Referenced by DoCompression(), and NewTrackPass1().

double EffectCompressor::mDecayFactor
private

Definition at line 99 of file Compressor.h.

Referenced by Follow(), and NewTrackPass1().

wxStaticText* EffectCompressor::mDecayLabel
private

Definition at line 129 of file Compressor.h.

Referenced by PopulateOrExchange(), and UpdateUI().

wxSlider* EffectCompressor::mDecaySlider
private

Definition at line 130 of file Compressor.h.

Referenced by PopulateOrExchange(), TransferDataFromWindow(), and TransferDataToWindow().

wxStaticText* EffectCompressor::mDecayText
private

Definition at line 131 of file Compressor.h.

Referenced by PopulateOrExchange(), and UpdateUI().

double EffectCompressor::mDecayTime
private
Floats EffectCompressor::mFollow1
private

Definition at line 106 of file Compressor.h.

Referenced by InitPass1().

Floats EffectCompressor::mFollow2
private

Definition at line 106 of file Compressor.h.

Referenced by InitPass1().

size_t EffectCompressor::mFollowLen
private

Definition at line 107 of file Compressor.h.

Referenced by InitPass1().

double EffectCompressor::mGain
private

Definition at line 104 of file Compressor.h.

wxCheckBox* EffectCompressor::mGainCheckBox
private

Definition at line 133 of file Compressor.h.

Referenced by PopulateOrExchange(), TransferDataFromWindow(), and TransferDataToWindow().

double EffectCompressor::mLastLevel
private

Definition at line 105 of file Compressor.h.

Referenced by Follow(), and NewTrackPass1().

double EffectCompressor::mMax
private

Definition at line 109 of file Compressor.h.

Referenced by DoCompression(), InitPass1(), and ProcessPass2().

int EffectCompressor::mNoiseCounter
private

Definition at line 103 of file Compressor.h.

Referenced by Follow(), and NewTrackPass1().

double EffectCompressor::mNoiseFloor
private

Definition at line 102 of file Compressor.h.

Referenced by Follow(), and NewTrackPass1().

double EffectCompressor::mNoiseFloorDB
private
wxStaticText* EffectCompressor::mNoiseFloorLabel
private

Definition at line 117 of file Compressor.h.

Referenced by PopulateOrExchange(), and UpdateUI().

wxSlider* EffectCompressor::mNoiseFloorSlider
private

Definition at line 118 of file Compressor.h.

Referenced by PopulateOrExchange(), TransferDataFromWindow(), and TransferDataToWindow().

wxStaticText* EffectCompressor::mNoiseFloorText
private

Definition at line 119 of file Compressor.h.

Referenced by PopulateOrExchange(), and UpdateUI().

bool EffectCompressor::mNormalize
private
EffectCompressorPanel* EffectCompressor::mPanel
private

Definition at line 111 of file Compressor.h.

Referenced by PopulateOrExchange(), and UpdateUI().

wxCheckBox* EffectCompressor::mPeakCheckBox
private

Definition at line 134 of file Compressor.h.

Referenced by PopulateOrExchange(), TransferDataFromWindow(), and TransferDataToWindow().

double EffectCompressor::mRatio
private
wxStaticText* EffectCompressor::mRatioLabel
private

Definition at line 121 of file Compressor.h.

Referenced by PopulateOrExchange(), and UpdateUI().

wxSlider* EffectCompressor::mRatioSlider
private
wxStaticText* EffectCompressor::mRatioText
private

Definition at line 123 of file Compressor.h.

Referenced by PopulateOrExchange(), and UpdateUI().

double EffectCompressor::mRMSSum
private

Definition at line 84 of file Compressor.h.

Referenced by AvgCircle(), FreshenCircle(), and NewTrackPass1().

double EffectCompressor::mThreshold
private

Definition at line 100 of file Compressor.h.

Referenced by DoCompression(), Follow(), and NewTrackPass1().

double EffectCompressor::mThresholdDB
private
wxStaticText* EffectCompressor::mThresholdLabel
private

Definition at line 113 of file Compressor.h.

Referenced by PopulateOrExchange(), and UpdateUI().

wxSlider* EffectCompressor::mThresholdSlider
private

Definition at line 114 of file Compressor.h.

Referenced by PopulateOrExchange(), TransferDataFromWindow(), and TransferDataToWindow().

wxStaticText* EffectCompressor::mThresholdText
private

Definition at line 115 of file Compressor.h.

Referenced by PopulateOrExchange(), and UpdateUI().

bool EffectCompressor::mUsePeak
private

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