Audacity  2.2.2
Macros | Enumerations | Functions | Variables
Equalization.cpp File Reference

Implements EffectEqualiztaion, EqualizationDialog, EqualizationPanel, EQCurve and EQPoint. More...

#include "../Audacity.h"
#include "Equalization.h"
#include <math.h>
#include <vector>
#include <wx/bitmap.h>
#include <wx/button.h>
#include <wx/brush.h>
#include <wx/dcmemory.h>
#include <wx/event.h>
#include <wx/image.h>
#include <wx/intl.h>
#include <wx/choice.h>
#include <wx/radiobut.h>
#include <wx/stattext.h>
#include <wx/string.h>
#include <wx/textdlg.h>
#include <wx/ffile.h>
#include <wx/filefn.h>
#include <wx/stdpaths.h>
#include <wx/settings.h>
#include <wx/checkbox.h>
#include <wx/tooltip.h>
#include <wx/utils.h>
#include "../Experimental.h"
#include "../AColor.h"
#include "../ShuttleGui.h"
#include "../PlatformCompatibility.h"
#include "../FileNames.h"
#include "../Envelope.h"
#include "../widgets/LinkingHtmlWindow.h"
#include "../widgets/ErrorDialog.h"
#include "../FFT.h"
#include "../Prefs.h"
#include "../Project.h"
#include "../WaveTrack.h"
#include "../widgets/Ruler.h"
#include "../xml/XMLFileReader.h"
#include "../Theme.h"
#include "../AllThemeResources.h"
#include "../float_cast.h"
#include "FileDialog.h"
#include <wx/arrimpl.cpp>
#include "../TrackPanelDrawingContext.h"

Go to the source code of this file.

Macros

#define EQCURVES_VERSION   1
 
#define EQCURVES_REVISION   0
 
#define UPDATE_ALL   0
 

Enumerations

enum  {
  ID_Length = 10000, ID_dBMax, ID_dBMin, ID_Clear,
  ID_Invert, ID_Mode, ID_Draw, ID_Graphic,
  ID_Interp, ID_Linear, ID_Grid, ID_Curve,
  ID_Manage, ID_Delete, ID_Slider
}
 
enum  kInterpolations {
  kBspline, kCosine, kCubic, kNumInterpolations,
  kLinear, kLogarithmic, kNumInterpolations
}
 

Functions

 Param (FilterLength, int, wxT("FilterLength"), 4001, 21, 8191, 0)
 
 Param (CurveName, wxChar *, wxT("CurveName"), wxT("unnamed"), wxT(""), wxT(""), wxT(""))
 
 Param (InterpLin, bool, wxT("InterpolateLin"), false, false, true, false)
 
 Param (InterpMeth, int, wxT("InterpolationMethod"), 0, 0, 0, 0)
 
 Param (DrawMode, bool, wxT(""), true, false, true, false)
 
 Param (DrawGrid, bool, wxT(""), true, false, true, false)
 
 Param (dBMin, float, wxT(""),-30.0,-120.0,-10.0, 0)
 
 Param (dBMax, float, wxT(""), 30.0, 0.0, 60.0, 0)
 
 WX_DEFINE_OBJARRAY (EQPointArray)
 
 WX_DEFINE_OBJARRAY (EQCurveArray)
 
 EVT_COMMAND_RANGE (ID_Slider, ID_Slider+NUMBER_OF_BANDS-1, wxEVT_COMMAND_SLIDER_UPDATED, EffectEqualization::OnSlider) EffectEqualization
 
