Audacity  3.0.3
Public Member Functions | Static Public Attributes | 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:
[legend]
Collaboration diagram for EffectCompressor:
[legend]

Public Member Functions

 EffectCompressor ()
 
virtual ~EffectCompressor ()
 
ComponentInterfaceSymbol GetSymbol () override
 
TranslatableString 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 ()
 
PluginPath GetPath () override
 
ComponentInterfaceSymbol GetSymbol () override
 
VendorSymbol GetVendor () override
 
wxString GetVersion () override
 
TranslatableString GetDescription () override
 
EffectType GetType () override
 
EffectFamilySymbol GetFamily () 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
 
size_t GetBlockSize () const 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, const EffectDialogFactory &factory, bool forceModal=false) override
 
bool GetAutomationParameters (CommandParameters &parms) override
 
bool SetAutomationParameters (CommandParameters &parms) override
 
bool LoadUserPreset (const RegistryPath &name) override
 
bool SaveUserPreset (const RegistryPath &name) override
 
RegistryPaths GetFactoryPresets () override
 
bool LoadFactoryPreset (int id) override
 
bool LoadFactoryDefaults () override
 
void SetHostUI (EffectUIHostInterface *host) override
 
bool PopulateUI (ShuttleGui &S) final
 
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
 
NumericFormatSymbol GetDurationFormat () override
 
virtual NumericFormatSymbol GetSelectionFormat ()
 
void SetDuration (double duration) override
 
RegistryPath GetUserPresetsGroup (const RegistryPath &name) override
 
RegistryPath GetCurrentSettingsGroup () override
 
RegistryPath GetFactoryDefaultsGroup () override
 
virtual wxString GetSavedStateGroup ()
 
bool HasSharedConfigGroup (const RegistryPath &group) override
 
bool GetSharedConfigSubgroups (const RegistryPath &group, RegistryPaths &subgroups) override
 
bool GetSharedConfig (const RegistryPath &group, const RegistryPath &key, wxString &value, const wxString &defval={}) override
 
bool GetSharedConfig (const RegistryPath &group, const RegistryPath &key, int &value, int defval=0) override
 
bool GetSharedConfig (const RegistryPath &group, const RegistryPath &key, bool &value, bool defval=false) override
 
bool GetSharedConfig (const RegistryPath &group, const RegistryPath &key, float &value, float defval=0.0) override
 
bool GetSharedConfig (const RegistryPath &group, const RegistryPath &key, double &value, double defval=0.0) override
 
bool SetSharedConfig (const RegistryPath &group, const RegistryPath &key, const wxString &value) override
 
bool SetSharedConfig (const RegistryPath &group, const RegistryPath &key, const int &value) override
 
bool SetSharedConfig (const RegistryPath &group, const RegistryPath &key, const bool &value) override
 
bool SetSharedConfig (const RegistryPath &group, const RegistryPath &key, const float &value) override
 
bool SetSharedConfig (const RegistryPath &group, const RegistryPath &key, const double &value) override
 
bool RemoveSharedConfigSubgroup (const RegistryPath &group) override
 
bool RemoveSharedConfig (const RegistryPath &group, const RegistryPath &key) override
 
bool HasPrivateConfigGroup (const RegistryPath &group) override
 
bool GetPrivateConfigSubgroups (const RegistryPath &group, RegistryPaths &paths) override
 
bool GetPrivateConfig (const RegistryPath &group, const RegistryPath &key, wxString &value, const wxString &defval={}) override
 
bool GetPrivateConfig (const RegistryPath &group, const RegistryPath &key, int &value, int defval=0) override
 
bool GetPrivateConfig (const RegistryPath &group, const RegistryPath &key, bool &value, bool defval=false) override
 
bool GetPrivateConfig (const RegistryPath &group, const RegistryPath &key, float &value, float defval=0.0) override
 
bool GetPrivateConfig (const RegistryPath &group, const RegistryPath &key, double &value, double defval=0.0) override
 
bool SetPrivateConfig (const RegistryPath &group, const RegistryPath &key, const wxString &value) override
 
bool SetPrivateConfig (const RegistryPath &group, const RegistryPath &key, const int &value) override
 
bool SetPrivateConfig (const RegistryPath &group, const RegistryPath &key, const bool &value) override
 
bool SetPrivateConfig (const RegistryPath &group, const RegistryPath &key, const float &value) override
 
bool SetPrivateConfig (const RegistryPath &group, const RegistryPath &key, const double &value) override
 
bool RemovePrivateConfigSubgroup (const RegistryPath &group) override
 
bool RemovePrivateConfig (const RegistryPath &group, const RegistryPath &key) override
 
virtual PluginID GetID ()
 
virtual bool Startup (EffectClientInterface *client)
 
virtual bool GetAutomationParameters (wxString &parms)
 
virtual bool SetAutomationParameters (const wxString &parms)
 
virtual RegistryPaths GetUserPresets ()
 
virtual bool HasCurrentSettings ()
 
virtual bool HasFactoryDefaults ()
 
virtual wxString HelpPage ()
 
virtual void SetUIFlags (unsigned flags)
 
virtual unsigned TestUIFlags (unsigned mask)
 
virtual bool IsBatchProcessing ()
 
virtual void SetBatchProcessing (bool start)
 
void SetPresetParameters (const wxArrayString *Names, const wxArrayString *Values)
 
bool DoEffect (double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, wxWindow *pParent=nullptr, const EffectDialogFactory &dialogFactory={})
 
bool Delegate (Effect &delegate, wxWindow &parent, const EffectDialogFactory &factory)
 
virtual bool IsHidden ()
 
int MessageBox (const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
 
- 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 ()
 
TranslatableString GetName ()
 
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 ()
 

Static Public Attributes

static const ComponentInterfaceSymbol Symbol { XO("Compressor") }
 
- Static Public Attributes inherited from Effect
static const wxString kUserPresetIdent = wxT("User Preset:")
 
static const wxString kFactoryPresetIdent = wxT("Factory Preset:")
 
static const wxString kCurrentSettingsIdent = wxT("<Current Settings>")
 
static const wxString kFactoryDefaultsIdent = wxT("<Factory Defaults>")
 

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 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, const TranslatableString &={})
 
bool TrackProgress (int whichTrack, double frac, const TranslatableString &={})
 
bool TrackGroupProgress (int whichGroup, double frac, const TranslatableString &={})
 
int GetNumWaveTracks ()
 
int GetNumWaveGroups ()
 
