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 "../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, nInterpolations,
  kLinear, kLogarithmic, nInterpolations
}
 

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)
 
 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 IdentInterfaceSymbol kInterpStrings [nInterpolations]
 
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 
nInterpolations 
kLinear 
kLogarithmic 
nInterpolations 

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 186 of file Equalization.cpp.

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

Variable Documentation

const IdentInterfaceSymbol kInterpStrings[nInterpolations]
static
Initial value:
=
{
{ XO("B-spline") },
{ XO("Cosine") },
{ XO("Cubic") }
}
#define XO(s)
Definition: Internat.h:33

Definition at line 147 of file Equalization.cpp.

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 157 of file Equalization.cpp.

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