More...
 
 EVT_LIST_ITEM_SELECTED (CurvesListID, EditCurvesDialog::OnListSelectionChange) EVT_LIST_ITEM_DESELECTED(CurvesListID
 Constructor. More...
 

Variables

static const wxString kInterpStrings [kNumInterpolations]
 
static const double kThirdOct []
 

Detailed Description

Implements EffectEqualiztaion, EqualizationDialog, EqualizationPanel, EQCurve and EQPoint.

Definition in file Equalization.cpp.

Macro Definition Documentation

#define EQCURVES_REVISION   0
#define EQCURVES_VERSION   1
#define UPDATE_ALL   0

Definition at line 145 of file Equalization.cpp.

Referenced by EffectEqualization::LoadCurves().

Enumeration Type Documentation

anonymous enum
Enumerator
ID_Length 
ID_dBMax 
ID_dBMin 
ID_Clear 
ID_Invert 
ID_Mode 
ID_Draw 
ID_Graphic 
ID_Interp 
ID_Linear 
ID_Grid 
ID_Curve 
ID_Manage 
ID_Delete 
ID_Slider 

Definition at line 107 of file Equalization.cpp.

108 {
109  ID_Length = 10000,
110  ID_dBMax,
111  ID_dBMin,
112  ID_Clear,
113  ID_Invert,
114  ID_Mode,
115  ID_Draw,
116  ID_Graphic,
117  ID_Interp,
118  ID_Linear,
119  ID_Grid,
120  ID_Curve,
121  ID_Manage,
122  ID_Delete,
123 #ifdef EXPERIMENTAL_EQ_SSE_THREADED
124  ID_DefaultMath,
125  ID_SSE,
126  ID_SSEThreaded,
127  ID_AVX,
128  ID_AVXThreaded,
129  ID_Bench,
130 #endif
131  ID_Slider, // needs to come last
132 };
Enumerator
kBspline 
kCosine 
kCubic 
kNumInterpolations 
kLinear 
kLogarithmic 
kNumInterpolations 

Definition at line 134 of file Equalization.cpp.

Function Documentation

EVT_COMMAND_RANGE ( ID_Slider  ,
ID_Slider+NUMBER_OF_BANDS 1,
wxEVT_COMMAND_SLIDER_UPDATED  ,
EffectEqualization::OnSlider   
)


Definition at line 188 of file Equalization.cpp.

215  : mFFTBuffer{ windowSize }
216  , mFilterFuncR{ windowSize }
217  , mFilterFuncI{ windowSize }
218 {
219  mCurve = NULL;
220  mPanel = NULL;
221 
222  hFFT = GetFFT(windowSize);
223 
224  SetLinearEffectFlag(true);
225 
226  mM = DEF_FilterLength;
227  mLin = DEF_InterpLin;
228  mInterp = DEF_InterpMeth;
229  mCurveName = DEF_CurveName;
230 
231  GetPrivateConfig(GetCurrentSettingsGroup(), wxT("dBMin"), mdBMin, DEF_dBMin);
232  GetPrivateConfig(GetCurrentSettingsGroup(), wxT("dBMax"), mdBMax, DEF_dBMax);
233  GetPrivateConfig(GetCurrentSettingsGroup(), wxT("DrawMode"), mDrawMode, DEF_DrawMode);
234  GetPrivateConfig(GetCurrentSettingsGroup(), wxT("DrawGrid"), mDrawGrid, DEF_DrawGrid);
235 
236  for (int i = 0; i < kNumInterpolations; i++)
237  {
238  mInterpolations.Add(wxGetTranslation(kInterpStrings[i]));
239  }
240 
241  mLogEnvelope = std::make_unique<Envelope>
242  (false,
243  MIN_dBMin, MAX_dBMax, // MB: this is the highest possible range
244  0.0);
245  mLogEnvelope->SetTrackLen(1.0);
246 
247  mLinEnvelope = std::make_unique<Envelope>
248  (false,
249  MIN_dBMin, MAX_dBMax, // MB: this is the highest possible range
250  0.0);
251  mLinEnvelope->SetTrackLen(1.0);
252 
253  mEnvelope = (mLin ? mLinEnvelope : mLogEnvelope).get();
254 
255  mWindowSize = windowSize;
256 
257  mDirty = false;
258  mDisallowCustom = false;
259 
260  // Load the EQ curves
261  LoadCurves();
262 
263  // Note: initial curve is set in TransferDataToWindow
264 
265  mBandsInUse = NUMBER_OF_BANDS;
266  //double loLog = log10(mLoFreq);
267  //double stepLog = (log10(mHiFreq) - loLog)/((double)NUM_PTS-1.);
268  for(int i=0; i<NUM_PTS-1; i++)
269  mWhens[i] = (double)i/(NUM_PTS-1.);
270  mWhens[NUM_PTS-1] = 1.;
271  mWhenSliders[NUMBER_OF_BANDS] = 1.;
272  mEQVals[NUMBER_OF_BANDS] = 0.;
273 
274 #ifdef EXPERIMENTAL_EQ_SSE_THREADED
275  bool useSSE;
276  GetPrivateConfig(GetCurrentSettingsGroup(), wxT("/SSE/GUI"), useSSE, false);
277  if(useSSE && !mEffectEqualization48x)
278  mEffectEqualization48x = std::make_unique<EffectEqualization48x>();
279  else if(!useSSE)
280  mEffectEqualization48x.reset();
281  mBench=false;
282 #endif
283 }
HFFT GetFFT(size_t fftlen)
Definition: RealFFTf.cpp:110
static const wxString kInterpStrings[kNumInterpolations]
#define NUMBER_OF_BANDS
Definition: Equalization.h:14
#define NUM_PTS
Definition: Equalization.h:15
EVT_LIST_ITEM_SELECTED ( CurvesListID  ,
EditCurvesDialog::OnListSelectionChange   
)

Constructor.

Param ( FilterLength  ,
int  ,
wxT("FilterLength")  ,
4001  ,
21  ,
8191  ,
 
)
Param ( CurveName  ,
wxChar *  ,
wxT("CurveName")  ,
wxT("unnamed")  ,
wxT("")  ,
wxT("")  ,
wxT("")   
)
Param ( InterpLin  ,
bool  ,
wxT("InterpolateLin")  ,
false  ,
false  ,
true  ,
false   
)
Param ( InterpMeth  ,
int  ,
wxT("InterpolationMethod")  ,
,
,
,
 
)
Param ( DrawMode  ,
bool  ,
wxT("")  ,
true  ,
false  ,
true  ,
false   
)
Param ( DrawGrid  ,
bool  ,
wxT("")  ,
true  ,
false  ,
true  ,
false   
)
Param ( dBMin  ,
float  ,
wxT("")  ,
-30.  0,
-120.  0,
-10.  0,
 
)
Param ( dBMax  ,
float  ,
wxT("")  ,
30.  0,
0.  0,
60.  0,
 
)
WX_DEFINE_OBJARRAY ( EQPointArray  )
WX_DEFINE_OBJARRAY ( EQCurveArray  )

Variable Documentation

const wxString kInterpStrings[kNumInterpolations]
static
Initial value:
=
{
XO("B-spline"),
XO("Cosine"),
}
#define XO(s)
Definition: Internat.h:30

Definition at line 147 of file Equalization.cpp.

Referenced by EffectEqualization::GetAutomationParameters(), and EffectEqualization::SetAutomationParameters().

const double kThirdOct[]
static
Initial value:
=
{
20., 25., 31., 40., 50., 63., 80., 100., 125., 160., 200.,
250., 315., 400., 500., 630., 800., 1000., 1250., 1600., 2000.,
2500., 3150., 4000., 5000., 6300., 8000., 10000., 12500., 16000., 20000.,
}

Definition at line 155 of file Equalization.cpp.

Referenced by EffectEqualization::Flatten(), EffectEqualization::Init(), EffectEqualization::LayoutEQSliders(), EffectEqualization::OnInvert(), EffectEqualization::OnSlider(), EffectEqualization::PopulateOrExchange(), and EffectEqualization::UpdateGraphic().