void GetBounds (const WaveTrack &track, const WaveTrack *pRight, 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< AddedAnalysisTrackAddAnalysisTrack (const wxString &name=wxString())
 
ModifiedAnalysisTrack ModifyAnalysisTrack (const LabelTrack *pOrigTrack, const wxString &name=wxString())
 
void ReplaceProcessedTracks (const bool bGoodResult)
 
TrackAddToOutputTracks (const std::shared_ptr< Track > &t)
 
const TrackListinputTracks () const
 
const AudacityProjectFindProject () 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 }
 
using VetoDialogHook = bool(*)(wxDialog *)
 
- Public Types inherited from EffectClientInterface
using EffectDialogFactory = std::function< wxDialog *(wxWindow &parent, EffectHostInterface *, EffectUIClientInterface *) >
 
- Static Public Member Functions inherited from Effect
static VetoDialogHook SetVetoDialogHook (VetoDialogHook hook)
 
static CommandID GetSquashedName (wxString name)
 
static void IncEffectCounter ()
 
- Protected Attributes inherited from EffectTwoPassSimpleMono
int mCurTrackNum
 
double mCurRate
 
double mCurT0
 
double mCurT1
 
int mCurChannel
 
int mPass
 
bool mSecondPassDisabled
 
std::shared_ptr< TrackListmWorkTracks
 
std::shared_ptr< TrackList > * mTrackLists [2]
 
- Protected Attributes inherited from Effect
ProgressDialogmProgress
 
double mProjectRate
 
double mSampleRate
 
wxWeakRef< NotifyingSelectedRegionmpSelectedRegion {}
 
WaveTrackFactorymFactory
 
std::shared_ptr< TrackListmOutputTracks
 
double mT0
 
double mT1
 
wxArrayString mPresetNames
 
wxArrayString mPresetValues
 
int mPass
 
wxDialog * mUIDialog
 
wxWindow * mUIParent
 
int mUIResultID
 
unsigned mUIFlags
 
sampleCount mSampleCnt
 
- Static Protected Attributes inherited from Effect
static int nEffectsDone =0
 

Detailed Description

An Effect derived from EffectTwoPassSimpleMono.

Definition at line 22 of file Compressor.h.

Constructor & Destructor Documentation

◆ EffectCompressor()

EffectCompressor::EffectCompressor ( )

Definition at line 84 of file Compressor.cpp.

85 {
86  mThresholdDB = DEF_Threshold;
87  mNoiseFloorDB = DEF_NoiseFloor;
88  mAttackTime = DEF_AttackTime; // seconds
89  mDecayTime = DEF_ReleaseTime; // seconds
90  mRatio = DEF_Ratio; // positive number > 1.0
91  mNormalize = DEF_Normalize;
92  mUsePeak = DEF_UsePeak;
93 
94  mThreshold = 0.25;
95  mNoiseFloor = 0.01;
96  mCompression = 0.5;
97  mFollowLen = 0;
98 
99  SetLinearEffectFlag(false);
100 }

◆ ~EffectCompressor()

EffectCompressor::~EffectCompressor ( )
virtual

Definition at line 102 of file Compressor.cpp.

103 {
104 }

Member Function Documentation

◆ AvgCircle()

float EffectCompressor::AvgCircle ( float  x)
private

Definition at line 517 of file Compressor.cpp.

518 {
519  float level;
520 
521  // Calculate current level from root-mean-squared of
522  // circular buffer ("RMS")
524  mCircle[mCirclePos] = value*value;
526  level = sqrt(mRMSSum/mCircleSize);
528 
529  return level;
530 }

References mCircle, mCirclePos, mCircleSize, and mRMSSum.

Referenced by Follow().

Here is the caller graph for this function:

◆ DefineParams()

bool EffectCompressor::DefineParams ( ShuttleParams S)
override

Definition at line 131 of file Compressor.cpp.

131  {
132  S.SHUTTLE_PARAM( mThresholdDB, Threshold );
133  S.SHUTTLE_PARAM( mNoiseFloorDB, NoiseFloor );
134  S.SHUTTLE_PARAM( mRatio, Ratio);
135  S.SHUTTLE_PARAM( mAttackTime, AttackTime);
136  S.SHUTTLE_PARAM( mDecayTime, ReleaseTime);
137  S.SHUTTLE_PARAM( mNormalize, Normalize);
138  S.SHUTTLE_PARAM( mUsePeak, UsePeak);
139  return true;
140 }

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

◆ DoCompression()

float EffectCompressor::DoCompression ( float  x,
double  env 
)
private

Definition at line 645 of file Compressor.cpp.

646 {
647  float out;
648  if(mUsePeak) {
649  // Peak values map 1.0 to 1.0 - 'upward' compression
650  out = value * pow(1.0/env, mCompression);
651  } else {
652  // With RMS-based compression don't change values below mThreshold - 'downward' compression
653  out = value * pow(mThreshold/env, mCompression);
654  }
655 
656  // Retain the maximum value for use in the normalization pass
657  if(mMax < fabs(out))
658  mMax = fabs(out);
659 
660  return out;
661 }

References mCompression, mMax, mThreshold, and mUsePeak.

Referenced by TwoBufferProcessPass1().

Here is the caller graph for this function:

◆ Follow()

void EffectCompressor::Follow ( float *  buffer,
float *  env,
size_t  len,
float *  previous,
size_t  previous_len 
)
private

Definition at line 532 of file Compressor.cpp.

533 {
534  /*
535 
536  "Follow"ing algorithm by Roger B. Dannenberg, taken from
537  Nyquist. His description follows. -DMM
538 
539  Description: this is a sophisticated envelope follower.
540  The input is an envelope, e.g. something produced with
541  the AVG function. The purpose of this function is to
542  generate a smooth envelope that is generally not less
543  than the input signal. In other words, we want to "ride"
544  the peaks of the signal with a smooth function. The
545  algorithm is as follows: keep a current output value
546  (called the "value"). The value is allowed to increase
547  by at most rise_factor and decrease by at most fall_factor.
548  Therefore, the next value should be between
549  value * rise_factor and value * fall_factor. If the input
550  is in this range, then the next value is simply the input.
551  If the input is less than value * fall_factor, then the
552  next value is just value * fall_factor, which will be greater
553  than the input signal. If the input is greater than value *
554  rise_factor, then we compute a rising envelope that meets
555  the input value by working bacwards in time, changing the
556  previous values to input / rise_factor, input / rise_factor^2,
557  input / rise_factor^3, etc. until this NEW envelope intersects
558  the previously computed values. There is only a limited buffer
559  in which we can work backwards, so if the NEW envelope does not
560  intersect the old one, then make yet another pass, this time
561  from the oldest buffered value forward, increasing on each
562  sample by rise_factor to produce a maximal envelope. This will
563  still be less than the input.
564 
565  The value has a lower limit of floor to make sure value has a
566  reasonable positive value from which to begin an attack.
567  */
568  double level,last;
569 
570  if(!mUsePeak) {
571  // Update RMS sum directly from the circle buffer
572  // to avoid accumulation of rounding errors
573  FreshenCircle();
574  }
575  // First apply a peak detect with the requested decay rate
576  last = mLastLevel;
577  for(size_t i=0; i<len; i++) {
578  if(mUsePeak)
579  level = fabs(buffer[i]);
580  else // use RMS
581  level = AvgCircle(buffer[i]);
582  // Don't increase gain when signal is continuously below the noise floor
583  if(level < mNoiseFloor) {
584  mNoiseCounter++;
585  } else {
586  mNoiseCounter = 0;
587  }
588  if(mNoiseCounter < 100) {
589  last *= mDecayFactor;
590  if(last < mThreshold)
591  last = mThreshold;
592  if(level > last)
593  last = level;
594  }
595  env[i] = last;
596  }
597  mLastLevel = last;
598 
599  // Next do the same process in reverse direction to get the requested attack rate
600  last = mLastLevel;
601  for(size_t i = len; i--;) {
602  last *= mAttackInverseFactor;
603  if(last < mThreshold)
604  last = mThreshold;
605  if(env[i] < last)
606  env[i] = last;
607  else
608  last = env[i];
609  }
610 
611  if((previous != NULL) && (previous_len > 0)) {
612  // If the previous envelope was passed, propagate the rise back until we intersect
613  for(size_t i = previous_len; i--;) {
614  last *= mAttackInverseFactor;
615  if(last < mThreshold)
616  last = mThreshold;
617  if(previous[i] < last)
618  previous[i] = last;
619  else // Intersected the previous envelope buffer, so we are finished
620  return;
621  }
622  // If we can't back up far enough, project the starting level forward
623  // until we intersect the desired envelope
624  last = previous[0];
625  for(size_t i=1; i<previous_len; i++) {
626  last *= mAttackFactor;
627  if(previous[i] > last)
628  previous[i] = last;
629  else // Intersected the desired envelope, so we are finished
630  return;
631  }
632  // If we still didn't intersect, then continue ramp up into current buffer
633  for(size_t i=0; i<len; i++) {
634  last *= mAttackFactor;
635  if(buffer[i] > last)
636  buffer[i] = last;
637  else // Finally got an intersect
638  return;
639  }
640  // If we still didn't intersect, then reset mLastLevel
641  mLastLevel = last;
642  }
643 }

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

Referenced by TwoBufferProcessPass1().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FreshenCircle()

void EffectCompressor::FreshenCircle ( )
private

Definition at line 508 of file Compressor.cpp.

509 {
510  // Recompute the RMS sum periodically to prevent accumulation of rounding errors
511  // during long waveforms
512  mRMSSum = 0;
513  for(size_t i=0; i<mCircleSize; i++)
514  mRMSSum += mCircle[i];
515 }

References mCircle, mCircleSize, and mRMSSum.

Referenced by Follow().

Here is the caller graph for this function:

◆ GetAutomationParameters()

bool EffectCompressor::GetAutomationParameters ( CommandParameters parms)
overridevirtual

Implements EffectClientInterface.

Definition at line 142 of file Compressor.cpp.

143 {
144  parms.Write(KEY_Threshold, mThresholdDB);
145  parms.Write(KEY_NoiseFloor, mNoiseFloorDB);
146  parms.Write(KEY_Ratio, mRatio);
147  parms.Write(KEY_AttackTime, mAttackTime);
148  parms.Write(KEY_ReleaseTime, mDecayTime);
149  parms.Write(KEY_Normalize, mNormalize);
150  parms.Write(KEY_UsePeak, mUsePeak);
151 
152  return true;
153 }

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

◆ GetDescription()

TranslatableString EffectCompressor::GetDescription ( )
overridevirtual

Implements ComponentInterface.

Definition at line 113 of file Compressor.cpp.

114 {
115  return XO("Compresses the dynamic range of audio");
116 }

References XO.

◆ GetSymbol()

ComponentInterfaceSymbol EffectCompressor::GetSymbol ( )
overridevirtual

Implements ComponentInterface.

Definition at line 108 of file Compressor.cpp.

109 {
110  return Symbol;
111 }

References Symbol.

◆ GetType()

EffectType EffectCompressor::GetType ( )
overridevirtual

Implements EffectDefinitionInterface.

Definition at line 125 of file Compressor.cpp.

126 {
127  return EffectTypeProcess;
128 }

References EffectTypeProcess.

◆ InitPass1()

bool EffectCompressor::InitPass1 ( )
overrideprotectedvirtual

Reimplemented from Effect.

Definition at line 422 of file Compressor.cpp.

423 {
424  mMax=0.0;
425  if (!mNormalize)
427 
428  // Find the maximum block length required for any track
429  size_t maxlen = inputTracks()->Selected< const WaveTrack >().max(
431  );
432  mFollow1.reset();
433  mFollow2.reset();
434  // Allocate buffers for the envelope
435  if(maxlen > 0) {
436  mFollow1.reinit(maxlen);
437  mFollow2.reinit(maxlen);
438  }
439  mFollowLen = maxlen;
440 
441  return true;
442 }

References EffectTwoPassSimpleMono::DisableSecondPass(), WaveTrack::GetMaxBlockSize(), Effect::inputTracks(), mFollow1, mFollow2, mFollowLen, mMax, mNormalize, ArrayOf< X >::reinit(), and TrackList::Selected().

Here is the call graph for this function:

◆ InitPass2()

bool EffectCompressor::InitPass2 ( )
overrideprotectedvirtual

Reimplemented from Effect.

Definition at line 444 of file Compressor.cpp.

445 {
446  // Actually, this should not even be called, because we call
447  // DisableSecondPass() before, if mNormalize is false.
448  return mNormalize;
449 }

References mNormalize.

◆ ManualPage()

wxString EffectCompressor::ManualPage ( )
overridevirtual

Reimplemented from Effect.

Definition at line 118 of file Compressor.cpp.

119 {
120  return wxT("Compressor");
121 }

◆ NewTrackPass1()

bool EffectCompressor::NewTrackPass1 ( )
overrideprotectedvirtual

Reimplemented from EffectTwoPassSimpleMono.

Definition at line 397 of file Compressor.cpp.

398 {
401  mNoiseCounter = 100;
402 
403  mAttackInverseFactor = exp(log(mThreshold) / (mCurRate * mAttackTime + 0.5));
405  mDecayFactor = exp(log(mThreshold) / (mCurRate * mDecayTime + 0.5));
406 
407  if(mRatio > 1)
408  mCompression = 1.0-1.0/mRatio;
409  else
410  mCompression = 0.0;
411 
413 
414  mCircleSize = 100;
415  mCircle.reinit( mCircleSize, true );
416  mCirclePos = 0;
417  mRMSSum = 0.0;
418 
419  return true;
420 }

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().

Here is the call graph for this function:

◆ OnSlider()

void EffectCompressor::OnSlider ( wxCommandEvent &  evt)
private

Definition at line 663 of file Compressor.cpp.

664 {
666  UpdateUI();
667 }

References TransferDataFromWindow(), and UpdateUI().

Here is the call graph for this function:

◆ PopulateOrExchange()

void EffectCompressor::PopulateOrExchange ( ShuttleGui S)
overridevirtual

Reimplemented from Effect.

Definition at line 245 of file Compressor.cpp.

246 {
247  S.SetBorder(5);
248 
249  S.StartHorizontalLay(wxEXPAND, true);
250  {
251  S.SetBorder(10);
253  mThresholdDB,
255  mRatio);
256  S.Prop(true)
257  .Position(wxEXPAND | wxALL)
258  .MinSize( { 400, 200 } )
259  .AddWindow(mPanel);
260  S.SetBorder(5);
261  }
262  S.EndHorizontalLay();
263 
264  S.StartStatic( {} );
265  {
266  S.StartMultiColumn(3, wxEXPAND);
267  {
268  S.SetStretchyCol(1);
269  mThresholdLabel = S.AddVariableText(XO("&Threshold:"), true,
270  wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
272  .Name(XO("Threshold"))
273  .Style(wxSL_HORIZONTAL)
274  .AddSlider( {},
275  DEF_Threshold * SCL_Threshold,
276  MAX_Threshold * SCL_Threshold,
277  MIN_Threshold * SCL_Threshold);
279  wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
280 
281  mNoiseFloorLabel = S.AddVariableText(XO("&Noise Floor:"), true,
282  wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
284  .Name(XO("Noise Floor"))
285  .Style(wxSL_HORIZONTAL)
286  .AddSlider( {},
287  DEF_NoiseFloor * SCL_NoiseFloor,
288  MAX_NoiseFloor * SCL_NoiseFloor,
289  MIN_NoiseFloor * SCL_NoiseFloor);
291  true, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
292 
293  mRatioLabel = S.AddVariableText(XO("&Ratio:"), true,
294  wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
296  .Name(XO("Ratio"))
297  .Style(wxSL_HORIZONTAL)
298  .AddSlider( {},
299  DEF_Ratio * SCL_Ratio,
300  MAX_Ratio * SCL_Ratio,
301  MIN_Ratio * SCL_Ratio);
302  mRatioSlider->SetPageSize(5);
303  mRatioText = S.AddVariableText(RatioTextFormat( 1, 99.9 ), true,
304  wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
305 
306  /* i18n-hint: Particularly in percussion, sounds can be regarded as having
307  * an 'attack' phase where the sound builds up and a 'decay' where the
308  * sound dies away. So this means 'onset duration'. */
309  mAttackLabel = S.AddVariableText(XO("&Attack Time:"), true,
310  wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
312  /* i18n-hint: Particularly in percussion, sounds can be regarded as having
313  * an 'attack' phase where the sound builds up and a 'decay' where the
314  * sound dies away. So this means 'onset duration'. */
315  .Name(XO("Attack Time"))
316  .Style(wxSL_HORIZONTAL)
317  .AddSlider( {},
318  DEF_AttackTime * SCL_AttackTime,
319  MAX_AttackTime * SCL_AttackTime,
320  MIN_AttackTime * SCL_AttackTime);
322  AttackTimeFormat(9.99),
323  true, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
324 
325  /* i18n-hint: Particularly in percussion, sounds can be regarded as having
326  * an 'attack' phase where the sound builds up and a 'decay' or 'release' where the
327  * sound dies away. */
328  mDecayLabel = S.AddVariableText(XO("R&elease Time:"), true,
329  wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
331  /* i18n-hint: Particularly in percussion, sounds can be regarded as having
332  * an 'attack' phase where the sound builds up and a 'decay' or 'release' where the
333  * sound dies away. */
334  .Name(XO("Release Time"))
335  .Style(wxSL_HORIZONTAL)
336  .AddSlider( {},
337  DEF_ReleaseTime * SCL_ReleaseTime,
338  MAX_ReleaseTime * SCL_ReleaseTime,
339  MIN_ReleaseTime * SCL_ReleaseTime);
340 
342  DecayTimeFormat(99.9),
343  true, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
344  }
345  S.EndMultiColumn();
346  }
347  S.EndStatic();
348 
349  S.StartHorizontalLay(wxCENTER, false);
350  {
351  /* i18n-hint: Make-up, i.e. correct for any reduction, rather than fabricate it.*/
352  mGainCheckBox = S.AddCheckBox(XXO("Ma&ke-up gain for 0 dB after compressing"),
353  DEF_Normalize);
354  /* i18n-hint: "Compress" here means reduce variations of sound volume,
355  NOT related to file-size compression; Peaks means extremes in volume */
356  mPeakCheckBox = S.AddCheckBox(XXO("C&ompress based on Peaks"),
357  DEF_UsePeak);
358  }
359  S.EndHorizontalLay();
360 }

References ShuttleGuiBase::AddCheckBox(), ShuttleGuiBase::AddSlider(), ShuttleGuiBase::AddVariableText(), anonymous_namespace{Compressor.cpp}::AttackTimeFormat(), anonymous_namespace{Compressor.cpp}::DecayTimeFormat(), 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, ShuttleGui::MinSize(), mNoiseFloorDB, mNoiseFloorLabel, mNoiseFloorSlider, mNoiseFloorText, mPanel, mPeakCheckBox, mRatio, mRatioLabel, mRatioSlider, mRatioText, mThresholdDB, mThresholdLabel, mThresholdSlider, mThresholdText, ShuttleGui::Name(), ShuttleGui::Position(), ShuttleGui::Prop(), anonymous_namespace{Compressor.cpp}::RatioTextFormat(), safenew, ShuttleGuiBase::SetBorder(), ShuttleGuiBase::SetStretchyCol(), ShuttleGuiBase::StartHorizontalLay(), ShuttleGuiBase::StartMultiColumn(), ShuttleGuiBase::StartStatic(), ShuttleGui::Style(), anonymous_namespace{Compressor.cpp}::ThresholdFormat(), XO, and XXO.

Here is the call graph for this function:

◆ ProcessPass2()

bool EffectCompressor::ProcessPass2 ( float *  buffer,
size_t  len 
)
overrideprotected

Definition at line 497 of file Compressor.cpp.

498 {
499  if (mMax != 0)
500  {
501  for (size_t i = 0; i < len; i++)
502  buffer[i] /= mMax;
503  }
504 
505  return true;
506 }

References mMax.

◆ SetAutomationParameters()

bool EffectCompressor::SetAutomationParameters ( CommandParameters parms)
overridevirtual

Implements EffectClientInterface.

Definition at line 155 of file Compressor.cpp.

156 {
157  ReadAndVerifyDouble(Threshold);
158  ReadAndVerifyDouble(NoiseFloor);
159  ReadAndVerifyDouble(Ratio);
160  ReadAndVerifyDouble(AttackTime);
161  ReadAndVerifyDouble(ReleaseTime);
162  ReadAndVerifyBool(Normalize);
163  ReadAndVerifyBool(UsePeak);
164 
165  mThresholdDB = Threshold;
166  mNoiseFloorDB = NoiseFloor;
167  mRatio = Ratio;
168  mAttackTime = AttackTime;
169  mDecayTime = ReleaseTime;
170  mNormalize = Normalize;
171  mUsePeak = UsePeak;
172 
173  return true;
174 }

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

◆ Startup()

bool EffectCompressor::Startup ( )
overridevirtual

Reimplemented from Effect.

Definition at line 178 of file Compressor.cpp.

179 {
180  wxString base = wxT("/Effects/Compressor/");
181 
182  // Migrate settings from 2.1.0 or before
183 
184  // Already migrated, so bail
185  if (gPrefs->Exists(base + wxT("Migrated")))
186  {
187  return true;
188  }
189 
190  // Load the old "current" settings
191  if (gPrefs->Exists(base))
192  {
193  gPrefs->Read(base + wxT("ThresholdDB"), &mThresholdDB, -12.0f );
194  gPrefs->Read(base + wxT("NoiseFloorDB"), &mNoiseFloorDB, -40.0f );
195  gPrefs->Read(base + wxT("Ratio"), &mRatio, 2.0f );
196  gPrefs->Read(base + wxT("AttackTime"), &mAttackTime, 0.2f );
197  gPrefs->Read(base + wxT("DecayTime"), &mDecayTime, 1.0f );
198  gPrefs->Read(base + wxT("Normalize"), &mNormalize, true );
199  gPrefs->Read(base + wxT("UsePeak"), &mUsePeak, false );
200 
202 
203  // Do not migrate again
204  gPrefs->Write(base + wxT("Migrated"), true);
205  gPrefs->Flush();
206  }
207 
208  return true;
209 }

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

Here is the call graph for this function:

◆ TransferDataFromWindow()

bool EffectCompressor::TransferDataFromWindow ( )
overridevirtual

Reimplemented from Effect.

Definition at line 377 of file Compressor.cpp.

378 {
379  if (!mUIParent->Validate())
380  {
381  return false;
382  }
383 
384  mThresholdDB = (double) mThresholdSlider->GetValue();
385  mNoiseFloorDB = (double) mNoiseFloorSlider->GetValue() / SCL_NoiseFloor;
386  mRatio = (double) mRatioSlider->GetValue() / SCL_Ratio;
387  mAttackTime = (double) mAttackSlider->GetValue() / 100.0; //SCL_AttackTime;
388  mDecayTime = (double) mDecaySlider->GetValue() / SCL_ReleaseTime;
389  mNormalize = mGainCheckBox->GetValue();
390  mUsePeak = mPeakCheckBox->GetValue();
391 
392  return true;
393 }

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

Referenced by OnSlider().

Here is the caller graph for this function:

◆ TransferDataToWindow()

bool EffectCompressor::TransferDataToWindow ( )
overridevirtual

Reimplemented from Effect.

Definition at line 362 of file Compressor.cpp.

363 {
364  mThresholdSlider->SetValue(lrint(mThresholdDB));
365  mNoiseFloorSlider->SetValue(lrint(mNoiseFloorDB * SCL_NoiseFloor));
366  mRatioSlider->SetValue(lrint(mRatio * SCL_Ratio));
367  mAttackSlider->SetValue(lrint(mAttackTime * SCL_AttackTime));
368  mDecaySlider->SetValue(lrint(mDecayTime * SCL_ReleaseTime));
369  mGainCheckBox->SetValue(mNormalize);
370  mPeakCheckBox->SetValue(mUsePeak);
371 
372  UpdateUI();
373 
374  return true;
375 }

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

Here is the call graph for this function:

◆ TwoBufferProcessPass1()

bool EffectCompressor::TwoBufferProcessPass1 ( float *  buffer1,
size_t  len1,
float *  buffer2,
size_t  len2 
)
overrideprotected

Definition at line 454 of file Compressor.cpp.

456 {
457  // If buffers are bigger than allocated, then abort
458  // (this should never happen, but if it does, we don't want to crash)
459  if((len1 > mFollowLen) || (len2 > mFollowLen))
460  return false;
461 
462  // This makes sure that the initial value is well-chosen
463  // buffer1 == NULL on the first and only the first call
464  if (buffer1 == NULL) {
465  // Initialize the mLastLevel to the peak level in the first buffer
466  // This avoids problems with large spike events near the beginning of the track
468  for(size_t i=0; i<len2; i++) {
469  if(mLastLevel < fabs(buffer2[i]))
470  mLastLevel = fabs(buffer2[i]);
471  }
472  }
473 
474  // buffer2 is NULL on the last and only the last call
475  if(buffer2 != NULL) {
476  Follow(buffer2, mFollow2.get(), len2, mFollow1.get(), len1);
477  }
478 
479  if(buffer1 != NULL) {
480  for (size_t i = 0; i < len1; i++) {
481  buffer1[i] = DoCompression(buffer1[i], mFollow1[i]);
482  }
483  }
484 
485 
486 #if 0
487  // Copy the envelope over the track data (for debug purposes)
488  memcpy(buffer1, mFollow1, len1*sizeof(float));
489 #endif
490 
491  // Rotate the buffer pointers
492  mFollow1.swap(mFollow2);
493 
494  return true;
495 }

References DoCompression(), Follow(), mFollow1, mFollow2, mFollowLen, mLastLevel, and mThreshold.

Here is the call graph for this function:

◆ UpdateUI()

void EffectCompressor::UpdateUI ( )
private

Definition at line 669 of file Compressor.cpp.

670 {
671  mThresholdLabel->SetName(wxString::Format(_("Threshold %d dB"), (int) mThresholdDB));
672  mThresholdText->SetLabel(ThresholdFormat((int) mThresholdDB).Translation());
673  mThresholdText->SetName(mThresholdText->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
674 
675  mNoiseFloorLabel->SetName(wxString::Format(_("Noise Floor %d dB"), (int) mNoiseFloorDB));
676  mNoiseFloorText->SetLabel(ThresholdFormat((int) mNoiseFloorDB).Translation());
677  mNoiseFloorText->SetName(mNoiseFloorText->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
678 
679  mRatioLabel->SetName(
681  mRatioText->SetLabel(
683  mRatioText->SetName(mRatioText->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
684 
685  mAttackLabel->SetName(wxString::Format(_("Attack Time %.2f secs"), mAttackTime));
686  mAttackText->SetLabel(AttackTimeFormat(mAttackTime).Translation());
687  mAttackText->SetName(mAttackText->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
688 
689  mDecayLabel->SetName(wxString::Format(_("Release Time %.1f secs"), mDecayTime));
690  mDecayText->SetLabel(DecayTimeFormat(mDecayTime).Translation());
691  mDecayText->SetName(mDecayText->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
692 
693  mPanel->Refresh(false);
694 
695  return;
696 }

References _, anonymous_namespace{Compressor.cpp}::AttackTimeFormat(), anonymous_namespace{Compressor.cpp}::DecayTimeFormat(), mAttackLabel, mAttackText, mAttackTime, mDecayLabel, mDecayText, mDecayTime, mNoiseFloorDB, mNoiseFloorLabel, mNoiseFloorText, mPanel, mRatio, mRatioLabel, mRatioSlider, mRatioText, mThresholdDB, mThresholdLabel, mThresholdText, anonymous_namespace{Compressor.cpp}::RatioLabelFormat(), anonymous_namespace{Compressor.cpp}::RatioTextFormat(), anonymous_namespace{Compressor.cpp}::ThresholdFormat(), and TranslatableString::Translation().

Referenced by OnSlider(), and TransferDataToWindow().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mAttackFactor

double EffectCompressor::mAttackFactor
private

Definition at line 88 of file Compressor.h.

Referenced by Follow(), and NewTrackPass1().

◆ mAttackInverseFactor

double EffectCompressor::mAttackInverseFactor
private

Definition at line 89 of file Compressor.h.

Referenced by Follow(), and NewTrackPass1().

◆ mAttackLabel

wxStaticText* EffectCompressor::mAttackLabel
private

Definition at line 116 of file Compressor.h.

Referenced by PopulateOrExchange(), and UpdateUI().

◆ mAttackSlider

wxSlider* EffectCompressor::mAttackSlider
private

Definition at line 117 of file Compressor.h.

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

◆ mAttackText

wxStaticText* EffectCompressor::mAttackText
private

Definition at line 118 of file Compressor.h.

Referenced by PopulateOrExchange(), and UpdateUI().

◆ mAttackTime

double EffectCompressor::mAttackTime
private

◆ mCircle

Doubles EffectCompressor::mCircle
private

Definition at line 78 of file Compressor.h.

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

◆ mCirclePos

size_t EffectCompressor::mCirclePos
private

Definition at line 77 of file Compressor.h.

Referenced by AvgCircle(), and NewTrackPass1().

◆ mCircleSize

size_t EffectCompressor::mCircleSize
private

Definition at line 76 of file Compressor.h.

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

◆ mCompression

double EffectCompressor::mCompression
private

Definition at line 92 of file Compressor.h.

Referenced by DoCompression(), and NewTrackPass1().

◆ mDecayFactor

double EffectCompressor::mDecayFactor
private

Definition at line 90 of file Compressor.h.

Referenced by Follow(), and NewTrackPass1().

◆ mDecayLabel

wxStaticText* EffectCompressor::mDecayLabel
private

Definition at line 120 of file Compressor.h.

Referenced by PopulateOrExchange(), and UpdateUI().

◆ mDecaySlider

wxSlider* EffectCompressor::mDecaySlider
private

Definition at line 121 of file Compressor.h.

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

◆ mDecayText

wxStaticText* EffectCompressor::mDecayText
private

Definition at line 122 of file Compressor.h.

Referenced by PopulateOrExchange(), and UpdateUI().

◆ mDecayTime

double EffectCompressor::mDecayTime
private

◆ mFollow1

Floats EffectCompressor::mFollow1
private

Definition at line 97 of file Compressor.h.

Referenced by InitPass1(), and TwoBufferProcessPass1().

◆ mFollow2

Floats EffectCompressor::mFollow2
private

Definition at line 97 of file Compressor.h.

Referenced by InitPass1(), and TwoBufferProcessPass1().

◆ mFollowLen

size_t EffectCompressor::mFollowLen
private

Definition at line 98 of file Compressor.h.

Referenced by InitPass1(), and TwoBufferProcessPass1().

◆ mGain

double EffectCompressor::mGain
private

Definition at line 95 of file Compressor.h.

◆ mGainCheckBox

wxCheckBox* EffectCompressor::mGainCheckBox
private

Definition at line 124 of file Compressor.h.

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

◆ mLastLevel

double EffectCompressor::mLastLevel
private

Definition at line 96 of file Compressor.h.

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

◆ mMax

double EffectCompressor::mMax
private

Definition at line 100 of file Compressor.h.

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

◆ mNoiseCounter

int EffectCompressor::mNoiseCounter
private

Definition at line 94 of file Compressor.h.

Referenced by Follow(), and NewTrackPass1().

◆ mNoiseFloor

double EffectCompressor::mNoiseFloor
private

Definition at line 93 of file Compressor.h.

Referenced by Follow(), and NewTrackPass1().

◆ mNoiseFloorDB

double EffectCompressor::mNoiseFloorDB
private

◆ mNoiseFloorLabel

wxStaticText* EffectCompressor::mNoiseFloorLabel
private

Definition at line 108 of file Compressor.h.

Referenced by PopulateOrExchange(), and UpdateUI().

◆ mNoiseFloorSlider

wxSlider* EffectCompressor::mNoiseFloorSlider
private

Definition at line 109 of file Compressor.h.

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

◆ mNoiseFloorText

wxStaticText* EffectCompressor::mNoiseFloorText
private

Definition at line 110 of file Compressor.h.

Referenced by PopulateOrExchange(), and UpdateUI().

◆ mNormalize

bool EffectCompressor::mNormalize
private

◆ mPanel

EffectCompressorPanel* EffectCompressor::mPanel
private

Definition at line 102 of file Compressor.h.

Referenced by PopulateOrExchange(), and UpdateUI().

◆ mPeakCheckBox

wxCheckBox* EffectCompressor::mPeakCheckBox
private

Definition at line 125 of file Compressor.h.

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

◆ mRatio

double EffectCompressor::mRatio
private

◆ mRatioLabel

wxStaticText* EffectCompressor::mRatioLabel
private

Definition at line 112 of file Compressor.h.

Referenced by PopulateOrExchange(), and UpdateUI().

◆ mRatioSlider

wxSlider* EffectCompressor::mRatioSlider
private

◆ mRatioText

wxStaticText* EffectCompressor::mRatioText
private

Definition at line 114 of file Compressor.h.

Referenced by PopulateOrExchange(), and UpdateUI().

◆ mRMSSum

double EffectCompressor::mRMSSum
private

Definition at line 75 of file Compressor.h.

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

◆ mThreshold

double EffectCompressor::mThreshold
private

Definition at line 91 of file Compressor.h.

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

◆ mThresholdDB

double EffectCompressor::mThresholdDB
private

◆ mThresholdLabel

wxStaticText* EffectCompressor::mThresholdLabel
private

Definition at line 104 of file Compressor.h.

Referenced by PopulateOrExchange(), and UpdateUI().

◆ mThresholdSlider

wxSlider* EffectCompressor::mThresholdSlider
private

Definition at line 105 of file Compressor.h.

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

◆ mThresholdText

wxStaticText* EffectCompressor::mThresholdText
private

Definition at line 106 of file Compressor.h.

Referenced by PopulateOrExchange(), and UpdateUI().

◆ mUsePeak

bool EffectCompressor::mUsePeak
private

◆ Symbol

const ComponentInterfaceSymbol EffectCompressor::Symbol { XO("Compressor") }
static

Definition at line 25 of file Compressor.h.

Referenced by GetSymbol().


The documentation for this class was generated from the following files:
EffectCompressor::mCompression
double mCompression
Definition: Compressor.h:92
ID_Attack
@ ID_Attack
Definition: Compressor.cpp:56
WaveTrack
A Track that contains audio waveform data.
Definition: WaveTrack.h:68
EffectTypeProcess
@ EffectTypeProcess
Definition: EffectInterface.h:59
DB_TO_LINEAR
const double MIN_Threshold_Linear DB_TO_LINEAR(MIN_Threshold_dB)
ShuttleGuiBase::AddCheckBox
wxCheckBox * AddCheckBox(const TranslatableString &Prompt, bool Selected)
Definition: ShuttleGui.cpp:302
Effect::SetLinearEffectFlag
void SetLinearEffectFlag(bool linearEffectFlag)
Definition: Effect.cpp:2000
EffectCompressor::mRatioLabel
wxStaticText * mRatioLabel
Definition: Compressor.h:112
EffectCompressor::mCircle
Doubles mCircle
Definition: Compressor.h:78
anonymous_namespace{Compressor.cpp}::DecayTimeFormat
TranslatableString DecayTimeFormat(double value)
Definition: Compressor.cpp:220
gPrefs
FileConfig * gPrefs
Definition: Prefs.cpp:67
EffectCompressor::mNoiseFloorLabel
wxStaticText * mNoiseFloorLabel
Definition: Compressor.h:108
EffectCompressor::mFollow1
Floats mFollow1
Definition: Compressor.h:97
ID_Ratio
@ ID_Ratio
Definition: Compressor.cpp:55
EffectCompressor::mNoiseFloor
double mNoiseFloor
Definition: Compressor.h:93
ArrayOf::reinit
void reinit(Integral count, bool initialize=false)
Definition: MemoryX.h:112
EffectCompressor::mNoiseCounter
int mNoiseCounter
Definition: Compressor.h:94
ShuttleGui::MinSize
ShuttleGui & MinSize()
Definition: ShuttleGui.h:740
XO
#define XO(s)
Definition: Internat.h:32
EffectCompressor::mAttackTime
double mAttackTime
Definition: Compressor.h:80
EffectCompressor::mThresholdText
wxStaticText * mThresholdText
Definition: Compressor.h:106
EffectCompressor::mRatioText
wxStaticText * mRatioText
Definition: Compressor.h:114
ShuttleGuiBase::EndMultiColumn
void EndMultiColumn()
Definition: ShuttleGui.cpp:1212
Effect::SaveUserPreset
bool SaveUserPreset(const RegistryPath &name) override
Definition: Effect.cpp:569
EffectCompressor::mThresholdLabel
wxStaticText * mThresholdLabel
Definition: Compressor.h:104
EffectCompressor::mThresholdSlider
wxSlider * mThresholdSlider
Definition: Compressor.h:105
ShuttleGui::Id
ShuttleGui & Id(int id)
Definition: ShuttleGui.cpp:2248
ID_NoiseFloor
@ ID_NoiseFloor
Definition: Compressor.cpp:54
EffectCompressor::mNoiseFloorSlider
wxSlider * mNoiseFloorSlider
Definition: Compressor.h:109
EffectCompressor::mThreshold
double mThreshold
Definition: Compressor.h:91
anonymous_namespace{Compressor.cpp}::ThresholdFormat
TranslatableString ThresholdFormat(int value)
Definition: Compressor.cpp:213
EffectCompressor::mCirclePos
size_t mCirclePos
Definition: Compressor.h:77
ShuttleGui::Style
ShuttleGui & Style(long iStyle)
Definition: ShuttleGui.h:734
EffectCompressor::mDecayTime
double mDecayTime
Definition: Compressor.h:87
EffectCompressor::mPeakCheckBox
wxCheckBox * mPeakCheckBox
Definition: Compressor.h:125
anonymous_namespace{Compressor.cpp}::RatioLabelFormat
TranslatableString RatioLabelFormat(int sliderValue, double value)
Definition: Compressor.cpp:235
XXO
#define XXO(s)
Definition: Internat.h:45
Effect::inputTracks
const TrackList * inputTracks() const
Definition: Effect.h:462
ShuttleGuiBase::EndHorizontalLay
void EndHorizontalLay()
Definition: ShuttleGui.cpp:1170
EffectCompressor::mAttackInverseFactor
double mAttackInverseFactor
Definition: Compressor.h:89
ShuttleGuiBase::StartHorizontalLay
void StartHorizontalLay(int PositionFlags=wxALIGN_CENTRE, int iProp=1)
Definition: ShuttleGui.cpp:1160
EffectCompressor::mAttackLabel
wxStaticText * mAttackLabel
Definition: Compressor.h:116
EffectCompressor::mGainCheckBox
wxCheckBox * mGainCheckBox
Definition: Compressor.h:124
ShuttleGuiBase::StartMultiColumn
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
Definition: ShuttleGui.cpp:1203
EffectCompressor::mDecayFactor
double mDecayFactor
Definition: Compressor.h:90
ShuttleGuiBase::GetParent
wxWindow * GetParent()
Definition: ShuttleGui.h:503
EffectTwoPassSimpleMono::DisableSecondPass
void DisableSecondPass()
Definition: TwoPassSimpleMono.h:67
ID_Decay
@ ID_Decay
Definition: Compressor.cpp:57
EffectCompressor::AvgCircle
float AvgCircle(float x)
Definition: Compressor.cpp:517
EffectCompressor::mFollow2
Floats mFollow2
Definition: Compressor.h:97
EffectCompressor::mMax
double mMax
Definition: Compressor.h:100
ReadAndVerifyDouble
#define ReadAndVerifyDouble(name)
Definition: Effect.h:632
ShuttleGui::Prop
ShuttleGui & Prop(int iProp)
Definition: ShuttleGui.h:732
ShuttleGuiBase::AddSlider
wxSlider * AddSlider(const TranslatableString &Prompt, int pos, int Max, int Min=0)
Definition: ShuttleGui.cpp:582
EffectCompressor::UpdateUI
void UpdateUI()
Definition: Compressor.cpp:669
Effect::GetCurrentSettingsGroup
RegistryPath GetCurrentSettingsGroup() override
Definition: Effect.cpp:865
EffectCompressor::mRMSSum
double mRMSSum
Definition: Compressor.h:75
EffectCompressor::mDecayText
wxStaticText * mDecayText
Definition: Compressor.h:122
EffectCompressor::mAttackText
wxStaticText * mAttackText
Definition: Compressor.h:118
ShuttleGuiBase::StartStatic
wxStaticBox * StartStatic(const TranslatableString &Str, int iProp=0)
Definition: ShuttleGui.cpp:886
WaveTrack::GetMaxBlockSize
size_t GetMaxBlockSize() const
Definition: WaveTrack.cpp:1578
ShuttleGui::Name
ShuttleGui & Name(const TranslatableString &name)
Definition: ShuttleGui.h:670
EffectCompressor::mDecayLabel
wxStaticText * mDecayLabel
Definition: Compressor.h:120
EffectCompressor::mAttackSlider
wxSlider * mAttackSlider
Definition: Compressor.h:117
EffectCompressor::DoCompression
float DoCompression(float x, double env)
Definition: Compressor.cpp:645
FileConfig::Flush
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:151
EffectCompressor::Symbol
static const ComponentInterfaceSymbol Symbol
Definition: Compressor.h:25
ShuttleGui::Position
ShuttleGui & Position(int flags)
Definition: ShuttleGui.h:719
EffectCompressor::mNoiseFloorText
wxStaticText * mNoiseFloorText
Definition: Compressor.h:110
EffectCompressor::mCircleSize
size_t mCircleSize
Definition: Compressor.h:76
Effect::mUIParent
wxWindow * mUIParent
Definition: Effect.h:477
_
#define _(s)
Definition: Internat.h:76
anonymous_namespace{Compressor.cpp}::AttackTimeFormat
TranslatableString AttackTimeFormat(double value)
Definition: Compressor.cpp:217
EffectCompressor::mNormalize
bool mNormalize
Definition: Compressor.h:84
EffectCompressor::Follow
void Follow(float *buffer, float *env, size_t len, float *previous, size_t previous_len)
Definition: Compressor.cpp:532
EffectCompressor::mFollowLen
size_t mFollowLen
Definition: Compressor.h:98
EffectCompressor::mDecaySlider
wxSlider * mDecaySlider
Definition: Compressor.h:121
EffectCompressor::mUsePeak
bool mUsePeak
Definition: Compressor.h:85
EffectCompressorPanel
Definition: Compressor.h:131
TranslatableString::Translation
wxString Translation() const
Definition: Types.h:337
ShuttleGuiBase::SetBorder
void SetBorder(int Border)
Definition: ShuttleGui.h:497
anonymous_namespace{Compressor.cpp}::RatioTextFormat
TranslatableString RatioTextFormat(int sliderValue, double value)
Definition: Compressor.cpp:223
EffectCompressor::mAttackFactor
double mAttackFactor
Definition: Compressor.h:88
EffectCompressor::TransferDataFromWindow
bool TransferDataFromWindow() override
Definition: Compressor.cpp:377
ShuttleGuiBase::AddVariableText
wxStaticText * AddVariableText(const TranslatableString &Str, bool bCenter=false, int PositionFlags=0, int wrapWidth=0)
Definition: ShuttleGui.cpp:456
EffectCompressor::FreshenCircle
void FreshenCircle()
Definition: Compressor.cpp:508
ShuttleGuiBase::EndStatic
void EndStatic()
Definition: ShuttleGui.cpp:915
safenew
#define safenew
Definition: MemoryX.h:8
lrint
#define lrint(dbl)
Definition: float_cast.h:148
ShuttleGuiBase::SetStretchyCol
void SetStretchyCol(int i)
Used to modify an already placed FlexGridSizer to make a column stretchy.
Definition: ShuttleGui.cpp:195
ID_Threshold
@ ID_Threshold
Definition: Compressor.cpp:53
EffectCompressor::mRatio
double mRatio
Definition: Compressor.h:83
EffectCompressor::mRatioSlider
wxSlider * mRatioSlider
Definition: Compressor.h:113
TrackList::Selected
auto Selected() -> TrackIterRange< TrackType >
Definition: Track.h:1371
ReadAndVerifyBool
#define ReadAndVerifyBool(name)
Definition: Effect.h:634
EffectCompressor::mNoiseFloorDB
double mNoiseFloorDB
Definition: Compressor.h:82
EffectTwoPassSimpleMono::mCurRate
double mCurRate
Definition: TwoPassSimpleMono.h:71
EffectCompressor::mLastLevel
double mLastLevel
Definition: Compressor.h:96
EffectCompressor::mThresholdDB
double mThresholdDB
Definition: Compressor.h:81
EffectCompressor::mPanel
EffectCompressorPanel * mPanel
Definition: Compressor.h:102