Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
EffectEqualization Class Reference

An Effect that modifies volume in different frequency bands. More...

#include <Equalization.h>

Inheritance diagram for EffectEqualization:
[legend]
Collaboration diagram for EffectEqualization:
[legend]

Public Member Functions

 EffectEqualization (int Options=kEqLegacy)
 
virtual ~EffectEqualization ()
 
ComponentInterfaceSymbol GetSymbol () const override
 
TranslatableString GetDescription () const override
 
ManualPageID ManualPage () const override
 Name of a page in the Audacity alpha manual, default is empty. More...
 
bool VisitSettings (SettingsVisitor &visitor, EffectSettings &settings) override
 
bool VisitSettings (ConstSettingsVisitor &visitor, const EffectSettings &settings) const override
 
EffectType GetType () const override
 Type determines how it behaves. More...
 
bool LoadFactoryDefaults (EffectSettings &settings) const override
 Change settings back to "factory default". More...
 
bool DoLoadFactoryDefaults (EffectSettings &settings)
 
RegistryPaths GetFactoryPresets () const override
 Report names of factory presets. More...
 
bool LoadFactoryPreset (int id, EffectSettings &settings) const override
 Change settings to the preset whose name is GetFactoryPresets()[id] More...
 
bool ValidateUI (EffectSettings &) override
 
bool Init () override
 Call once to set up state for whole list of tracks to be processed. More...
 
bool Process (EffectInstance &instance, EffectSettings &settings) override
 Actually do the effect here. More...
 
bool CloseUI () override
 
std::unique_ptr< EffectUIValidatorPopulateOrExchange (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access) override
 Add controls to effect panel; always succeeds. More...
 
bool TransferDataToWindow (const EffectSettings &settings) override
 Update controls for the settings. More...
 
- Public Member Functions inherited from StatefulEffect
std::shared_ptr< EffectInstanceMakeInstance () const override
 Make an object maintaining short-term state of an Effect. More...
 
- Public Member Functions inherited from StatefulEffectBase
virtual bool Init ()
 Call once to set up state for whole list of tracks to be processed. More...
 
virtual bool Process (EffectInstance &instance, EffectSettings &settings)=0
 Actually do the effect here. More...
 
virtual bool RealtimeInitialize (EffectSettings &settings, double sampleRate)
 
virtual bool RealtimeAddProcessor (EffectSettings &settings, unsigned numChannels, float sampleRate)
 
virtual bool RealtimeSuspend ()
 
virtual bool RealtimeResume ()
 
virtual bool RealtimeProcessStart (EffectSettings &settings)
 settings are possibly changed, since last call, by an asynchronous dialog More...
 
virtual size_t RealtimeProcess (size_t group, EffectSettings &settings, const float *const *inBuf, float *const *outBuf, size_t numSamples)
 
virtual bool RealtimeProcessEnd (EffectSettings &settings) noexcept
 settings can be updated to let a dialog change appearance at idle More...
 
virtual bool RealtimeFinalize (EffectSettings &settings) noexcept
 
virtual size_t SetBlockSize (size_t maxBlockSize)
 
virtual size_t GetBlockSize () const
 
- Public Member Functions inherited from Effect
 Effect ()
 
virtual ~Effect ()
 
PluginPath GetPath () const override
 
bool VisitSettings (SettingsVisitor &visitor, EffectSettings &settings) override
 
bool VisitSettings (ConstSettingsVisitor &visitor, const EffectSettings &settings) const override
 
ComponentInterfaceSymbol GetSymbol () const override
 
VendorSymbol GetVendor () const override
 
wxString GetVersion () const override
 
TranslatableString GetDescription () const override
 
EffectType GetType () const override
 Type determines how it behaves. More...
 
EffectFamilySymbol GetFamily () const override
 Report identifier and user-visible name of the effect protocol. More...
 
bool IsInteractive () const override
 Whether the effect needs a dialog for entry of settings. More...
 
bool IsDefault () const override
 Whether the effect sorts "above the line" in the menus. More...
 
RealtimeSince RealtimeSupport () const override
 Since which version of Audacity has the effect supported realtime? More...
 
bool SupportsAutomation () const override
 Whether the effect has any automatable controls. More...
 
bool SaveSettings (const EffectSettings &settings, CommandParameters &parms) const override
 Store settings as keys and values. More...
 
bool LoadSettings (const CommandParameters &parms, EffectSettings &settings) const override
 Restore settings from keys and values. More...
 
bool LoadUserPreset (const RegistryPath &name, EffectSettings &settings) const override
 Change settings to a user-named preset. More...
 
bool SaveUserPreset (const RegistryPath &name, const EffectSettings &settings) const override
 Save settings in the configuration file as a user-named preset. More...
 
RegistryPaths GetFactoryPresets () const override
 Report names of factory presets. More...
 
bool LoadFactoryPreset (int id, EffectSettings &settings) const override
 Change settings to the preset whose name is GetFactoryPresets()[id] More...
 
bool LoadFactoryDefaults (EffectSettings &settings) const override
 Change settings back to "factory default". More...
 
unsigned GetAudioInCount () const override
 How many input buffers to allocate at once. More...
 
unsigned GetAudioOutCount () const override
 How many output buffers to allocate at once. More...
 
virtual const EffectParameterMethodsParameters () const
 
int ShowClientInterface (wxWindow &parent, wxDialog &dialog, bool forceModal=false) override
 
std::unique_ptr< EffectUIValidatorPopulateUI (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access) override
 Adds controls to a panel that is given as the parent window of S More...
 
bool IsGraphicalUI () override
 
bool ValidateUI (EffectSettings &) override
 
bool CloseUI () override
 
bool CanExportPresets () override
 
void ExportPresets (const EffectSettings &settings) const override
 
void ImportPresets (EffectSettings &settings) override
 
bool HasOptions () override
 
void ShowOptions () override
 
const EffectSettingsManagerGetDefinition () const override
 
virtual NumericFormatSymbol GetSelectionFormat ()
 
int ShowHostInterface (wxWindow &parent, const EffectDialogFactory &factory, std::shared_ptr< EffectInstance > &pInstance, EffectSettingsAccess &access, bool forceModal=false) override
 Usually applies factory to self and given access. More...
 
bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const override
 
bool LoadSettingsFromString (const wxString &parms, EffectSettings &settings) const override
 
bool IsBatchProcessing () const override
 
void SetBatchProcessing () override
 
void UnsetBatchProcessing () override
 
bool TransferDataToWindow (const EffectSettings &settings) override
 Update controls for the settings. More...
 
bool TransferDataFromWindow (EffectSettings &settings) override
 Update the given settings from controls. More...
 
unsigned TestUIFlags (unsigned mask)
 
bool Delegate (Effect &delegate, EffectSettings &settings)
 Re-invoke DoEffect on another Effect object that implements the work. More...
 
int MessageBox (const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={}) const
 
bool EnableApply (bool enable=true)
 
wxWindow * GetUIParent ()
 
- Public Member Functions inherited from EffectBase
 EffectBase ()
 
 ~EffectBase () override
 
- Public Member Functions inherited from EffectUIClientInterface
virtual ~EffectUIClientInterface ()
 
virtual int ShowClientInterface (wxWindow &parent, wxDialog &dialog, bool forceModal=false)=0
 
virtual bool IsGraphicalUI ()=0
 
virtual std::unique_ptr< EffectUIValidatorPopulateUI (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access)=0
 Adds controls to a panel that is given as the parent window of S More...
 
virtual bool CanExportPresets ()=0
 
virtual void ExportPresets (const EffectSettings &settings) const =0
 
virtual void ImportPresets (EffectSettings &settings)=0
 
virtual bool HasOptions ()=0
 
virtual void ShowOptions ()=0
 
- Public Member Functions inherited from EffectPlugin
EffectPluginoperator= (EffectPlugin &)=delete
 
virtual ~EffectPlugin ()
 
virtual const EffectSettingsManagerGetDefinition () const =0
 
virtual int ShowHostInterface (wxWindow &parent, const EffectDialogFactory &factory, std::shared_ptr< EffectInstance > &pInstance, EffectSettingsAccess &access, bool forceModal=false)=0
 Usually applies factory to self and given access. More...
 
virtual void Preview (EffectSettingsAccess &access, bool dryOnly)=0
 
virtual bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const =0
 
virtual bool LoadSettingsFromString (const wxString &parms, EffectSettings &settings) const =0
 
virtual bool IsBatchProcessing () const =0
 
virtual void SetBatchProcessing ()=0
 
virtual void UnsetBatchProcessing ()=0
 
virtual bool DoEffect (EffectSettings &settings, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, wxWindow *pParent=nullptr, const EffectDialogFactory &dialogFactory={}, const EffectSettingsAccessPtr &pAccess=nullptr)=0
 Unfortunately complicated dual-use function. More...
 
virtual bool TransferDataToWindow (const EffectSettings &settings)=0
 Update controls for the settings. More...
 
virtual bool TransferDataFromWindow (EffectSettings &settings)=0
 Update the given settings from controls. More...
 
- Public Member Functions inherited from EffectInstanceFactory
virtual ~EffectInstanceFactory ()
 
virtual std::shared_ptr< EffectInstanceMakeInstance () const =0
 Make an object maintaining short-term state of an Effect. More...
 
virtual unsigned GetAudioInCount () const =0
 How many input buffers to allocate at once. More...
 
virtual unsigned GetAudioOutCount () const =0
 How many output buffers to allocate at once. More...
 
virtual int GetMidiInCount () const
 Function that has not yet found a use. More...
 
virtual int GetMidiOutCount () const
 Function that has not yet found a use. More...
 
- Public Member Functions inherited from EffectSettingsManager
virtual ~EffectSettingsManager ()
 
virtual bool VisitSettings (SettingsVisitor &visitor, EffectSettings &settings)
 
virtual bool VisitSettings (ConstSettingsVisitor &visitor, const EffectSettings &settings) const
 
virtual EffectSettings MakeSettings () const
 
virtual bool CopySettingsContents (const EffectSettings &src, EffectSettings &dst) const
 Update one settings object from another. More...
 
- Public Member Functions inherited from EffectDefinitionInterface
virtual ~EffectDefinitionInterface ()
 
virtual EffectType GetType () const =0
 Type determines how it behaves. More...
 
virtual EffectType GetClassification () const
 Determines which menu it appears in; default same as GetType(). More...
 
virtual EffectFamilySymbol GetFamily () const =0
 Report identifier and user-visible name of the effect protocol. More...
 
virtual bool IsInteractive () const =0
 Whether the effect needs a dialog for entry of settings. More...
 
virtual bool IsDefault () const =0
 Whether the effect sorts "above the line" in the menus. More...
 
virtual RealtimeSince RealtimeSupport () const =0
 Since which version of Audacity has the effect supported realtime? More...
 
bool SupportsRealtime () const
 
virtual bool SupportsAutomation () const =0
 Whether the effect has any automatable controls. More...
 
virtual bool EnablesDebug () const
 Whether the effect dialog should have a Debug button; default, always false. More...
 
virtual ManualPageID ManualPage () const
 Name of a page in the Audacity alpha manual, default is empty. More...
 
virtual FilePath HelpPage () const
 Fully qualified local help file name, default is empty. More...
 
virtual bool IsHiddenFromMenus () const
 Default is false. More...
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
virtual PluginPath GetPath () const =0
 
virtual ComponentInterfaceSymbol GetSymbol () const =0
 
virtual VendorSymbol GetVendor () const =0
 
virtual wxString GetVersion () const =0
 
virtual TranslatableString GetDescription () const =0
 
TranslatableString GetName () const
 
- Public Member Functions inherited from XMLTagHandler
 XMLTagHandler ()
 
virtual ~XMLTagHandler ()
 
virtual bool HandleXMLTag (const std::string_view &tag, const AttributesList &attrs)=0
 
virtual void HandleXMLEndTag (const std::string_view &WXUNUSED(tag))
 
virtual void HandleXMLContent (const std::string_view &WXUNUSED(content))
 
virtual XMLTagHandlerHandleXMLChild (const std::string_view &tag)=0
 
void ReadXMLEndTag (const char *tag)
 
void ReadXMLContent (const char *s, int len)
 
XMLTagHandlerReadXMLChild (const char *tag)
 

Static Public Member Functions

static EffectEqualizationFetchParameters (EffectEqualization &e, EffectSettings &)
 
- Static Public Member Functions inherited from Effect
static EffectFetchParameters (Effect &e, EffectSettings &)
 
static void IncEffectCounter ()
 
- Static Public Member Functions inherited from EffectDefinitionInterface
static Identifier GetSquashedName (const Identifier &ident)
 A utility that strips spaces and CamelCases a name. More...
 

Static Public Attributes

static const ComponentInterfaceSymbol Symbol { XO("Equalization") }
 
- Static Public Attributes inherited from EffectPlugin
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>")
 

Private Types

enum  { loFreqI =20 }
 
enum  kInterpolations { kBspline , kCosine , kCubic , nInterpolations }
 

Private Member Functions

wxString GetPrefsPrefix ()
 
bool ProcessOne (int count, WaveTrack *t, sampleCount start, sampleCount len)
 
bool CalcFilter ()
 
void Filter (size_t len, float *buffer)
 
void Flatten ()
 
void ForceRecalc ()
 
void EnvelopeUpdated ()
 
void EnvelopeUpdated (Envelope *env, bool lin)
 
bool IsLinear ()
 
void LoadCurves (const wxString &fileName={}, bool append=false)
 
void SaveCurves (const wxString &fileName={})
 
void UpdateDefaultCurves (bool updateAll=false)
 
void Select (int sel)
 
void setCurve (int currentCurve)
 
void setCurve (const wxString &curveName)
 
void setCurve (void)
 
bool GetDefaultFileName (wxFileName &fileName)
 
bool HandleXMLTag (const std::string_view &tag, const AttributesList &attrs) override
 
XMLTagHandlerHandleXMLChild (const std::string_view &tag) override
 
void WriteXML (XMLWriter &xmlFile) const
 
void UpdateCurves ()
 
void UpdateRuler ()
 
void UpdateDraw ()
 
void UpdateGraphic (void)
 
void EnvLogToLin (void)
 
void EnvLinToLog (void)
 
void ErrMin (void)
 
void GraphicEQ (Envelope *env)
 
void spline (double x[], double y[], size_t n, double y2[])
 
double splint (double x[], double y[], size_t n, double y2[], double xr)
 
void OnErase (wxEvent &event)
 
void OnSize (wxSizeEvent &event)
 
void OnSlider (wxCommandEvent &event)
 
void OnInterp (wxCommandEvent &event)
 
void OnSliderM (wxCommandEvent &event)
 
void OnSliderDBMAX (wxCommandEvent &event)
 
void OnSliderDBMIN (wxCommandEvent &event)
 
void OnDrawMode (wxCommandEvent &event)
 
void OnGraphicMode (wxCommandEvent &event)
 
void OnCurve (wxCommandEvent &event)
 
void OnManage (wxCommandEvent &event)
 
void OnClear (wxCommandEvent &event)
 
void OnInvert (wxCommandEvent &event)
 
void OnGridOnOff (wxCommandEvent &event)
 
void OnLinFreq (wxCommandEvent &event)
 
const EffectParameterMethodsParameters () const override
 

Private Attributes

int mOptions
 
HFFT hFFT
 
Floats mFFTBuffer
 
Floats mFilterFuncR
 
Floats mFilterFuncI
 
size_t mM
 
wxString mCurveName
 
bool mLin
 
float mdBMax
 
float mdBMin
 
bool mDrawMode
 
int mInterp
 
bool mDrawGrid
 
double mWhens [NUM_PTS]
 
double mWhenSliders [NUMBER_OF_BANDS+1]
 
size_t mBandsInUse
 
RulerPanelmdBRuler
 
RulerPanelmFreqRuler
 
bool mDisallowCustom
 
double mLoFreq
 
double mHiFreq
 
size_t mWindowSize
 
bool mDirty
 
int mSlidersOld [NUMBER_OF_BANDS]
 
double mEQVals [NUMBER_OF_BANDS+1]
 
EQCurveArray mCurves
 
std::unique_ptr< EnvelopemLogEnvelope
 
std::unique_ptr< EnvelopemLinEnvelope
 
EnvelopemEnvelope
 
wxSizer * szrC
 
wxSizer * szrG
 
wxSizer * szrV
 
wxSizer * szrH
 
wxSizer * szrI
 
wxSizer * szrL
 
wxSizer * szr1
 
wxSizer * szr2
 
wxSizer * szr3
 
wxSizer * szr4
 
wxSizer * szr5
 
wxSizerItem * mLeftSpacer
 
EqualizationPanelmPanel
 
wxRadioButton * mDraw
 
wxRadioButton * mGraphic
 
wxCheckBox * mLinFreq
 
wxCheckBox * mGridOnOff
 
wxChoice * mInterpChoice
 
wxChoice * mCurve
 
wxButton * mManage
 
wxStaticText * mMText
 
wxSlider * mMSlider
 
wxSlider * mdBMinSlider
 
wxSlider * mdBMaxSlider
 
wxSlider * mSliders [NUMBER_OF_BANDS]
 

Static Private Attributes

static const size_t windowSize = 16384u
 
static const EnumValueSymbol kInterpStrings [nInterpolations]
 
static constexpr EffectParameter FilterLength
 
static constexpr EffectParameter CurveName
 
static constexpr EffectParameter InterpLin
 
static constexpr EnumParameter InterpMeth
 
static constexpr EffectParameter DrawMode
 
static constexpr EffectParameter DrawGrid
 
static constexpr EffectParameter dBMin
 
static constexpr EffectParameter dBMax
 

Friends

class EqualizationPanel
 
class EditCurvesDialog
 

Additional Inherited Members

- Public Types inherited from Effect
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
- Public Types inherited from EffectPlugin
using EffectSettingsAccessPtr = std::shared_ptr< EffectSettingsAccess >
 
- Public Types inherited from EffectDefinitionInterface
enum class  RealtimeSince : unsigned { Never , Since_3_2 , Always }
 In which versions of Audacity was an effect realtime capable? More...
 
- Protected Member Functions inherited from Effect
bool EnablePreview (bool enable=true)
 
bool CheckWhetherSkipEffect (const EffectSettings &settings) const override
 Default implementation returns false. More...
 
double CalcPreviewInputLength (const EffectSettings &settings, double previewLength) const override
 Default implementation returns previewLength More...
 
virtual std::unique_ptr< EffectUIValidatorPopulateOrExchange (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access)
 Add controls to effect panel; always succeeds. More...
 
bool TotalProgress (double frac, const TranslatableString &={}) const
 
bool TrackProgress (int whichTrack, double frac, const TranslatableString &={}) const
 
bool TrackGroupProgress (int whichGroup, double frac, const TranslatableString &={}) const
 
int GetNumWaveTracks () const
 
int GetNumWaveGroups () const
 
void GetBounds (const WaveTrack &track, const WaveTrack *pRight, sampleCount *start, sampleCount *len)
 
void CopyInputTracks (bool allSyncLockSelected=false)
 
std::shared_ptr< AddedAnalysisTrackAddAnalysisTrack (const wxString &name=wxString())
 
ModifiedAnalysisTrack ModifyAnalysisTrack (const LabelTrack *pOrigTrack, const wxString &name=wxString())
 
TrackAddToOutputTracks (const std::shared_ptr< Track > &t)
 
- Protected Member Functions inherited from EffectBase
void Preview (EffectSettingsAccess &access, bool dryOnly) override
 
bool DoEffect (EffectSettings &settings, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, wxWindow *pParent, const EffectDialogFactory &dialogFactory, const EffectSettingsAccessPtr &pAccess) override
 Unfortunately complicated dual-use function. More...
 
virtual bool CheckWhetherSkipEffect (const EffectSettings &settings) const =0
 After Init(), tell whether Process() should be skipped. More...
 
virtual double CalcPreviewInputLength (const EffectSettings &settings, double previewLength) const =0
 
void SetLinearEffectFlag (bool linearEffectFlag)
 
void SetPreviewFullSelectionFlag (bool previewDurationFlag)
 
bool IsPreviewing () const
 
void IncludeNotSelectedPreviewTracks (bool includeNotSelected)
 
void ReplaceProcessedTracks (const bool bGoodResult)
 
const TrackListinputTracks () const
 
const AudacityProjectFindProject () const
 
virtual bool ValidateUI (EffectSettings &settings)=0
 
virtual bool CloseUI ()=0
 
- Protected Attributes inherited from Effect
wxWeakRef< wxDialog > mHostUIDialog
 This smart pointer tracks the lifetime of the dialog. More...
 
wxWindow * mUIParent {}
 
- Protected Attributes inherited from EffectBase
BasicUI::ProgressDialogmProgress {}
 
double mProjectRate {}
 
WaveTrackFactorymFactory {}
 
std::shared_ptr< TrackListmOutputTracks
 
double mT0 {}
 
double mT1 {}
 
wxArrayString mPresetNames
 
unsigned mUIFlags { 0 }
 
- Protected Attributes inherited from EffectUIClientInterface
friend EffectUIValidator
 
friend DefaultEffectUIValidator
 
- Static Protected Attributes inherited from EffectBase
static int nEffectsDone = 0
 

Detailed Description

An Effect that modifies volume in different frequency bands.

Performs filtering, using an FFT to do a FIR filter. It lets the user draw an arbitrary envelope (using the same envelope editing code that is used to edit the track's amplitude envelope).

Also allows the curve to be specified with a series of 'graphic EQ' sliders.

The filter is applied using overlap/add of Hann windows.

Clone of the FFT Filter effect, no longer part of Audacity.

Definition at line 97 of file Equalization.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
loFreqI 

Definition at line 153 of file Equalization.h.

◆ kInterpolations

Enumerator
kBspline 
kCosine 
kCubic 
nInterpolations 

Definition at line 292 of file Equalization.h.

Constructor & Destructor Documentation

◆ EffectEqualization()

EffectEqualization::EffectEqualization ( int  Options = kEqLegacy)

Referenced by Parameters().

Here is the caller graph for this function:

◆ ~EffectEqualization()

EffectEqualization::~EffectEqualization ( )
virtual

Definition at line 340 of file Equalization.cpp.

341{
342}

Member Function Documentation

◆ CalcFilter()

bool EffectEqualization::CalcFilter ( )
private

Definition at line 1325 of file Equalization.cpp.

1326{
1327 double loLog = log10(mLoFreq);
1328 double hiLog = log10(mHiFreq);
1329 double denom = hiLog - loLog;
1330
1331 double delta = mHiFreq / ((double)(mWindowSize / 2.));
1332 double val0;
1333 double val1;
1334
1335 if( IsLinear() )
1336 {
1337 val0 = mLinEnvelope->GetValue(0.0); //no scaling required - saved as dB
1338 val1 = mLinEnvelope->GetValue(1.0);
1339 }
1340 else
1341 {
1342 val0 = mLogEnvelope->GetValue(0.0); //no scaling required - saved as dB
1343 val1 = mLogEnvelope->GetValue(1.0);
1344 }
1345 mFilterFuncR[0] = val0;
1346 double freq = delta;
1347
1348 for(size_t i = 1; i <= mWindowSize / 2; i++)
1349 {
1350 double when;
1351 if( IsLinear() )
1352 when = freq/mHiFreq;
1353 else
1354 when = (log10(freq) - loLog)/denom;
1355 if(when < 0.)
1356 {
1357 mFilterFuncR[i] = val0;
1358 }
1359 else if(when > 1.0)
1360 {
1361 mFilterFuncR[i] = val1;
1362 }
1363 else
1364 {
1365 if( IsLinear() )
1366 mFilterFuncR[i] = mLinEnvelope->GetValue(when);
1367 else
1368 mFilterFuncR[i] = mLogEnvelope->GetValue(when);
1369 }
1370 freq += delta;
1371 }
1372 mFilterFuncR[mWindowSize / 2] = val1;
1373
1375
1376 {
1377 size_t i = 1;
1378 for(; i < mWindowSize / 2; i++)
1379 {
1381 mFilterFuncR[mWindowSize - i] = mFilterFuncR[i]; //Fill entire array
1382 }
1383 mFilterFuncR[i] = DB_TO_LINEAR(mFilterFuncR[i]); //do last one
1384 }
1385
1386 //transfer to time domain to do the padding and windowing
1387 Floats outr{ mWindowSize };
1388 Floats outi{ mWindowSize };
1389 InverseRealFFT(mWindowSize, mFilterFuncR.get(), NULL, outr.get()); // To time domain
1390
1391 {
1392 size_t i = 0;
1393 for(; i <= (mM - 1) / 2; i++)
1394 { //Windowing - could give a choice, fixed for now - MJS
1395 // double mult=0.54-0.46*cos(2*M_PI*(i+(mM-1)/2.0)/(mM-1)); //Hamming
1396 //Blackman
1397 double mult =
1398 0.42 -
1399 0.5 * cos(2 * M_PI * (i + (mM - 1) / 2.0) / (mM - 1)) +
1400 .08 * cos(4 * M_PI * (i + (mM - 1) / 2.0) / (mM - 1));
1401 outr[i] *= mult;
1402 if(i != 0){
1403 outr[mWindowSize - i] *= mult;
1404 }
1405 }
1406 for(; i <= mWindowSize / 2; i++)
1407 { //Padding
1408 outr[i] = 0;
1409 outr[mWindowSize - i] = 0;
1410 }
1411 }
1412 Floats tempr{ mM };
1413 {
1414 size_t i = 0;
1415 for(; i < (mM - 1) / 2; i++)
1416 { //shift so that padding on right
1417 tempr[(mM - 1) / 2 + i] = outr[i];
1418 tempr[i] = outr[mWindowSize - (mM - 1) / 2 + i];
1419 }
1420 tempr[(mM - 1) / 2 + i] = outr[i];
1421 }
1422
1423 for (size_t i = 0; i < mM; i++)
1424 { //and copy useful values back
1425 outr[i] = tempr[i];
1426 }
1427 for (size_t i = mM; i < mWindowSize; i++)
1428 { //rest is padding
1429 outr[i]=0.;
1430 }
1431
1432 //Back to the frequency domain so we can use it
1433 RealFFT(mWindowSize, outr.get(), mFilterFuncR.get(), mFilterFuncI.get());
1434
1435 return TRUE;
1436}
#define M_PI
Definition: Distortion.cpp:29
void InverseRealFFT(size_t NumSamples, const float *RealIn, const float *ImagIn, float *RealOut)
Definition: FFT.cpp:268
void RealFFT(size_t NumSamples, const float *RealIn, float *RealOut, float *ImagOut)
Definition: FFT.cpp:230
#define DB_TO_LINEAR(x)
Definition: MemoryX.h:535
std::unique_ptr< Envelope > mLinEnvelope
Definition: Equalization.h:242
std::unique_ptr< Envelope > mLogEnvelope
Definition: Equalization.h:242

References DB_TO_LINEAR, InverseRealFFT(), IsLinear(), M_PI, mFilterFuncI, mFilterFuncR, mHiFreq, mLinEnvelope, mLoFreq, mLogEnvelope, mM, mWindowSize, and RealFFT().

Referenced by Init(), Process(), and EqualizationPanel::Recalc().

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

◆ CloseUI()

bool EffectEqualization::CloseUI ( )
overridevirtual

Reimplemented from Effect.

Definition at line 673 of file Equalization.cpp.

674{
675 mCurve = NULL;
676 mPanel = NULL;
677
678 return Effect::CloseUI();
679}
EqualizationPanel * mPanel
Definition: Equalization.h:265
bool CloseUI() override
Definition: Effect.cpp:318

References Effect::CloseUI(), mCurve, and mPanel.

Here is the call graph for this function:

◆ DoLoadFactoryDefaults()

bool EffectEqualization::DoLoadFactoryDefaults ( EffectSettings settings)

Definition at line 431 of file Equalization.cpp.

432{
433 mdBMin = dBMin.def;
434 mdBMax = dBMax.def;
437
439 mDrawMode = true;
441 mDrawMode = false;
442
444}
const int kEqOptionCurve
Definition: Equalization.h:28
const int kEqOptionGraphic
Definition: Equalization.h:27
static Settings & settings()
Definition: TrackInfo.cpp:87
static constexpr EffectParameter DrawGrid
Definition: Equalization.h:312
static constexpr EffectParameter dBMin
Definition: Equalization.h:314
static constexpr EffectParameter DrawMode
Definition: Equalization.h:310
static constexpr EffectParameter dBMax
Definition: Equalization.h:316
bool LoadFactoryDefaults(EffectSettings &settings) const override
Change settings back to "factory default".
Definition: Effect.cpp:280
const Type def
Default value.
Definition: Shuttle.h:29

References dBMax, dBMin, EffectParameter< Structure, Member, Type, Value >::def, DrawGrid, DrawMode, kEqOptionCurve, kEqOptionGraphic, Effect::LoadFactoryDefaults(), mdBMax, mdBMin, mDrawGrid, mDrawMode, mOptions, and settings().

Referenced by LoadFactoryDefaults().

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

◆ EnvelopeUpdated() [1/2]

void EffectEqualization::EnvelopeUpdated ( )
private

Definition at line 1963 of file Equalization.cpp.

1964{
1965 if (IsLinear())
1966 {
1967 EnvelopeUpdated(mLinEnvelope.get(), true);
1968 }
1969 else
1970 {
1971 EnvelopeUpdated(mLogEnvelope.get(), false);
1972 }
1973}

References EnvelopeUpdated(), IsLinear(), mLinEnvelope, and mLogEnvelope.

Referenced by EnvelopeUpdated(), EnvLinToLog(), ErrMin(), Flatten(), OnInterp(), OnInvert(), EqualizationPanel::OnMouseEvent(), OnSlider(), and UpdateDraw().

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

◆ EnvelopeUpdated() [2/2]

void EffectEqualization::EnvelopeUpdated ( Envelope env,
bool  lin 
)
private

Definition at line 1975 of file Equalization.cpp.

1976{
1977 // Allocate and populate point arrays
1978 size_t numPoints = env->GetNumberOfPoints();
1979 Doubles when{ numPoints };
1980 Doubles value{ numPoints };
1981 env->GetPoints( when.get(), value.get(), numPoints );
1982
1983 // Clear the unnamed curve
1984 int curve = mCurves.size() - 1;
1985 mCurves[ curve ].points.clear();
1986
1987 if(lin)
1988 {
1989 // Copy and convert points
1990 for (size_t point = 0; point < numPoints; point++)
1991 {
1992 double freq = when[ point ] * mHiFreq;
1993 double db = value[ point ];
1994
1995 // Add it to the curve
1996 mCurves[ curve ].points.push_back( EQPoint( freq, db ) );
1997 }
1998 }
1999 else
2000 {
2001 double loLog = log10( 20. );
2002 double hiLog = log10( mHiFreq );
2003 double denom = hiLog - loLog;
2004
2005 // Copy and convert points
2006 for (size_t point = 0; point < numPoints; point++)
2007 {
2008 double freq = pow( 10., ( ( when[ point ] * denom ) + loLog ));
2009 double db = value[ point ];
2010
2011 // Add it to the curve
2012 mCurves[ curve ].points.push_back( EQPoint( freq, db ) );
2013 }
2014 }
2015 // Remember that we've updated the unnamed curve
2016 mDirty = true;
2017
2018 // set 'unnamed' as the selected curve
2019 Select( (int) mCurves.size() - 1 );
2020}
EQPoint is used with EQCurve and hence EffectEqualization.
Definition: Equalization.h:55
void Select(int sel)
EQCurveArray mCurves
Definition: Equalization.h:240
size_t GetNumberOfPoints() const
Return number of points.
Definition: Envelope.cpp:689
void GetPoints(double *bufferWhen, double *bufferValue, int bufferLen) const
Returns the sets of when and value pairs.
Definition: Envelope.cpp:694

References Envelope::GetNumberOfPoints(), Envelope::GetPoints(), mCurves, mDirty, mHiFreq, and Select().

Here is the call graph for this function:

◆ EnvLinToLog()

void EffectEqualization::EnvLinToLog ( void  )
private

Definition at line 2387 of file Equalization.cpp.

2388{
2389 size_t numPoints = mLinEnvelope->GetNumberOfPoints();
2390 if( numPoints == 0 )
2391 {
2392 return;
2393 }
2394
2395 Doubles when{ numPoints };
2396 Doubles value{ numPoints };
2397
2398 mLogEnvelope->Flatten(0.);
2399 mLogEnvelope->SetTrackLen(1.0);
2400 mLinEnvelope->GetPoints( when.get(), value.get(), numPoints );
2401 mLogEnvelope->Reassign(0., value[0]);
2402 double loLog = log10(20.);
2403 double hiLog = log10(mHiFreq);
2404 double denom = hiLog - loLog;
2405 bool changed = false;
2406
2407 for (size_t i = 0; i < numPoints; i++)
2408 {
2409 if( when[i]*mHiFreq >= 20 )
2410 {
2411 // Caution: on Linux, when when == 20, the log calculation rounds
2412 // to just under zero, which causes an assert error.
2413 double flog = (log10(when[i]*mHiFreq)-loLog)/denom;
2414 mLogEnvelope->Insert(std::max(0.0, flog) , value[i]);
2415 }
2416 else
2417 { //get the first point as close as we can to the last point requested
2418 changed = true;
2419 double v = value[i];
2420 mLogEnvelope->Insert(0., v);
2421 }
2422 }
2423 mLogEnvelope->Reassign(1., value[numPoints - 1]);
2424
2425 if(changed)
2426 EnvelopeUpdated(mLogEnvelope.get(), false);
2427}

References EnvelopeUpdated(), mHiFreq, mLinEnvelope, and mLogEnvelope.

Referenced by OnInvert(), OnLinFreq(), and UpdateGraphic().

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

◆ EnvLogToLin()

void EffectEqualization::EnvLogToLin ( void  )
private

Definition at line 2363 of file Equalization.cpp.

2364{
2365 size_t numPoints = mLogEnvelope->GetNumberOfPoints();
2366 if( numPoints == 0 )
2367 {
2368 return;
2369 }
2370
2371 Doubles when{ numPoints };
2372 Doubles value{ numPoints };
2373
2374 mLinEnvelope->Flatten(0.);
2375 mLinEnvelope->SetTrackLen(1.0);
2376 mLogEnvelope->GetPoints( when.get(), value.get(), numPoints );
2377 mLinEnvelope->Reassign(0., value[0]);
2378 double loLog = log10(20.);
2379 double hiLog = log10(mHiFreq);
2380 double denom = hiLog - loLog;
2381
2382 for (size_t i = 0; i < numPoints; i++)
2383 mLinEnvelope->Insert(pow( 10., ((when[i] * denom) + loLog))/mHiFreq , value[i]);
2384 mLinEnvelope->Reassign(1., value[numPoints-1]);
2385}

References mHiFreq, mLinEnvelope, and mLogEnvelope.

Referenced by OnInvert(), OnLinFreq(), and UpdateDraw().

Here is the caller graph for this function:

◆ ErrMin()

void EffectEqualization::ErrMin ( void  )
private

Definition at line 2429 of file Equalization.cpp.

2430{
2431 double vals[NUM_PTS];
2432 double error = 0.0;
2433 double oldError = 0.0;
2434 double mEQValsOld = 0.0;
2435 double correction = 1.6;
2436 bool flag;
2437 size_t j=0;
2438 Envelope testEnvelope{ *mLogEnvelope };
2439
2440 for(size_t i = 0; i < NUM_PTS; i++)
2441 vals[i] = testEnvelope.GetValue(mWhens[i]);
2442
2443 // Do error minimisation
2444 error = 0.;
2445 GraphicEQ(&testEnvelope);
2446 for(size_t i = 0; i < NUM_PTS; i++) //calc initial error
2447 {
2448 double err = vals[i] - testEnvelope.GetValue(mWhens[i]);
2449 error += err*err;
2450 }
2451 oldError = error;
2452 while( j < mBandsInUse*12 ) //loop over the sliders a number of times
2453 {
2454 auto i = j % mBandsInUse; //use this slider
2455 if( (j > 0) & (i == 0) ) // if we've come back to the first slider again...
2456 {
2457 if( correction > 0 )
2458 correction = -correction; //go down
2459 else
2460 correction = -correction/2.; //go up half as much
2461 }
2462 flag = true; // check if we've hit the slider limit
2463 do
2464 {
2465 oldError = error;
2466 mEQValsOld = mEQVals[i];
2467 mEQVals[i] += correction; //move fader value
2468 if( mEQVals[i] > 20. )
2469 {
2470 mEQVals[i] = 20.;
2471 flag = false;
2472 }
2473 if( mEQVals[i] < -20. )
2474 {
2475 mEQVals[i] = -20.;
2476 flag = false;
2477 }
2478 GraphicEQ(&testEnvelope); //calculate envelope
2479 error = 0.;
2480 for(size_t k = 0; k < NUM_PTS; k++) //calculate error
2481 {
2482 double err = vals[k] - testEnvelope.GetValue(mWhens[k]);
2483 error += err*err;
2484 }
2485 }
2486 while( (error < oldError) && flag );
2487 if( error > oldError )
2488 {
2489 mEQVals[i] = mEQValsOld; //last one didn't work
2490 error = oldError;
2491 }
2492 else
2493 oldError = error;
2494 if( error < .0025 * mBandsInUse)
2495 break; // close enuff
2496 j++; //try next slider
2497 }
2498 if( error > .0025 * mBandsInUse ) // not within 0.05dB on each slider, on average
2499 {
2500 Select( (int) mCurves.size() - 1 );
2501 EnvelopeUpdated(&testEnvelope, false);
2502 }
2503}
#define NUM_PTS
Definition: Equalization.h:15
static std::once_flag flag
double mWhens[NUM_PTS]
Definition: Equalization.h:226
void GraphicEQ(Envelope *env)
double mEQVals[NUMBER_OF_BANDS+1]
Definition: Equalization.h:238
Piecewise linear or piecewise exponential function from double to double.
Definition: Envelope.h:72

References EnvelopeUpdated(), flag, GraphicEQ(), mBandsInUse, mCurves, mEQVals, mLogEnvelope, mWhens, NUM_PTS, and Select().

Referenced by UpdateGraphic().

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

◆ FetchParameters()

static EffectEqualization * EffectEqualization::FetchParameters ( EffectEqualization e,
EffectSettings  
)
inlinestatic

Definition at line 102 of file Equalization.h.

102{ return &e; }

◆ Filter()

void EffectEqualization::Filter ( size_t  len,
float *  buffer 
)
private

Definition at line 1438 of file Equalization.cpp.

1439{
1440 float re,im;
1441 // Apply FFT
1442 RealFFTf(buffer, hFFT.get());
1443 //FFT(len, false, inr, NULL, outr, outi);
1444
1445 // Apply filter
1446 // DC component is purely real
1447 mFFTBuffer[0] = buffer[0] * mFilterFuncR[0];
1448 for(size_t i = 1; i < (len / 2); i++)
1449 {
1450 re=buffer[hFFT->BitReversed[i] ];
1451 im=buffer[hFFT->BitReversed[i]+1];
1452 mFFTBuffer[2*i ] = re*mFilterFuncR[i] - im*mFilterFuncI[i];
1453 mFFTBuffer[2*i+1] = re*mFilterFuncI[i] + im*mFilterFuncR[i];
1454 }
1455 // Fs/2 component is purely real
1456 mFFTBuffer[1] = buffer[1] * mFilterFuncR[len/2];
1457
1458 // Inverse FFT and normalization
1459 InverseRealFFTf(mFFTBuffer.get(), hFFT.get());
1460 ReorderToTime(hFFT.get(), mFFTBuffer.get(), buffer);
1461}
void RealFFTf(fft_type *buffer, const FFTParam *h)
Definition: RealFFTf.cpp:162
void InverseRealFFTf(fft_type *buffer, const FFTParam *h)
Definition: RealFFTf.cpp:264
void ReorderToTime(const FFTParam *hFFT, const fft_type *buffer, fft_type *TimeOut)
Definition: RealFFTf.cpp:361

References hFFT, InverseRealFFTf(), mFFTBuffer, mFilterFuncI, mFilterFuncR, RealFFTf(), and ReorderToTime().

Referenced by ProcessOne().

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

◆ Flatten()

void EffectEqualization::Flatten ( )
private

Definition at line 2033 of file Equalization.cpp.

2034{
2035 mLogEnvelope->Flatten(0.);
2036 mLogEnvelope->SetTrackLen(1.0);
2037 mLinEnvelope->Flatten(0.);
2038 mLinEnvelope->SetTrackLen(1.0);
2039 ForceRecalc();
2040 if( !mDrawMode )
2041 {
2042 for( size_t i = 0; i < mBandsInUse; i++)
2043 {
2044 mSliders[i]->SetValue(0);
2045 mSlidersOld[i] = 0;
2046 mEQVals[i] = 0.;
2047
2048 wxString tip;
2049 if( kThirdOct[i] < 1000.)
2050 tip.Printf( wxT("%dHz\n%.1fdB"), (int)kThirdOct[i], 0. );
2051 else
2052 tip.Printf( wxT("%gkHz\n%.1fdB"), kThirdOct[i]/1000., 0. );
2053 mSliders[i]->SetToolTip(tip);
2054 }
2055 }
2057}
static const double kThirdOct[]
int mSlidersOld[NUMBER_OF_BANDS]
Definition: Equalization.h:237
wxSlider * mSliders[NUMBER_OF_BANDS]
Definition: Equalization.h:278

References EnvelopeUpdated(), ForceRecalc(), kThirdOct, mBandsInUse, mDrawMode, mEQVals, mLinEnvelope, mLogEnvelope, mSliders, and mSlidersOld.

Referenced by OnClear().

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

◆ ForceRecalc()

void EffectEqualization::ForceRecalc ( )
private

Definition at line 1952 of file Equalization.cpp.

1953{
1954 if (mPanel)
1955 {
1957 }
1958}

References EqualizationPanel::ForceRecalc(), and mPanel.

Referenced by Flatten(), GraphicEQ(), OnInvert(), OnLinFreq(), OnSliderM(), PopulateOrExchange(), setCurve(), and UpdateDraw().

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

◆ GetDefaultFileName()

bool EffectEqualization::GetDefaultFileName ( wxFileName &  fileName)
private

Definition at line 1682 of file Equalization.cpp.

1683{
1684 // look in data dir first, in case the user has their own defaults (maybe downloaded ones)
1685 fileName = wxFileName( FileNames::DataDir(), wxT("EQDefaultCurves.xml") );
1686 if( !fileName.FileExists() )
1687 { // Default file not found in the data dir. Fall back to Resources dir.
1688 // See http://docs.wxwidgets.org/trunk/classwx_standard_paths.html#5514bf6288ee9f5a0acaf065762ad95d
1689 fileName = wxFileName( FileNames::ResourcesDir(), wxT("EQDefaultCurves.xml") );
1690 }
1691 if( !fileName.FileExists() )
1692 {
1693 // LLL: Is there really a need for an error message at all???
1694 //auto errorMessage = XO("EQCurves.xml and EQDefaultCurves.xml were not found on your system.\nPlease press 'help' to visit the download page.\n\nSave the curves at %s")
1695 // .Format( FileNames::DataDir() );
1696 //BasicUI::ShowErrorDialog( wxWidgetsWindowPlacement{ mUIParent },
1697 // XO("EQCurves.xml and EQDefaultCurves.xml missing"),
1698 // errorMessage, wxT("http://wiki.audacityteam.org/wiki/EQCurvesDownload"), false);
1699
1700 // Have another go at finding EQCurves.xml in the data dir, in case 'help' helped
1701 fileName = wxFileName( FileNames::DataDir(), wxT("EQDefaultCurves.xml") );
1702 }
1703 return (fileName.FileExists());
1704}
FILES_API FilePath ResourcesDir()
FILES_API FilePath DataDir()
Audacity user data directory.

References FileNames::DataDir(), and FileNames::ResourcesDir().

Referenced by LoadCurves().

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

◆ GetDescription()

TranslatableString EffectEqualization::GetDescription ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 355 of file Equalization.cpp.

356{
357 return XO("Adjusts the volume levels of particular frequencies");
358}
#define XO(s)
Definition: Internat.h:31

References XO.

◆ GetFactoryPresets()

RegistryPaths EffectEqualization::GetFactoryPresets ( ) const
overridevirtual

Report names of factory presets.

Reimplemented from Effect.

Definition at line 474 of file Equalization.cpp.

475{
477
478 for (size_t i = 0; i < WXSIZEOF(FactoryPresets); i++)
479 {
480 if ((mOptions == kEqOptionGraphic) && (FactoryPresets[i].bForBoth == false))
481 continue;
482 names.push_back(FactoryPresets[i].name.Translation());
483 }
484
485 return names;
486}
const TranslatableString name
static const struct @25 FactoryPresets[]
std::vector< RegistryPath > RegistryPaths
Definition: Identifier.h:219
static TranslatableStrings names
Definition: TagsEditor.cpp:151
wxString Translation() const

References FactoryPresets, kEqOptionGraphic, mOptions, name, names, and TranslatableString::Translation().

Here is the call graph for this function:

◆ GetPrefsPrefix()

wxString EffectEqualization::GetPrefsPrefix ( )
private

Definition at line 571 of file Equalization.cpp.

572{
573 wxString base = wxT("/Effects/Equalization/");
575 base = wxT("/Effects/GraphicEq/");
576 else if( mOptions == kEqOptionCurve )
577 base = wxT("/Effects/FilterCurve/");
578 return base;
579}

References kEqOptionCurve, kEqOptionGraphic, and mOptions.

Referenced by LoadCurves(), and UpdateDefaultCurves().

Here is the caller graph for this function:

◆ GetSymbol()

ComponentInterfaceSymbol EffectEqualization::GetSymbol ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 346 of file Equalization.cpp.

347{
350 if( mOptions == kEqOptionCurve )
353}
static const ComponentInterfaceSymbol Symbol
Definition: Equalization.h:323
static const ComponentInterfaceSymbol Symbol
Definition: Equalization.h:331
static const ComponentInterfaceSymbol Symbol
Definition: Equalization.h:103

References kEqOptionCurve, kEqOptionGraphic, mOptions, Symbol, EffectEqualizationCurve::Symbol, and EffectEqualizationGraphic::Symbol.

◆ GetType()

EffectType EffectEqualization::GetType ( ) const
overridevirtual

Type determines how it behaves.

Reimplemented from Effect.

Definition at line 372 of file Equalization.cpp.

373{
374 return EffectTypeProcess;
375}
@ EffectTypeProcess

References EffectTypeProcess.

◆ GraphicEQ()

void EffectEqualization::GraphicEQ ( Envelope env)
private

Definition at line 2505 of file Equalization.cpp.

2506{
2507 // JKC: 'value' is for height of curve.
2508 // The 0.0 initial value would only get used if NUM_PTS were 0.
2509 double value = 0.0;
2510 double dist, span, s;
2511
2512 env->Flatten(0.);
2513 env->SetTrackLen(1.0);
2514
2515 switch( mInterp )
2516 {
2517 case kBspline: // B-spline
2518 {
2519 int minF = 0;
2520 for(size_t i = 0; i < NUM_PTS; i++)
2521 {
2522 while( (mWhenSliders[minF] <= mWhens[i]) & (minF < (int)mBandsInUse) )
2523 minF++;
2524 minF--;
2525 if( minF < 0 ) //before first slider
2526 {
2527 dist = mWhens[i] - mWhenSliders[0];
2528 span = mWhenSliders[1] - mWhenSliders[0];
2529 s = dist/span;
2530 if( s < -1.5 )
2531 value = 0.;
2532 else if( s < -.5 )
2533 value = mEQVals[0]*(s + 1.5)*(s + 1.5)/2.;
2534 else
2535 value = mEQVals[0]*(.75 - s*s) + mEQVals[1]*(s + .5)*(s + .5)/2.;
2536 }
2537 else
2538 {
2539 if( mWhens[i] > mWhenSliders[mBandsInUse-1] ) //after last fader
2540 {
2541 dist = mWhens[i] - mWhenSliders[mBandsInUse-1];
2543 s = dist/span;
2544 if( s > 1.5 )
2545 value = 0.;
2546 else if( s > .5 )
2547 value = mEQVals[mBandsInUse-1]*(s - 1.5)*(s - 1.5)/2.;
2548 else
2549 value = mEQVals[mBandsInUse-1]*(.75 - s*s) +
2550 mEQVals[mBandsInUse-2]*(s - .5)*(s - .5)/2.;
2551 }
2552 else //normal case
2553 {
2554 dist = mWhens[i] - mWhenSliders[minF];
2555 span = mWhenSliders[minF+1] - mWhenSliders[minF];
2556 s = dist/span;
2557 if(s < .5 )
2558 {
2559 value = mEQVals[minF]*(0.75 - s*s);
2560 if( minF+1 < (int)mBandsInUse )
2561 value += mEQVals[minF+1]*(s+.5)*(s+.5)/2.;
2562 if( minF-1 >= 0 )
2563 value += mEQVals[minF-1]*(s-.5)*(s-.5)/2.;
2564 }
2565 else
2566 {
2567 value = mEQVals[minF]*(s-1.5)*(s-1.5)/2.;
2568 if( minF+1 < (int)mBandsInUse )
2569 value += mEQVals[minF+1]*(.75-(1.-s)*(1.-s));
2570 if( minF+2 < (int)mBandsInUse )
2571 value += mEQVals[minF+2]*(s-.5)*(s-.5)/2.;
2572 }
2573 }
2574 }
2575 if(mWhens[i]<=0.)
2576 env->Reassign(0., value);
2577 env->Insert( mWhens[i], value );
2578 }
2579 env->Reassign( 1., value );
2580 break;
2581 }
2582
2583 case kCosine: // Cosine squared
2584 {
2585 int minF = 0;
2586 for(size_t i = 0; i < NUM_PTS; i++)
2587 {
2588 while( (mWhenSliders[minF] <= mWhens[i]) & (minF < (int)mBandsInUse) )
2589 minF++;
2590 minF--;
2591 if( minF < 0 ) //before first slider
2592 {
2593 dist = mWhenSliders[0] - mWhens[i];
2594 span = mWhenSliders[1] - mWhenSliders[0];
2595 if( dist < span )
2596 value = mEQVals[0]*(1. + cos(M_PI*dist/span))/2.;
2597 else
2598 value = 0.;
2599 }
2600 else
2601 {
2602 if( mWhens[i] > mWhenSliders[mBandsInUse-1] ) //after last fader
2603 {
2605 dist = mWhens[i] - mWhenSliders[mBandsInUse-1];
2606 if( dist < span )
2607 value = mEQVals[mBandsInUse-1]*(1. + cos(M_PI*dist/span))/2.;
2608 else
2609 value = 0.;
2610 }
2611 else //normal case
2612 {
2613 span = mWhenSliders[minF+1] - mWhenSliders[minF];
2614 dist = mWhenSliders[minF+1] - mWhens[i];
2615 value = mEQVals[minF]*(1. + cos(M_PI*(span-dist)/span))/2. +
2616 mEQVals[minF+1]*(1. + cos(M_PI*dist/span))/2.;
2617 }
2618 }
2619 if(mWhens[i]<=0.)
2620 env->Reassign(0., value);
2621 env->Insert( mWhens[i], value );
2622 }
2623 env->Reassign( 1., value );
2624 break;
2625 }
2626
2627 case kCubic: // Cubic Spline
2628 {
2629 double y2[NUMBER_OF_BANDS+1];
2632 for(double xf=0; xf<1.; xf+=1./NUM_PTS)
2633 {
2634 env->Insert(xf, splint(mWhenSliders, mEQVals, mBandsInUse+1, y2, xf));
2635 }
2636 break;
2637 }
2638 }
2639
2640 ForceRecalc();
2641}
#define NUMBER_OF_BANDS
Definition: Equalization.h:14
double splint(double x[], double y[], size_t n, double y2[], double xr)
void spline(double x[], double y[], size_t n, double y2[])
double mWhenSliders[NUMBER_OF_BANDS+1]
Definition: Equalization.h:227
void SetTrackLen(double trackLen, double sampleDur=0.0)
Definition: Envelope.cpp:787
int Reassign(double when, double value)
Move a point at when to value.
Definition: Envelope.cpp:669
void Insert(int point, const EnvPoint &p)
insert a point
Definition: Envelope.cpp:361
void Flatten(double value)
Definition: Envelope.cpp:132

References Envelope::Flatten(), ForceRecalc(), Envelope::Insert(), kBspline, kCosine, kCubic, M_PI, mBandsInUse, mEQVals, mInterp, mWhens, mWhenSliders, NUM_PTS, NUMBER_OF_BANDS, Envelope::Reassign(), Envelope::SetTrackLen(), spline(), and splint().

Referenced by ErrMin(), OnInterp(), OnInvert(), OnSlider(), and UpdateGraphic().

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

◆ HandleXMLChild()

XMLTagHandler * EffectEqualization::HandleXMLChild ( const std::string_view &  tag)
overrideprivatevirtual

Implements XMLTagHandler.

Definition at line 2156 of file Equalization.cpp.

2157{
2158 if (tag == "equalizationeffect")
2159 {
2160 return this;
2161 }
2162
2163 if (tag == "curve")
2164 {
2165 return this;
2166 }
2167
2168 if (tag == "point")
2169 {
2170 return this;
2171 }
2172
2173 return NULL;
2174}

◆ HandleXMLTag()

bool EffectEqualization::HandleXMLTag ( const std::string_view &  tag,
const AttributesList attrs 
)
overrideprivatevirtual

Implements XMLTagHandler.

Definition at line 2062 of file Equalization.cpp.

2063{
2064 // May want to add a version strings...
2065 if (tag == "equalizationeffect")
2066 {
2067 return true;
2068 }
2069
2070 // Located a NEW curve
2071 if (tag == "curve")
2072 {
2073 // Process the attributes
2074 for (auto pair : attrs)
2075 {
2076 auto attr = pair.first;
2077 auto value = pair.second;
2078
2079 // Create a NEW curve and name it
2080 if( attr == "name" )
2081 {
2082 const wxString strValue = value.ToWString();
2083 // check for a duplicate name and add (n) if there is one
2084 int n = 0;
2085 wxString strValueTemp = strValue;
2086 bool exists;
2087 do
2088 {
2089 exists = false;
2090 for(size_t i = 0; i < mCurves.size(); i++)
2091 {
2092 if(n>0)
2093 strValueTemp.Printf(wxT("%s (%d)"),strValue,n);
2094 if(mCurves[i].Name == strValueTemp)
2095 {
2096 exists = true;
2097 break;
2098 }
2099 }
2100 n++;
2101 }
2102 while(exists == true);
2103
2104 mCurves.push_back( EQCurve( strValueTemp ) );
2105 }
2106 }
2107
2108 // Tell caller it was processed
2109 return true;
2110 }
2111
2112 // Located a NEW point
2113 if(tag == "point")
2114 {
2115 // Set defaults in case attributes are missing
2116 double f = 0.0;
2117 double d = 0.0;
2118
2119 // Process the attributes
2120 double dblValue;
2121 for (auto pair : attrs)
2122 {
2123 auto attr = pair.first;
2124 auto value = pair.second;
2125
2126 // Get the frequency
2127 if( attr == "f" )
2128 {
2129 if (!value.TryGet(dblValue))
2130 return false;
2131 f = dblValue;
2132 }
2133 // Get the dB
2134 else if( attr == "d" )
2135 {
2136 if (!value.TryGet(dblValue))
2137 return false;
2138 d = dblValue;
2139 }
2140 }
2141
2142 // Create a NEW point
2143 mCurves[ mCurves.size() - 1 ].points.push_back( EQPoint( f, d ) );
2144
2145 // Tell caller it was processed
2146 return true;
2147 }
2148
2149 // Tell caller we didn't understand the tag
2150 return false;
2151}
EQCurve is used with EffectEqualization.
Definition: Equalization.h:77

References mCurves.

◆ Init()

bool EffectEqualization::Init ( )
overridevirtual

Call once to set up state for whole list of tracks to be processed.

Returns
success Default implementation does nothing, returns true Default implementation does nothing, returns true

Reimplemented from StatefulEffectBase.

Definition at line 581 of file Equalization.cpp.

582{
583 int selcount = 0;
584 double rate = 0.0;
585
586 auto trackRange =
588 if (trackRange) {
589 rate = (*(trackRange.first++)) -> GetRate();
590 ++selcount;
591
592 for (auto track : trackRange) {
593 if (track->GetRate() != rate) {
595 XO(
596"To apply Equalization, all selected tracks must have the same sample rate.") );
597 return(false);
598 }
599 ++selcount;
600 }
601 }
602
603 mHiFreq = rate / 2.0;
604 // Unlikely, but better than crashing.
605 if (mHiFreq <= loFreqI) {
607 XO("Track sample rate is too low for this effect."),
608 wxOK | wxCENTRE,
609 XO("Effect Unavailable") );
610 return(false);
611 }
612
614
615 mBandsInUse = 0;
616 while (kThirdOct[mBandsInUse] <= mHiFreq) {
617 mBandsInUse++;
619 break;
620 }
621
623
625
626 CalcFilter();
627
628 return(true);
629}
const AudacityProject * FindProject() const
Definition: EffectBase.cpp:315
Envelope * mEnvelope
Definition: Equalization.h:243
int MessageBox(const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={}) const
Definition: Effect.cpp:871
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:486
auto Selected() -> TrackIterRange< TrackType >
Definition: Track.h:1452
A Track that contains audio waveform data.
Definition: WaveTrack.h:57

References CalcFilter(), EffectBase::FindProject(), TrackList::Get(), anonymous_namespace{TimeTrack.cpp}::GetRate(), kThirdOct, loFreqI, mBandsInUse, mCurveName, mEnvelope, Effect::MessageBox(), mHiFreq, mLin, mLinEnvelope, mLoFreq, mLogEnvelope, NUMBER_OF_BANDS, TrackList::Selected(), setCurve(), and XO.

Here is the call graph for this function:

◆ IsLinear()

bool EffectEqualization::IsLinear ( )
private

Definition at line 2025 of file Equalization.cpp.

2026{
2027 return mDrawMode && mLin;
2028}

References mDrawMode, and mLin.

Referenced by CalcFilter(), EnvelopeUpdated(), OnInvert(), OnLinFreq(), and EqualizationPanel::OnPaint().

Here is the caller graph for this function:

◆ LoadCurves()

void EffectEqualization::LoadCurves ( const wxString &  fileName = {},
bool  append = false 
)
private

Definition at line 1466 of file Equalization.cpp.

1467{
1468// We've disabled the XML management of curves.
1469// Just going via .cfg files now.
1470#if 1
1471 (void)fileName;
1472 (void)append;
1473 mCurves.clear();
1474 mCurves.push_back( wxT("unnamed") ); // we still need a default curve to use
1475#else
1476 // Construct normal curve filename
1477 //
1478 // LLL: Wouldn't you know that as of WX 2.6.2, there is a conflict
1479 // between wxStandardPaths and wxConfig under Linux. The latter
1480 // creates a normal file as "$HOME/.audacity", while the former
1481 // expects the ".audacity" portion to be a directory.
1482 // MJS: I don't know what the above means, or if I have broken it.
1483 wxFileName fn;
1484
1485 if(fileName.empty()) {
1486 // Check if presets are up to date.
1487 wxString eqCurvesCurrentVersion = wxString::Format(wxT("%d.%d"), EQCURVES_VERSION, EQCURVES_REVISION);
1488 wxString eqCurvesInstalledVersion;
1489 gPrefs->Read(GetPrefsPrefix() + "PresetVersion", &eqCurvesInstalledVersion, wxT(""));
1490
1491 bool needUpdate = (eqCurvesCurrentVersion != eqCurvesInstalledVersion);
1492
1493 // UpdateDefaultCurves allows us to import NEW factory presets only,
1494 // or update all factory preset curves.
1495 if (needUpdate)
1497 fn = wxFileName( FileNames::DataDir(), wxT("EQCurves.xml") );
1498 }
1499 else
1500 fn = fileName; // user is loading a specific set of curves
1501
1502 // If requested file doesn't exist...
1503 if( !fn.FileExists() && !GetDefaultFileName(fn) ) {
1504 mCurves.clear();
1505 /* i18n-hint: name of the 'unnamed' custom curve */
1506 mCurves.push_back( _("unnamed") ); // we still need a default curve to use
1507 return;
1508 }
1509
1510 EQCurve tempCustom(wxT("temp"));
1511 if( append == false ) // Start from scratch
1512 mCurves.clear();
1513 else // appending so copy and remove 'unnamed', to replace later
1514 {
1515 tempCustom.points = mCurves.back().points;
1516 mCurves.pop_back();
1517 }
1518
1519 // Load the curves
1520 XMLFileReader reader;
1521 const wxString fullPath{ fn.GetFullPath() };
1522 if( !reader.Parse( this, fullPath ) )
1523 {
1524 /* i18n-hint: EQ stands for 'Equalization'.*/
1525 auto msg = XO("Error Loading EQ Curves from file:\n%s\nError message says:\n%s")
1526 .Format( fullPath, reader.GetErrorStr() );
1527 // Inform user of load failure
1529 msg,
1530 wxOK | wxCENTRE,
1531 XO("Error Loading EQ Curves") );
1532 mCurves.push_back( _("unnamed") ); // we always need a default curve to use
1533 return;
1534 }
1535
1536 // Move "unnamed" to end, if it exists in current language.
1537 int numCurves = mCurves.size();
1538 int curve;
1539 EQCurve tempUnnamed(wxT("tempUnnamed"));
1540 for( curve = 0; curve < numCurves-1; curve++ )
1541 {
1542 if( mCurves[curve].Name == _("unnamed") )
1543 {
1544 tempUnnamed.points = mCurves[curve].points;
1545 mCurves.erase(mCurves.begin() + curve);
1546 mCurves.push_back( _("unnamed") ); // add 'unnamed' back at the end
1547 mCurves.back().points = tempUnnamed.points;
1548 }
1549 }
1550
1551 if( mCurves.back().Name != _("unnamed") )
1552 mCurves.push_back( _("unnamed") ); // we always need a default curve to use
1553 if( append == true )
1554 {
1555 mCurves.back().points = tempCustom.points;
1556 }
1557#endif
1558 return;
1559}
#define EQCURVES_REVISION
#define UPDATE_ALL
#define EQCURVES_VERSION
#define _(s)
Definition: Internat.h:75
FileConfig * gPrefs
Definition: Prefs.cpp:71
static const auto fn
bool GetDefaultFileName(wxFileName &fileName)
wxString GetPrefsPrefix()
void UpdateDefaultCurves(bool updateAll=false)
Reads a file and passes the results through an XMLTagHandler.
Definition: XMLFileReader.h:19
const TranslatableString & GetErrorStr() const
bool Parse(XMLTagHandler *baseHandler, const FilePath &fname)

References _, FileNames::DataDir(), EQCURVES_REVISION, EQCURVES_VERSION, fn, GetDefaultFileName(), XMLFileReader::GetErrorStr(), GetPrefsPrefix(), gPrefs, mCurves, Effect::MessageBox(), XMLFileReader::Parse(), EQCurve::points, UPDATE_ALL, UpdateDefaultCurves(), and XO.

Referenced by EditCurvesDialog::OnDefaults(), EditCurvesDialog::OnImport(), and EditCurvesDialog::OnOK().

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

◆ LoadFactoryDefaults()

bool EffectEqualization::LoadFactoryDefaults ( EffectSettings settings) const
overridevirtual

Change settings back to "factory default".

Reimplemented from Effect.

Definition at line 425 of file Equalization.cpp.

426{
427 // To do: externalize state so const_cast isn't needed
428 return const_cast<EffectEqualization&>(*this).DoLoadFactoryDefaults(settings);
429}
An Effect that modifies volume in different frequency bands.
Definition: Equalization.h:99
bool DoLoadFactoryDefaults(EffectSettings &settings)

References DoLoadFactoryDefaults(), and settings().

Here is the call graph for this function:

◆ LoadFactoryPreset()

bool EffectEqualization::LoadFactoryPreset ( int  id,
EffectSettings settings 
) const
overridevirtual

Change settings to the preset whose name is GetFactoryPresets()[id]

Reimplemented from Effect.

Definition at line 488 of file Equalization.cpp.

489{
490 int index = -1;
491 for (size_t i = 0; i < WXSIZEOF(FactoryPresets); i++)
492 {
493 if ((mOptions == kEqOptionGraphic) && (FactoryPresets[i].bForBoth == false))
494 continue;
495 if (id-- == 0) {
496 index = i;
497 break;
498 }
499 }
500 if (index < 0)
501 return false;
502
503 // mParams =
504 wxString params = FactoryPresets[index].values;
505
508 S.SetForWriting( &eap );
509 // To do: externalize state so const_cast isn't needed
510 const_cast<EffectEqualization*>(this)->VisitSettings(S, settings);
511 return true;
512}
EffectDistortion::Params params
Definition: Distortion.cpp:83
#define S(N)
Definition: ToChars.cpp:64
CommandParameters, derived from wxFileConfig, is essentially doing the same things as the SettingsVis...
bool VisitSettings(SettingsVisitor &visitor, EffectSettings &settings) override
SettingsVisitor that sets parameters to a value (from a string)

References FactoryPresets, kEqOptionGraphic, mOptions, params, S, settings(), and VisitSettings().

Here is the call graph for this function:

◆ ManualPage()

ManualPageID EffectEqualization::ManualPage ( ) const
overridevirtual

Name of a page in the Audacity alpha manual, default is empty.

Reimplemented from EffectDefinitionInterface.

Definition at line 360 of file Equalization.cpp.

361{
362 // Bug 2509: Must use _ and not space in names.
364 return L"Graphic_EQ";
365 if( mOptions == kEqOptionCurve )
366 return L"Filter_Curve_EQ";
367 return L"Equalization";
368}

References kEqOptionCurve, kEqOptionGraphic, and mOptions.

◆ OnClear()

void EffectEqualization::OnClear ( wxCommandEvent &  event)
private

Definition at line 2826 of file Equalization.cpp.

2827{
2828 Flatten();
2829}

References Flatten().

Here is the call graph for this function:

◆ OnCurve()

void EffectEqualization::OnCurve ( wxCommandEvent &  event)
private

Definition at line 2802 of file Equalization.cpp.

2803{
2804 // Select NEW curve
2805 wxASSERT( mCurve != NULL );
2806 setCurve( mCurve->GetCurrentSelection() );
2807 if( !mDrawMode )
2808 UpdateGraphic();
2809}
void UpdateGraphic(void)

References mCurve, mDrawMode, setCurve(), and UpdateGraphic().

Here is the call graph for this function:

◆ OnDrawMode()

void EffectEqualization::OnDrawMode ( wxCommandEvent &  event)
private

Definition at line 2745 of file Equalization.cpp.

2746{
2747 mDrawMode = true;
2748 UpdateDraw();
2749}

References mDrawMode, and UpdateDraw().

Here is the call graph for this function:

◆ OnErase()

void EffectEqualization::OnErase ( wxEvent &  event)
private

Definition at line 2686 of file Equalization.cpp.

2687{
2688}

Referenced by PopulateOrExchange().

Here is the caller graph for this function:

◆ OnGraphicMode()

void EffectEqualization::OnGraphicMode ( wxCommandEvent &  event)
private

Definition at line 2751 of file Equalization.cpp.

2752{
2753 mDrawMode = false;
2754 UpdateGraphic();
2755}

References mDrawMode, and UpdateGraphic().

Here is the call graph for this function:

◆ OnGridOnOff()

void EffectEqualization::OnGridOnOff ( wxCommandEvent &  event)
private

Definition at line 2899 of file Equalization.cpp.

2900{
2901 mDrawGrid = mGridOnOff->IsChecked();
2902 mPanel->Refresh(false);
2903}
wxCheckBox * mGridOnOff
Definition: Equalization.h:270

References mDrawGrid, mGridOnOff, and mPanel.

◆ OnInterp()

void EffectEqualization::OnInterp ( wxCommandEvent &  event)
private

Definition at line 2734 of file Equalization.cpp.

2735{
2736 bool bIsGraphic = !mDrawMode;
2737 if (bIsGraphic)
2738 {
2739 GraphicEQ(mLogEnvelope.get());
2741 }
2742 mInterp = mInterpChoice->GetSelection();
2743}
wxChoice * mInterpChoice
Definition: Equalization.h:271

References EnvelopeUpdated(), GraphicEQ(), mDrawMode, mInterp, mInterpChoice, and mLogEnvelope.

Here is the call graph for this function:

◆ OnInvert()

void EffectEqualization::OnInvert ( wxCommandEvent &  event)
private

Definition at line 2831 of file Equalization.cpp.

2832{
2833 if(!mDrawMode) // Graphic (Slider) mode. Invert the sliders.
2834 {
2835 for (size_t i = 0; i < mBandsInUse; i++)
2836 {
2837 mEQVals[i] = -mEQVals[i];
2838 int newPosn = (int)mEQVals[i];
2839 mSliders[i]->SetValue( newPosn );
2840 mSlidersOld[i] = newPosn;
2841
2842 wxString tip;
2843 if( kThirdOct[i] < 1000.)
2844 tip.Printf( wxT("%dHz\n%.1fdB"), (int)kThirdOct[i], mEQVals[i] );
2845 else
2846 tip.Printf( wxT("%gkHz\n%.1fdB"), kThirdOct[i]/1000., mEQVals[i] );
2847 mSliders[i]->SetToolTip(tip);
2848 }
2849 GraphicEQ(mLogEnvelope.get());
2850 }
2851 else // Draw mode. Invert the points.
2852 {
2853 bool lin = IsLinear(); // refers to the 'log' or 'lin' of the frequency scale, not the amplitude
2854 size_t numPoints; // number of points in the curve/envelope
2855
2856 // determine if log or lin curve is the current one
2857 // and find out how many points are in the curve
2858 if(lin) // lin freq scale and so envelope
2859 {
2860 numPoints = mLinEnvelope->GetNumberOfPoints();
2861 }
2862 else
2863 {
2864 numPoints = mLogEnvelope->GetNumberOfPoints();
2865 }
2866
2867 if( numPoints == 0 )
2868 return;
2869
2870 Doubles when{ numPoints };
2871 Doubles value{ numPoints };
2872
2873 if(lin)
2874 mLinEnvelope->GetPoints( when.get(), value.get(), numPoints );
2875 else
2876 mLogEnvelope->GetPoints( when.get(), value.get(), numPoints );
2877
2878 // invert the curve
2879 for (size_t i = 0; i < numPoints; i++)
2880 {
2881 if(lin)
2882 mLinEnvelope->Reassign(when[i] , -value[i]);
2883 else
2884 mLogEnvelope->Reassign(when[i] , -value[i]);
2885 }
2886
2887 // copy it back to the other one (just in case)
2888 if(lin)
2889 EnvLinToLog();
2890 else
2891 EnvLogToLin();
2892 }
2893
2894 // and update the display etc
2895 ForceRecalc();
2897}

References EnvelopeUpdated(), EnvLinToLog(), EnvLogToLin(), ForceRecalc(), GraphicEQ(), IsLinear(), kThirdOct, mBandsInUse, mDrawMode, mEQVals, mLinEnvelope, mLogEnvelope, mSliders, and mSlidersOld.

Here is the call graph for this function:

◆ OnLinFreq()

void EffectEqualization::OnLinFreq ( wxCommandEvent &  event)
private

Definition at line 2905 of file Equalization.cpp.

2906{
2907 mLin = mLinFreq->IsChecked();
2908 if(IsLinear()) //going from log to lin freq scale
2909 {
2910 mFreqRuler->ruler.SetLog(false);
2912 EnvLogToLin();
2913 mEnvelope = mLinEnvelope.get();
2914 mLin = true;
2915 }
2916 else //going from lin to log freq scale
2917 {
2918 mFreqRuler->ruler.SetLog(true);
2920 EnvLinToLog();
2921 mEnvelope = mLogEnvelope.get();
2922 mLin = false;
2923 }
2924 mFreqRuler->Refresh(false);
2925 ForceRecalc();
2926}
wxCheckBox * mLinFreq
Definition: Equalization.h:269
RulerPanel * mFreqRuler
Definition: Equalization.h:230
void SetLog(bool log)
Definition: Ruler.cpp:142
void SetRange(double min, double max)
Definition: Ruler.cpp:188
Ruler ruler
Definition: Ruler.h:288

References EnvLinToLog(), EnvLogToLin(), ForceRecalc(), IsLinear(), mEnvelope, mFreqRuler, mHiFreq, mLin, mLinEnvelope, mLinFreq, mLoFreq, mLogEnvelope, RulerPanel::ruler, Ruler::SetLog(), and Ruler::SetRange().

Referenced by TransferDataToWindow().

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

◆ OnManage()

void EffectEqualization::OnManage ( wxCommandEvent &  event)
private

Definition at line 2814 of file Equalization.cpp.

2815{
2816 EditCurvesDialog d(mUIParent, this, mCurve->GetSelection());
2817 d.ShowModal();
2818
2819 // Reload the curve names
2820 UpdateCurves();
2821
2822 // Allow control to resize
2823 mUIParent->Layout();
2824}
wxWindow * mUIParent
Definition: Effect.h:270

References mCurve, Effect::mUIParent, and UpdateCurves().

Here is the call graph for this function:

◆ OnSize()

void EffectEqualization::OnSize ( wxSizeEvent &  event)
private

Definition at line 2690 of file Equalization.cpp.

2691{
2692 mUIParent->Layout();
2693 event.Skip();
2694}

References Effect::mUIParent.

◆ OnSlider()

void EffectEqualization::OnSlider ( wxCommandEvent &  event)
private

Definition at line 2696 of file Equalization.cpp.

2697{
2698 wxSlider *s = (wxSlider *)event.GetEventObject();
2699 for (size_t i = 0; i < mBandsInUse; i++)
2700 {
2701 if( s == mSliders[i])
2702 {
2703 int posn = mSliders[i]->GetValue();
2704 if( wxGetKeyState(WXK_SHIFT) )
2705 {
2706 if( posn > mSlidersOld[i] )
2707 mEQVals[i] += (float).1;
2708 else
2709 if( posn < mSlidersOld[i] )
2710 mEQVals[i] -= .1f;
2711 }
2712 else
2713 mEQVals[i] += (posn - mSlidersOld[i]);
2714 if( mEQVals[i] > 20. )
2715 mEQVals[i] = 20.;
2716 if( mEQVals[i] < -20. )
2717 mEQVals[i] = -20.;
2718 int newPosn = (int)mEQVals[i];
2719 mSliders[i]->SetValue( newPosn );
2720 mSlidersOld[i] = newPosn;
2721 wxString tip;
2722 if( kThirdOct[i] < 1000.)
2723 tip.Printf( wxT("%dHz\n%.1fdB"), (int)kThirdOct[i], mEQVals[i] );
2724 else
2725 tip.Printf( wxT("%gkHz\n%.1fdB"), kThirdOct[i]/1000., mEQVals[i] );
2726 s->SetToolTip(tip);
2727 break;
2728 }
2729 }
2730 GraphicEQ(mLogEnvelope.get());
2732}

References EnvelopeUpdated(), GraphicEQ(), kThirdOct, mBandsInUse, mEQVals, mLogEnvelope, mSliders, and mSlidersOld.

Here is the call graph for this function:

◆ OnSliderDBMAX()

void EffectEqualization::OnSliderDBMAX ( wxCommandEvent &  event)
private

Definition at line 2787 of file Equalization.cpp.

2788{
2789 float dB = mdBMaxSlider->GetValue();
2790 if (dB != mdBMax) {
2791 mdBMax = dB;
2792 wxString tip;
2793 tip.Printf(_("%d dB"), (int)mdBMax);
2794 mdBMaxSlider->SetToolTip(tip);
2795 UpdateRuler();
2796 }
2797}
wxSlider * mdBMaxSlider
Definition: Equalization.h:277

References _, mdBMax, mdBMaxSlider, and UpdateRuler().

Here is the call graph for this function:

◆ OnSliderDBMIN()

void EffectEqualization::OnSliderDBMIN ( wxCommandEvent &  event)
private

Definition at line 2775 of file Equalization.cpp.

2776{
2777 float dB = mdBMinSlider->GetValue();
2778 if (dB != mdBMin) {
2779 mdBMin = dB;
2780 wxString tip;
2781 tip.Printf(_("%d dB"), (int)mdBMin);
2782 mdBMinSlider->SetToolTip(tip);
2783 UpdateRuler();
2784 }
2785}
wxSlider * mdBMinSlider
Definition: Equalization.h:276

References _, mdBMin, mdBMinSlider, and UpdateRuler().

Here is the call graph for this function:

◆ OnSliderM()

void EffectEqualization::OnSliderM ( wxCommandEvent &  event)
private

Definition at line 2757 of file Equalization.cpp.

2758{
2759 size_t m = 2 * mMSlider->GetValue() + 1;
2760 // Must be odd
2761 wxASSERT( (m & 1) == 1 );
2762
2763 if (m != mM) {
2764 mM = m;
2765 wxString tip;
2766 tip.Printf(wxT("%d"), (int)mM);
2767 mMText->SetLabel(tip);
2768 mMText->SetName(mMText->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
2769 mMSlider->SetToolTip(tip);
2770
2771 ForceRecalc();
2772 }
2773}
wxStaticText * mMText
Definition: Equalization.h:274
wxSlider * mMSlider
Definition: Equalization.h:275

References ForceRecalc(), mM, mMSlider, and mMText.

Here is the call graph for this function:

◆ Parameters()

const EffectParameterMethods & EffectEqualization::Parameters ( ) const
overrideprivatevirtual

Reimplemented from Effect.

Definition at line 172 of file Equalization.cpp.

173{
176 // CurveName,
177 InterpLin,
178 // Pretty sure the interpolation name shouldn't have been interpreted when
179 // specified in chains, but must keep it that way for compatibility.
181 > parameters {
183 bool updating){
184 if (updating) {
185 if (effect.mInterp >= nInterpolations)
186 effect.mInterp -= nInterpolations;
187 effect.mEnvelope =
188 (effect.mLin ? effect.mLinEnvelope : effect.mLogEnvelope).get();
189 }
190 return true;
191 }
192 };
193 return parameters;
194}
Generates EffectParameterMethods overrides from variadic template arguments.
static constexpr EffectParameter InterpLin
Definition: Equalization.h:306
EffectEqualization(int Options=kEqLegacy)
static constexpr EffectParameter FilterLength
Definition: Equalization.h:302
static constexpr EnumParameter InterpMeth
Definition: Equalization.h:308
Externalized state of a plug-in.

References EffectEqualization(), FilterLength, InterpLin, InterpMeth, and nInterpolations.

Here is the call graph for this function:

◆ PopulateOrExchange()

std::unique_ptr< EffectUIValidator > EffectEqualization::PopulateOrExchange ( ShuttleGui S,
EffectInstance instance,
EffectSettingsAccess access 
)
overridevirtual

Add controls to effect panel; always succeeds.

Returns
if not null, then return it from Effect::PopulateUI instead of a DefaultEffectUIValidator; default implementation returns null

Reimplemented from Effect.

Definition at line 681 of file Equalization.cpp.

683{
684 if ( (S.GetMode() == eIsCreating ) && !IsBatchProcessing() )
687 });
688
689 //LoadCurves();
690
691
692
693 S.SetBorder(0);
694
695 S.SetSizerProportion(1);
696 S.Prop(1).StartMultiColumn(1, wxEXPAND);
697 {
698 S.SetStretchyCol(0);
699 //S.SetStretchyRow(0); // The 5px Top border
700 S.SetStretchyRow(1); // The Graph
701 S.SetStretchyRow(2); // The EQ sliders
702 szrV = S.GetSizer();
703
704 // -------------------------------------------------------------------
705 // ROW 0: Top border
706 // -------------------------------------------------------------------
707 S.AddSpace(5);
708
709 // -------------------------------------------------------------------
710 // ROW 1: Equalization panel and sliders for vertical scale
711 // -------------------------------------------------------------------
712 S.SetSizerProportion(1);
713 S.Prop(1).StartMultiColumn(3, wxEXPAND);
714 {
715 S.SetStretchyCol(1);
716 S.SetStretchyRow(0);
717 szr1 = S.GetSizer();
718
719 S.StartVerticalLay(wxEXPAND, 1);
720 {
722 S.GetParent(), wxID_ANY, wxVERTICAL,
723 wxSize{ 100, 100 }, // Ruler can't handle small sizes
724 RulerPanel::Range{ 60.0, -120.0 },
726 XO("dB"),
728 .LabelEdges(true)
729 .TicksAtExtremes(true)
730 .TickColour( { 0, 0, 0 } )
731 );
732
733 S.Prop(0).AddSpace(0, 1);
734 S.Prop(1)
735 .Position(wxEXPAND)
736 .AddWindow(mdBRuler);
737 S.AddSpace(0, 1);
738 }
739 S.EndVerticalLay();
740
741 mPanel = safenew EqualizationPanel(S.GetParent(), wxID_ANY, this);
742 S.Prop(1)
743 .Position(wxEXPAND)
744 .MinSize( { wxDefaultCoord, wxDefaultCoord } )
745 .AddWindow(mPanel);
746
747 S.SetBorder(5);
748 S.StartVerticalLay();
749 {
750 S.AddVariableText(XO("+ dB"), false, wxCENTER);
752 .Name(XO("Max dB"))
753 .Style(wxSL_VERTICAL | wxSL_INVERSE)
754 .AddSlider( {}, 30, 60, 0);
755#if wxUSE_ACCESSIBILITY
756 mdBMaxSlider->SetAccessible(safenew SliderAx(mdBMaxSlider, XO("%d dB")));
757#endif
758
760 .Name(XO("Min dB"))
761 .Style(wxSL_VERTICAL | wxSL_INVERSE)
762 .AddSlider( {}, -30, -10, -120);
763 S.AddVariableText(XO("- dB"), false, wxCENTER);
764#if wxUSE_ACCESSIBILITY
765 mdBMinSlider->SetAccessible(safenew SliderAx(mdBMinSlider, XO("%d dB")));
766#endif
767 }
768 S.EndVerticalLay();
769 S.SetBorder(0);
770
771 // -------------------------------------------------------------------
772 // Frequency ruler below graph
773 // -------------------------------------------------------------------
774
775 // Column 1 is empty
776 S.AddSpace(1, 1);
777
779 S.GetParent(), wxID_ANY, wxHORIZONTAL,
780 wxSize{ 100, 100 }, // Ruler can't handle small sizes
781 RulerPanel::Range{ mLoFreq, mHiFreq },
783 XO("Hz"),
785 .Log(true)
786 .Flip(true)
787 .LabelEdges(true)
788 .TicksAtExtremes(true)
789 .TickColour( { 0, 0, 0 } )
790 );
791
792 S.SetBorder(1);
793 S.Prop(1)
794 .Position(wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP | wxLEFT)
795 .AddWindow(mFreqRuler);
796 S.SetBorder(0);
797
798 // Column 3 is empty
799 S.AddSpace(1, 1);
800 }
801 S.EndMultiColumn();
802
803 // -------------------------------------------------------------------
804 // ROW 2: Graphic EQ
805 // -------------------------------------------------------------------
806 S.SetSizerProportion(1);
807 S.StartHorizontalLay(wxEXPAND, 1);
808 {
809 szrG = S.GetSizer();
810
811 // Panel used to host the sliders since they will be positioned manually.
812 //mGraphicPanel = S.Prop(1)
813 //.Position(wxEXPAND)
814 //.Size( { -1, 150 } )
815 //.StartPanel();
816 wxWindow *pParent = S.GetParent();
817 S.AddSpace(15,0);
818 {
819
820 // for (int i = 0; (i < NUMBER_OF_BANDS) && (kThirdOct[i] <= mHiFreq); ++i)
821 // May show more sliders than needed. Fixes Bug 2269
822 for (int i = 0; i < NUMBER_OF_BANDS; ++i)
823 {
824 TranslatableString freq = kThirdOct[i] < 1000.
825 ? XO("%d Hz").Format((int)kThirdOct[i])
826 : XO("%g kHz").Format(kThirdOct[i] / 1000.);
827 TranslatableString fNum = kThirdOct[i] < 1000.
828 ? Verbatim("%d").Format((int)kThirdOct[i])
829 /* i18n-hint k is SI abbreviation for x1,000. Usually unchanged in translation. */
830 : XO("%gk").Format(kThirdOct[i] / 1000.);
831 S.StartVerticalLay();
832 {
833 S.AddFixedText( fNum );
834 mSliders[i] = safenew wxSliderWrapper(pParent, ID_Slider + i, 0, -20, +20,
835 wxDefaultPosition, wxSize(-1,50), wxSL_VERTICAL | wxSL_INVERSE);
836
837#if wxUSE_ACCESSIBILITY
838 mSliders[i]->SetAccessible(safenew SliderAx(mSliders[i], XO("%d dB")));
839#endif
840
841 mSlidersOld[i] = 0;
842 mEQVals[i] = 0.;
843 S.Prop(1)
844 .Name(freq)
845 .ConnectRoot(
846 wxEVT_ERASE_BACKGROUND, &EffectEqualization::OnErase)
847 .Position(wxEXPAND)
848 .Size({ -1, 50 })
849 .AddWindow(mSliders[i]);
850 }
851 S.EndVerticalLay();
852 }
853 S.AddSpace(15,0);
854
855 } //S.EndPanel();
856 }
857 S.EndHorizontalLay();
858
859 // -------------------------------------------------------------------
860 // ROW 4: Various controls
861 // -------------------------------------------------------------------
862 S.SetSizerProportion(1);
863 S.Prop(1).StartMultiColumn(7, wxALIGN_CENTER_HORIZONTAL);
864 {
865 S.SetBorder(5);
866
867 S.AddSpace(5, 5);
868
869 if( mOptions == kEqLegacy )
870 {
871 S.StartHorizontalLay(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
872 {
873 S.AddPrompt(XXO("&EQ Type:"));
874 }
875 S.EndHorizontalLay();
876
877 S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 1);
878 {
879 S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 1);
880 {
881 mDraw = S.Id(ID_Draw)
882 .Name(XO("Draw Curves"))
883 .AddRadioButton(XXO("&Draw"));
884
885 mGraphic = S.Id(ID_Graphic)
886 .Name(XO("Graphic EQ"))
887 .AddRadioButtonToGroup(XXO("&Graphic"));
888 }
889 S.EndHorizontalLay();
890 }
891 S.EndHorizontalLay();
892 }
893
894 S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 0);
895 {
896 szrH = S.GetSizer();
897
898 S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 1);
899 {
900 szrI = S.GetSizer();
901
903 .Name(XO("Interpolation type"))
904 .AddChoice( {},
906#if wxUSE_ACCESSIBILITY
907 // so that name can be set on a standard control
909#endif
910 }
911 S.EndHorizontalLay();
912
913 S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 1);
914 {
915 szrL = S.GetSizer();
916
917 mLinFreq = S.Id(ID_Linear)
918 .Name(XO("Linear Frequency Scale"))
919 .AddCheckBox(XXO("Li&near Frequency Scale"), false);
920 }
921 S.EndHorizontalLay();
922 }
923 S.EndHorizontalLay();
924
925 // -------------------------------------------------------------------
926 // Filter length grouping
927 // -------------------------------------------------------------------
928
929 if( mOptions == kEqLegacy ){
930 S.StartHorizontalLay(wxEXPAND, 0);
931 {
932 S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 0);
933 {
934 S.AddPrompt(XXO("Length of &Filter:"));
935 }
936 S.EndHorizontalLay();
937
938 S.StartHorizontalLay(wxEXPAND, 1);
939 {
940 mMSlider = S.Id(ID_Length)
941 .Name(XO("Length of Filter"))
942 .Style(wxSL_HORIZONTAL)
943 .AddSlider( {}, (mM - 1) / 2, 4095, 10);
944 }
945 S.EndHorizontalLay();
946
947 S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 0);
948 {
949 wxString label;
950 label.Printf(wxT("%ld"), mM);
951 mMText = S.Name( Verbatim( label ) )
952 // fix for bug 577 (NVDA/Narrator screen readers do not
953 // read static text in dialogs)
954 .AddVariableText( Verbatim( label ) );
955 }
956 S.EndHorizontalLay();
957 }
958 S.EndHorizontalLay();
959
960 S.AddSpace(1, 1);
961 }
962
963 S.AddSpace(5, 5);
964
965 if( mOptions == kEqLegacy ){
966 S.AddSpace(5, 5);
967 S.StartHorizontalLay(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
968 {
969 S.AddPrompt(XXO("&Select Curve:"));
970 }
971 S.EndHorizontalLay();
972
973 S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 1);
974 {
975 S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 1);
976 {
977 mCurve = S.Id(ID_Curve)
978 .Name(XO("Select Curve"))
979 .AddChoice( {},
980 [this]{
981 TranslatableStrings curves;
982 for (const auto &curve : mCurves)
983 curves.push_back( Verbatim( curve.Name ) );
984 return curves;
985 }()
986 );
987 }
988 S.EndHorizontalLay();
989 }
990 S.EndHorizontalLay();
991
992 S.Id(ID_Manage).AddButton(XXO("S&ave/Manage Curves..."));
993 }
994
995 S.StartHorizontalLay(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 1);
996 {
997 S.Id(ID_Clear).AddButton(XXO("Fla&tten"));
998 S.Id(ID_Invert).AddButton(XXO("&Invert"));
999
1000 mGridOnOff = S.Id(ID_Grid)
1001 .Name(XO("Show grid lines"))
1002 .AddCheckBox(XXO("Show g&rid lines"), false);
1003 }
1004 S.EndHorizontalLay();
1005
1006 S.AddSpace(5, 5);
1007 }
1008 S.EndMultiColumn();
1009 }
1010 S.EndMultiColumn();
1011
1012#ifdef EXPERIMENTAL_EQ_SSE_THREADED
1013 if (mEffectEqualization48x)
1014 {
1015 // -------------------------------------------------------------------
1016 // ROW 6: Processing routine selection
1017 // -------------------------------------------------------------------
1018
1019 // Column 1 is blank
1020 S.AddSpace(1, 1);
1021
1022 S.StartHorizontalLay();
1023 {
1024 S.AddUnits(XO("&Processing: "));
1025
1026 // update the control state
1027 int mathPath = EffectEqualization48x::GetMathPath();
1028 int value =
1029 (mathPath & MATH_FUNCTION_SSE)
1030 ? (mathPath & MATH_FUNCTION_THREADED)
1031 ? 2
1032 : 1
1033 : false // (mathPath & MATH_FUNCTION_AVX) // not implemented
1034 ? (mathPath & MATH_FUNCTION_THREADED)
1035 ? 4
1036 : 3
1037 : 0;
1038
1039 mMathProcessingType[0] = S.Id(ID_DefaultMath)
1040 .AddRadioButton(XXO("D&efault"),
1041 0, value);
1042 mMathProcessingType[1] = S.Id(ID_SSE)
1043 .Disable(!EffectEqualization48x::GetMathCaps()->SSE)
1044 .AddRadioButtonToGroup(XXO("&SSE"),
1045 1, value);
1046 mMathProcessingType[2] = S.Id(ID_SSEThreaded)
1047 .Disable(!EffectEqualization48x::GetMathCaps()->SSE)
1048 .AddRadioButtonToGroup(XXO("SSE &Threaded"),
1049 2, value);
1050 mMathProcessingType[3] = S.Id(ID_AVX)
1051 // not implemented
1052 .Disable(true /* !EffectEqualization48x::GetMathCaps()->AVX */)
1053 .AddRadioButtonToGroup(XXO("A&VX"),
1054 3, value);
1055 mMathProcessingType[4] = S.Id(ID_AVXThreaded)
1056 // not implemented
1057 .Disable(true /* !EffectEqualization48x::GetMathCaps()->AVX */)
1058 .AddRadioButtonToGroup(XXO("AV&X Threaded"),
1059 4, value);
1060 S.Id(ID_Bench).AddButton(XXO("&Bench"));
1061 }
1062 S.EndHorizontalLay();
1063
1064 // Column 3 is blank
1065 S.AddSpace(1, 1);
1066 }
1067#endif
1068
1069 mUIParent->SetAutoLayout(false);
1071 mUIParent->Layout();
1072
1073 if( mOptions == kEqOptionCurve)
1074 mDrawMode = true;
1076 mDrawMode = false;
1077
1078 // "show" settings for graphics mode before setting the size of the dialog
1079 // as this needs more space than draw mode
1080 szrV->Show(szrG,!mDrawMode); // eq sliders
1081 szrH->Show(szrI,true); // interpolation choice
1082 szrH->Show(szrL,false); // linear freq checkbox
1083
1084 if( mOptions == kEqOptionGraphic){
1085 mPanel->Show( false );
1086 wxSize sz = szrV->GetMinSize();
1087 sz += wxSize( 30, 0);
1088 mUIParent->SetMinSize(sz);
1089 }
1090 else{
1091 mPanel->Show( true );
1092 szrV->Show(szr1, true);
1093 // This sizing calculation is hacky.
1094 // Rather than set the true minimum size we set a size we would
1095 // like to have.
1096 // This makes the default size of the dialog good, but has the
1097 // downside that the user can't adjust the dialog smaller.
1098 wxSize sz = szrV->GetMinSize();
1099 sz += wxSize( 400, 100);
1100 szrV->SetMinSize(sz);
1101 }
1102 ForceRecalc();
1103
1104 return nullptr;
1105}
const RegistryPath & CurrentSettingsGroup()
Component of a configuration key path, for last-used destructive settings.
@ ID_Curve
@ ID_Graphic
@ ID_dBMax
@ ID_Invert
@ ID_Interp
@ ID_Grid
@ ID_Length
@ ID_Linear
@ ID_Slider
@ ID_Manage
@ ID_Clear
@ ID_Draw
@ ID_dBMin
const int kEqLegacy
Definition: Equalization.h:30
#define XXO(s)
Definition: Internat.h:44
#define safenew
Definition: MemoryX.h:10
TranslatableStrings Msgids(const EnumValueSymbol strings[], size_t nStrings)
Convenience function often useful when adding choice controls.
@ eIsCreating
Definition: ShuttleGui.h:39
TranslatableString label
Definition: TagsEditor.cpp:163
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
std::vector< TranslatableString > TranslatableStrings
friend class EqualizationPanel
Definition: Equalization.h:289
wxRadioButton * mDraw
Definition: Equalization.h:267
void OnErase(wxEvent &event)
RulerPanel * mdBRuler
Definition: Equalization.h:229
wxRadioButton * mGraphic
Definition: Equalization.h:268
static const EnumValueSymbol kInterpStrings[nInterpolations]
Definition: Equalization.h:299
bool IsBatchProcessing() const override
Definition: Effect.cpp:562
bool LoadUserPreset(const RegistryPath &name, EffectSettings &settings) const override
Change settings to a user-named preset.
Definition: Effect.cpp:245
void ModifySettings(Function &&function)
Do a correct read-modify-write of settings.
@ LinearDBFormat
Definition: Ruler.h:34
@ IntFormat
Definition: Ruler.h:30
RulerPanel class allows you to work with a Ruler like any other wxWindow.
Definition: Ruler.h:228
std::pair< double, double > Range
Definition: Ruler.h:232
Holds a msgid for the translation catalog; may also bind format arguments.
TranslatableString & Format(Args &&...args) &
Capture variadic format arguments (by copy) when there is no plural.
An alternative to using wxWindowAccessible, which in wxWidgets 3.1.1 contained GetParent() which was ...
Options & LabelEdges(bool l)
Definition: Ruler.h:250
Options & Log(bool l)
Definition: Ruler.h:244

References CurrentSettingsGroup(), eIsCreating, EqualizationPanel, ForceRecalc(), TranslatableString::Format(), ID_Clear, ID_Curve, ID_dBMax, ID_dBMin, ID_Draw, ID_Graphic, ID_Grid, ID_Interp, ID_Invert, ID_Length, ID_Linear, ID_Manage, ID_Slider, Ruler::IntFormat, Effect::IsBatchProcessing(), kEqLegacy, kEqOptionCurve, kEqOptionGraphic, kInterpStrings, kThirdOct, label, RulerPanel::Options::LabelEdges(), Ruler::LinearDBFormat, Effect::LoadUserPreset(), RulerPanel::Options::Log(), mCurve, mCurves, mdBMaxSlider, mdBMinSlider, mdBRuler, mDraw, mDrawMode, mEQVals, mFreqRuler, mGraphic, mGridOnOff, mInterpChoice, mLinFreq, mM, mMSlider, mMText, EffectSettingsAccess::ModifySettings(), mOptions, mPanel, Msgids(), mSliders, mSlidersOld, Effect::mUIParent, nInterpolations, NUMBER_OF_BANDS, OnErase(), S, safenew, settings(), szr1, szrG, szrH, szrI, szrL, szrV, Verbatim(), XO, and XXO.

Here is the call graph for this function:

◆ Process()

bool EffectEqualization::Process ( EffectInstance instance,
EffectSettings settings 
)
overridevirtual

Actually do the effect here.

Returns
success

Implements StatefulEffectBase.

Definition at line 631 of file Equalization.cpp.

632{
633#ifdef EXPERIMENTAL_EQ_SSE_THREADED
634 if(mEffectEqualization48x) {
635 if(mBench) {
636 mBench=false;
637 return mEffectEqualization48x->Benchmark(this);
638 }
639 else
640 return mEffectEqualization48x->Process(this);
641 }
642#endif
643 this->CopyInputTracks(); // Set up mOutputTracks.
644 CalcFilter();
645 bool bGoodResult = true;
646
647 int count = 0;
648 for( auto track : mOutputTracks->Selected< WaveTrack >() ) {
649 double trackStart = track->GetStartTime();
650 double trackEnd = track->GetEndTime();
651 double t0 = mT0 < trackStart? trackStart: mT0;
652 double t1 = mT1 > trackEnd? trackEnd: mT1;
653
654 if (t1 > t0) {
655 auto start = track->TimeToLongSamples(t0);
656 auto end = track->TimeToLongSamples(t1);
657 auto len = end - start;
658
659 if (!ProcessOne(count, track, start, len))
660 {
661 bGoodResult = false;
662 break;
663 }
664 }
665
666 count++;
667 }
668
669 this->ReplaceProcessedTracks(bGoodResult);
670 return bGoodResult;
671}
double mT1
Definition: EffectBase.h:107
std::shared_ptr< TrackList > mOutputTracks
Definition: EffectBase.h:105
double mT0
Definition: EffectBase.h:106
void ReplaceProcessedTracks(const bool bGoodResult)
Definition: EffectBase.cpp:236
bool ProcessOne(int count, WaveTrack *t, sampleCount start, sampleCount len)
void CopyInputTracks(bool allSyncLockSelected=false)
Definition: Effect.cpp:741
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:159

References CalcFilter(), Effect::CopyInputTracks(), PackedArray::end(), EffectBase::mOutputTracks, EffectBase::mT0, EffectBase::mT1, ProcessOne(), and EffectBase::ReplaceProcessedTracks().

Here is the call graph for this function:

◆ ProcessOne()

bool EffectEqualization::ProcessOne ( int  count,
WaveTrack t,
sampleCount  start,
sampleCount  len 
)
private

Definition at line 1176 of file Equalization.cpp.

1178{
1179 // create a NEW WaveTrack to hold all of the output, including 'tails' each end
1180 auto output = t->EmptyCopy();
1182
1183 wxASSERT(mM - 1 < windowSize);
1184 size_t L = windowSize - (mM - 1); //Process L samples at a go
1185 auto s = start;
1186 auto idealBlockLen = t->GetMaxBlockSize() * 4;
1187 if (idealBlockLen % L != 0)
1188 idealBlockLen += (L - (idealBlockLen % L));
1189
1190 Floats buffer{ idealBlockLen };
1191
1192 Floats window1{ windowSize };
1193 Floats window2{ windowSize };
1194 float *thisWindow = window1.get();
1195 float *lastWindow = window2.get();
1196
1197 auto originalLen = len;
1198
1199 for(size_t i = 0; i < windowSize; i++)
1200 lastWindow[i] = 0;
1201
1202 TrackProgress(count, 0.);
1203 bool bLoopSuccess = true;
1204 size_t wcopy = 0;
1205 int offset = (mM - 1) / 2;
1206
1207 while (len != 0)
1208 {
1209 auto block = limitSampleBufferSize( idealBlockLen, len );
1210
1211 t->GetFloats(buffer.get(), s, block);
1212
1213 for(size_t i = 0; i < block; i += L) //go through block in lumps of length L
1214 {
1215 wcopy = std::min <size_t> (L, block - i);
1216 for(size_t j = 0; j < wcopy; j++)
1217 thisWindow[j] = buffer[i+j]; //copy the L (or remaining) samples
1218 for(auto j = wcopy; j < windowSize; j++)
1219 thisWindow[j] = 0; //this includes the padding
1220
1221 Filter(windowSize, thisWindow);
1222
1223 // Overlap - Add
1224 for(size_t j = 0; (j < mM - 1) && (j < wcopy); j++)
1225 buffer[i+j] = thisWindow[j] + lastWindow[L + j];
1226 for(size_t j = mM - 1; j < wcopy; j++)
1227 buffer[i+j] = thisWindow[j];
1228
1229 std::swap( thisWindow, lastWindow );
1230 } //next i, lump of this block
1231
1232 output->Append((samplePtr)buffer.get(), floatSample, block);
1233 len -= block;
1234 s += block;
1235
1236 if (TrackProgress(count, ( s - start ).as_double() /
1237 originalLen.as_double()))
1238 {
1239 bLoopSuccess = false;
1240 break;
1241 }
1242 }
1243
1244 if(bLoopSuccess)
1245 {
1246 // mM-1 samples of 'tail' left in lastWindow, get them now
1247 if(wcopy < (mM - 1)) {
1248 // Still have some overlap left to process
1249 // (note that lastWindow and thisWindow have been exchanged at this point
1250 // so that 'thisWindow' is really the window prior to 'lastWindow')
1251 size_t j = 0;
1252 for(; j < mM - 1 - wcopy; j++)
1253 buffer[j] = lastWindow[wcopy + j] + thisWindow[L + wcopy + j];
1254 // And fill in the remainder after the overlap
1255 for( ; j < mM - 1; j++)
1256 buffer[j] = lastWindow[wcopy + j];
1257 } else {
1258 for(size_t j = 0; j < mM - 1; j++)
1259 buffer[j] = lastWindow[wcopy + j];
1260 }
1261 output->Append((samplePtr)buffer.get(), floatSample, mM - 1);
1262 output->Flush();
1263
1264 // now move the appropriate bit of the output back to the track
1265 // (this could be enhanced in the future to use the tails)
1266 double offsetT0 = t->LongSamplesToTime(offset);
1267 double lenT = t->LongSamplesToTime(originalLen);
1268 // 'start' is the sample offset in 't', the passed in track
1269 // 'startT' is the equivalent time value
1270 // 'output' starts at zero
1271 double startT = t->LongSamplesToTime(start);
1272
1273 //output has one waveclip for the total length, even though
1274 //t might have whitespace separating multiple clips
1275 //we want to maintain the original clip structure, so
1276 //only paste the intersections of the NEW clip.
1277
1278 //Find the bits of clips that need replacing
1279 std::vector<std::pair<double, double> > clipStartEndTimes;
1280 std::vector<std::pair<double, double> > clipRealStartEndTimes; //the above may be truncated due to a clip being partially selected
1281 for (const auto &clip : t->GetClips())
1282 {
1283 double clipStartT;
1284 double clipEndT;
1285
1286 clipStartT = clip->GetPlayStartTime();
1287 clipEndT = clip->GetPlayEndTime();
1288 if( clipEndT <= startT )
1289 continue; // clip is not within selection
1290 if( clipStartT >= startT + lenT )
1291 continue; // clip is not within selection
1292
1293 //save the actual clip start/end so that we can rejoin them after we paste.
1294 clipRealStartEndTimes.push_back(std::pair<double,double>(clipStartT,clipEndT));
1295
1296 if( clipStartT < startT ) // does selection cover the whole clip?
1297 clipStartT = startT; // don't copy all the NEW clip
1298 if( clipEndT > startT + lenT ) // does selection cover the whole clip?
1299 clipEndT = startT + lenT; // don't copy all the NEW clip
1300
1301 //save them
1302 clipStartEndTimes.push_back(std::pair<double,double>(clipStartT,clipEndT));
1303 }
1304 //now go thru and replace the old clips with NEW
1305 for(unsigned int i = 0; i < clipStartEndTimes.size(); i++)
1306 {
1307 //remove the old audio and get the NEW
1308 t->Clear(clipStartEndTimes[i].first,clipStartEndTimes[i].second);
1309 auto toClipOutput = output->Copy(clipStartEndTimes[i].first-startT+offsetT0,clipStartEndTimes[i].second-startT+offsetT0);
1310 //put the processed audio in
1311 t->Paste(clipStartEndTimes[i].first, toClipOutput.get());
1312 //if the clip was only partially selected, the Paste will have created a split line. Join is needed to take care of this
1313 //This is not true when the selection is fully contained within one clip (second half of conditional)
1314 if( (clipRealStartEndTimes[i].first != clipStartEndTimes[i].first ||
1315 clipRealStartEndTimes[i].second != clipStartEndTimes[i].second) &&
1316 !(clipRealStartEndTimes[i].first <= startT &&
1317 clipRealStartEndTimes[i].second >= startT+lenT) )
1318 t->Join(clipRealStartEndTimes[i].first,clipRealStartEndTimes[i].second);
1319 }
1320 }
1321
1322 return bLoopSuccess;
1323}
size_t limitSampleBufferSize(size_t bufferSize, sampleCount limit)
Definition: SampleCount.cpp:23
@ floatSample
Definition: SampleFormat.h:34
char * samplePtr
Definition: SampleFormat.h:49
static const size_t windowSize
Definition: Equalization.h:149
void Filter(size_t len, float *buffer)
bool TrackProgress(int whichTrack, double frac, const TranslatableString &={}) const
Definition: Effect.cpp:693
bool GetFloats(float *buffer, sampleCount start, size_t len, fillFormat fill=fillZero, bool mayThrow=true, sampleCount *pNumWithinClips=nullptr) const
Retrieve samples from a track in floating-point format, regardless of the storage format.
Definition: SampleTrack.h:67
double LongSamplesToTime(sampleCount pos) const
Convert correctly between a number of samples and an (absolute) time in seconds.
Definition: SampleTrack.cpp:47
void Paste(double t0, const Track *src) override
Definition: WaveTrack.cpp:1563
void ConvertToSampleFormat(sampleFormat format, const std::function< void(size_t)> &progressReport={})
Definition: WaveTrack.cpp:596
size_t GetMaxBlockSize() const override
This returns a nonnegative number of samples meant to size a memory buffer.
Definition: WaveTrack.cpp:1806
void Join(double t0, double t1)
Definition: WaveTrack.cpp:1708
void Clear(double t0, double t1) override
Definition: WaveTrack.cpp:788
WaveClipHolders & GetClips()
Definition: WaveTrack.h:329
Holder EmptyCopy(const SampleBlockFactoryPtr &pFactory={}, bool keepLink=true) const
Definition: WaveTrack.cpp:705
void swap(std::unique_ptr< Alg_seq > &a, std::unique_ptr< Alg_seq > &b)
Definition: NoteTrack.cpp:753

References WaveTrack::Clear(), WaveTrack::ConvertToSampleFormat(), WaveTrack::EmptyCopy(), Filter(), floatSample, WaveTrack::GetClips(), SampleTrack::GetFloats(), WaveTrack::GetMaxBlockSize(), WaveTrack::Join(), limitSampleBufferSize(), SampleTrack::LongSamplesToTime(), mM, WaveTrack::Paste(), anonymous_namespace{NoteTrack.cpp}::swap(), Effect::TrackProgress(), and windowSize.

Referenced by Process().

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

◆ SaveCurves()

void EffectEqualization::SaveCurves ( const wxString &  fileName = {})
private

Definition at line 1710 of file Equalization.cpp.

1711{
1712 wxFileName fn;
1713 if( fileName.empty() )
1714 {
1715 // Construct default curve filename
1716 //
1717 // LLL: Wouldn't you know that as of WX 2.6.2, there is a conflict
1718 // between wxStandardPaths and wxConfig under Linux. The latter
1719 // creates a normal file as "$HOME/.audacity", while the former
1720 // expects the ".audacity" portion to be a directory.
1721 fn = wxFileName( FileNames::DataDir(), wxT("EQCurves.xml") );
1722
1723 // If the directory doesn't exist...
1724 if( !fn.DirExists() )
1725 {
1726 // Attempt to create it
1727 if( !fn.Mkdir( fn.GetPath(), 511, wxPATH_MKDIR_FULL ) )
1728 {
1729 // MkDir() will emit message
1730 return;
1731 }
1732 }
1733 }
1734 else
1735 fn = fileName;
1736
1737 GuardedCall( [&] {
1738 // Create/Open the file
1739 const wxString fullPath{ fn.GetFullPath() };
1740 XMLFileWriter eqFile{ fullPath, XO("Error Saving Equalization Curves") };
1741
1742 // Write the curves
1743 WriteXML( eqFile );
1744
1745 eqFile.Commit();
1746 } );
1747}
R GuardedCall(const F1 &body, const F2 &handler=F2::Default(), F3 delayedHandler=DefaultDelayedHandlerAction) noexcept(noexcept(handler(std::declval< AudacityException * >())) &&noexcept(handler(nullptr)) &&noexcept(std::function< void(AudacityException *)>{std::move(delayedHandler)}))
Execute some code on any thread; catch any AudacityException; enqueue error report on the main thread...
void WriteXML(XMLWriter &xmlFile) const
Wrapper to output XML data to files.
Definition: XMLWriter.h:84

References FileNames::DataDir(), fn, GuardedCall(), WriteXML(), and XO.

Referenced by EditCurvesDialog::OnExport(), EditCurvesDialog::OnOK(), UpdateDefaultCurves(), and ValidateUI().

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

◆ Select()

void EffectEqualization::Select ( int  sel)
private

Definition at line 1939 of file Equalization.cpp.

1940{
1941 // Set current choice
1942 if (mCurve)
1943 {
1944 mCurve->SetSelection( curve );
1945 mCurveName = mCurves[ curve ].Name;
1946 }
1947}

References mCurve, mCurveName, and mCurves.

Referenced by EnvelopeUpdated(), ErrMin(), setCurve(), and ValidateUI().

Here is the caller graph for this function:

◆ setCurve() [1/3]

void EffectEqualization::setCurve ( const wxString &  curveName)
private

Definition at line 1918 of file Equalization.cpp.

1919{
1920 unsigned i = 0;
1921 for( i = 0; i < mCurves.size(); i++ )
1922 if( curveName == mCurves[ i ].Name )
1923 break;
1924 if( i == mCurves.size())
1925 {
1927 XO("Requested curve not found, using 'unnamed'"),
1928 wxOK|wxICON_ERROR,
1929 XO("Curve not found") );
1930 setCurve();
1931 }
1932 else
1933 setCurve( i );
1934}

References mCurves, Effect::MessageBox(), setCurve(), and XO.

Here is the call graph for this function:

◆ setCurve() [2/3]

void EffectEqualization::setCurve ( int  currentCurve)
private

Definition at line 1752 of file Equalization.cpp.

1753{
1754 // Set current choice
1755 wxASSERT( currentCurve < (int) mCurves.size() );
1756 Select(currentCurve);
1757
1758 Envelope *env;
1759 int numPoints = (int) mCurves[currentCurve].points.size();
1760
1761 if (mLin) { // linear freq mode
1762 env = mLinEnvelope.get();
1763 }
1764 else { // log freq mode
1765 env = mLogEnvelope.get();
1766 }
1767 env->Flatten(0.);
1768 env->SetTrackLen(1.0);
1769
1770 // Handle special case of no points.
1771 if (numPoints == 0) {
1772 ForceRecalc();
1773 return;
1774 }
1775
1776 double when, value;
1777
1778 // Handle special case 1 point.
1779 if (numPoints == 1) {
1780 // only one point, so ensure it is in range then return.
1781 when = mCurves[currentCurve].points[0].Freq;
1782 if (mLin) {
1783 when = when / mHiFreq;
1784 }
1785 else { // log scale
1786 // We don't go below loFreqI (20 Hz) in log view.
1787 double loLog = log10((double)loFreqI);
1788 double hiLog = log10(mHiFreq);
1789 double denom = hiLog - loLog;
1790 when = (log10(std::max((double) loFreqI, when)) - loLog)/denom;
1791 }
1792 value = mCurves[currentCurve].points[0].dB;
1793 env->Insert(std::min(1.0, std::max(0.0, when)), value);
1794 ForceRecalc();
1795 return;
1796 }
1797
1798 // We have at least two points, so ensure they are in frequency order.
1799 std::sort(mCurves[currentCurve].points.begin(),
1800 mCurves[currentCurve].points.end());
1801
1802 if (mCurves[currentCurve].points[0].Freq < 0) {
1803 // Corrupt or invalid curve, so bail.
1804 ForceRecalc();
1805 return;
1806 }
1807
1808 if(mLin) { // linear Hz scale
1809 for(int pointCount = 0; pointCount < numPoints; pointCount++) {
1810 when = mCurves[currentCurve].points[pointCount].Freq / mHiFreq;
1811 value = mCurves[currentCurve].points[pointCount].dB;
1812 if(when <= 1) {
1813 env->Insert(when, value);
1814 if (when == 1)
1815 break;
1816 }
1817 else {
1818 // There are more points at higher freqs,
1819 // so interpolate next one then stop.
1820 when = 1.0;
1821 double nextDB = mCurves[currentCurve].points[pointCount].dB;
1822 if (pointCount > 0) {
1823 double nextF = mCurves[currentCurve].points[pointCount].Freq;
1824 double lastF = mCurves[currentCurve].points[pointCount-1].Freq;
1825 double lastDB = mCurves[currentCurve].points[pointCount-1].dB;
1826 value = lastDB +
1827 ((nextDB - lastDB) *
1828 ((mHiFreq - lastF) / (nextF - lastF)));
1829 }
1830 else
1831 value = nextDB;
1832 env->Insert(when, value);
1833 break;
1834 }
1835 }
1836 }
1837 else { // log Hz scale
1838 double loLog = log10((double) loFreqI);
1839 double hiLog = log10(mHiFreq);
1840 double denom = hiLog - loLog;
1841 int firstAbove20Hz;
1842
1843 // log scale EQ starts at 20 Hz (threshold of hearing).
1844 // so find the first point (if any) above 20 Hz.
1845 for (firstAbove20Hz = 0; firstAbove20Hz < numPoints; firstAbove20Hz++) {
1846 if (mCurves[currentCurve].points[firstAbove20Hz].Freq > loFreqI)
1847 break;
1848 }
1849
1850 if (firstAbove20Hz == numPoints) {
1851 // All points below 20 Hz, so just use final point.
1852 when = 0.0;
1853 value = mCurves[currentCurve].points[numPoints-1].dB;
1854 env->Insert(when, value);
1855 ForceRecalc();
1856 return;
1857 }
1858
1859 if (firstAbove20Hz > 0) {
1860 // At least one point is before 20 Hz and there are more
1861 // beyond 20 Hz, so interpolate the first
1862 double prevF = mCurves[currentCurve].points[firstAbove20Hz-1].Freq;
1863 prevF = log10(std::max(1.0, prevF)); // log zero is bad.
1864 double prevDB = mCurves[currentCurve].points[firstAbove20Hz-1].dB;
1865 double nextF = log10(mCurves[currentCurve].points[firstAbove20Hz].Freq);
1866 double nextDB = mCurves[currentCurve].points[firstAbove20Hz].dB;
1867 when = 0.0;
1868 value = nextDB - ((nextDB - prevDB) * ((nextF - loLog) / (nextF - prevF)));
1869 env->Insert(when, value);
1870 }
1871
1872 // Now get the rest.
1873 for(int pointCount = firstAbove20Hz; pointCount < numPoints; pointCount++)
1874 {
1875 double flog = log10(mCurves[currentCurve].points[pointCount].Freq);
1876 wxASSERT(mCurves[currentCurve].points[pointCount].Freq >= loFreqI);
1877
1878 when = (flog - loLog)/denom;
1879 value = mCurves[currentCurve].points[pointCount].dB;
1880 if(when <= 1.0) {
1881 env->Insert(when, value);
1882 }
1883 else {
1884 // This looks weird when adjusting curve in Draw mode if
1885 // there is a point off-screen.
1886
1887 /*
1888 // we have a point beyond fs/2. Insert it so that env code can use it.
1889 // but just this one, we have no use for the rest
1890 env->SetTrackLen(when); // can't Insert if the envelope isn't long enough
1891 env->Insert(when, value);
1892 break;
1893 */
1894
1895 // interpolate the final point instead
1896 when = 1.0;
1897 if (pointCount > 0) {
1898 double lastDB = mCurves[currentCurve].points[pointCount-1].dB;
1899 double logLastF =
1900 log10(mCurves[currentCurve].points[pointCount-1].Freq);
1901 value = lastDB +
1902 ((value - lastDB) *
1903 ((log10(mHiFreq) - logLastF) / (flog - logLastF)));
1904 }
1905 env->Insert(when, value);
1906 break;
1907 }
1908 }
1909 }
1910 ForceRecalc();
1911}
int min(int a, int b)

References Envelope::Flatten(), ForceRecalc(), Envelope::Insert(), loFreqI, mCurves, mHiFreq, min(), mLin, mLinEnvelope, mLogEnvelope, Select(), and Envelope::SetTrackLen().

Referenced by EditCurvesDialog::OnOK().

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

◆ setCurve() [3/3]

void EffectEqualization::setCurve ( void  )
private

Definition at line 1913 of file Equalization.cpp.

1914{
1915 setCurve((int) mCurves.size() - 1);
1916}

References mCurves, and setCurve().

Referenced by Init(), OnCurve(), setCurve(), UpdateCurves(), and VisitSettings().

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

◆ spline()

void EffectEqualization::spline ( double  x[],
double  y[],
size_t  n,
double  y2[] 
)
private

Definition at line 2643 of file Equalization.cpp.

2644{
2645 wxASSERT( n > 0 );
2646
2647 double p, sig;
2648 Doubles u{ n };
2649
2650 y2[0] = 0.; //
2651 u[0] = 0.; //'natural' boundary conditions
2652 for (size_t i = 1; i + 1 < n; i++)
2653 {
2654 sig = ( x[i] - x[i-1] ) / ( x[i+1] - x[i-1] );
2655 p = sig * y2[i-1] + 2.;
2656 y2[i] = (sig - 1.)/p;
2657 u[i] = ( y[i+1] - y[i] ) / ( x[i+1] - x[i] ) - ( y[i] - y[i-1] ) / ( x[i] - x[i-1] );
2658 u[i] = (6.*u[i]/( x[i+1] - x[i-1] ) - sig * u[i-1]) / p;
2659 }
2660 y2[n - 1] = 0.;
2661 for (size_t i = n - 1; i--;)
2662 y2[i] = y2[i]*y2[i+1] + u[i];
2663}

Referenced by GraphicEQ().

Here is the caller graph for this function:

◆ splint()

double EffectEqualization::splint ( double  x[],
double  y[],
size_t  n,
double  y2[],
double  xr 
)
private

Definition at line 2665 of file Equalization.cpp.

2666{
2667 wxASSERT( n > 1 );
2668
2669 double a, b, h;
2670 static double xlast = 0.; // remember last x value requested
2671 static size_t k = 0; // and which interval we were in
2672
2673 if( xr < xlast )
2674 k = 0; // gone back to start, (or somewhere to the left)
2675 xlast = xr;
2676 while( (x[k] <= xr) && (k + 1 < n) )
2677 k++;
2678 wxASSERT( k > 0 );
2679 k--;
2680 h = x[k+1] - x[k];
2681 a = ( x[k+1] - xr )/h;
2682 b = (xr - x[k])/h;
2683 return( a*y[k]+b*y[k+1]+((a*a*a-a)*y2[k]+(b*b*b-b)*y2[k+1])*h*h/6.);
2684}

Referenced by GraphicEQ().

Here is the caller graph for this function:

◆ TransferDataToWindow()

bool EffectEqualization::TransferDataToWindow ( const EffectSettings settings)
overridevirtual

Update controls for the settings.

Reimplemented from Effect.

Definition at line 1110 of file Equalization.cpp.

1111{
1112 // Set log or lin freq scale (affects interpolation as well)
1113 mLinFreq->SetValue( mLin );
1114 wxCommandEvent dummyEvent;
1115 OnLinFreq(dummyEvent); // causes a CalcFilter
1116
1117 mGridOnOff->SetValue( mDrawGrid ); // checks/unchecks the box on the interface
1118
1119 if( mMSlider )
1120 mMSlider->SetValue((mM - 1) / 2);
1121
1122 mdBMinSlider->SetValue((int)mdBMin);
1123 mdBMaxSlider->SetValue((int)mdBMax);
1124
1125 // Reload the curve names
1126 UpdateCurves();
1127
1128 // Set graphic interpolation mode
1129 mInterpChoice->SetSelection(mInterp);
1130
1131 // Override draw mode, if we're not displaying the radio buttons.
1132 if( mOptions == kEqOptionCurve)
1133 mDrawMode = true;
1135 mDrawMode = false;
1136
1137 if( mDraw )
1138 mDraw->SetValue(mDrawMode);
1139 szrV->Show(szr1,mOptions != kEqOptionGraphic); // Graph
1140 szrV->Show(szrG,!mDrawMode); // eq sliders
1141 szrH->Show(szrI,mOptions == kEqLegacy ); // interpolation choice
1142 szrH->Show(szrL, mDrawMode); // linear freq checkbox
1143 if( mGraphic)
1144 mGraphic->SetValue(!mDrawMode);
1145 mGridOnOff->Show( mDrawMode );
1146
1147 // Set Graphic (Fader) or Draw mode
1148 if (!mDrawMode)
1149 UpdateGraphic();
1150
1151 mUIParent->Layout();
1152 wxGetTopLevelParent(mUIParent)->Layout();
1153
1154 return true;
1155}
void OnLinFreq(wxCommandEvent &event)

References kEqLegacy, kEqOptionCurve, kEqOptionGraphic, mdBMax, mdBMaxSlider, mdBMin, mdBMinSlider, mDraw, mDrawGrid, mDrawMode, mGraphic, mGridOnOff, mInterp, mInterpChoice, mLin, mLinFreq, mM, mMSlider, mOptions, Effect::mUIParent, OnLinFreq(), szr1, szrG, szrH, szrI, szrL, szrV, UpdateCurves(), and UpdateGraphic().

Here is the call graph for this function:

◆ UpdateCurves()

void EffectEqualization::UpdateCurves ( )
private

Definition at line 2221 of file Equalization.cpp.

2222{
2223
2224 // Reload the curve names
2225 if( mCurve )
2226 mCurve->Clear();
2227 bool selectedCurveExists = false;
2228 for (size_t i = 0, cnt = mCurves.size(); i < cnt; i++)
2229 {
2230 if (mCurveName == mCurves[ i ].Name)
2231 selectedCurveExists = true;
2232 if( mCurve )
2233 mCurve->Append(mCurves[ i ].Name);
2234 }
2235 // In rare circumstances, mCurveName may not exist (bug 1891)
2236 if (!selectedCurveExists)
2237 mCurveName = mCurves[ (int)mCurves.size() - 1 ].Name;
2238 if( mCurve )
2239 mCurve->SetStringSelection(mCurveName);
2240
2241 // Allow the control to resize
2242 if( mCurve )
2243 mCurve->SetMinSize({-1, -1});
2244
2245 // Set initial curve
2247}

References mCurve, mCurveName, mCurves, and setCurve().

Referenced by OnManage(), and TransferDataToWindow().

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

◆ UpdateDefaultCurves()

void EffectEqualization::UpdateDefaultCurves ( bool  updateAll = false)
private

Definition at line 1564 of file Equalization.cpp.

1565{
1566 if (mCurves.size() == 0)
1567 return;
1568
1569 wxString unnamed = wxT("unnamed");
1570
1571 // Save the "unnamed" curve and remove it so we can add it back as the final curve.
1572 EQCurve userUnnamed(wxT("temp"));
1573 userUnnamed = mCurves.back();
1574 mCurves.pop_back();
1575
1576 EQCurveArray userCurves = mCurves;
1577 mCurves.clear();
1578 // We only wamt to look for the shipped EQDefaultCurves.xml
1579 wxFileName fn = wxFileName(FileNames::ResourcesDir(), wxT("EQDefaultCurves.xml"));
1580 wxLogDebug(wxT("Attempting to load EQDefaultCurves.xml from %s"),fn.GetFullPath());
1581 XMLFileReader reader;
1582
1583 if(!reader.Parse(this, fn.GetFullPath())) {
1584 wxLogError(wxT("EQDefaultCurves.xml could not be read."));
1585 return;
1586 }
1587 else {
1588 wxLogDebug(wxT("Loading EQDefaultCurves.xml successful."));
1589 }
1590
1591 EQCurveArray defaultCurves = mCurves;
1592 mCurves.clear(); // clear now so that we can sort then add back.
1593
1594 // Remove "unnamed" if it exists.
1595 if (defaultCurves.back().Name == unnamed) {
1596 defaultCurves.pop_back();
1597 }
1598 else {
1599 wxLogError(wxT("Error in EQDefaultCurves.xml"));
1600 }
1601
1602 int numUserCurves = userCurves.size();
1603 int numDefaultCurves = defaultCurves.size();
1604 EQCurve tempCurve(wxT("test"));
1605
1606 if (updateAll) {
1607 // Update all factory preset curves.
1608 // Sort and add factory defaults first;
1609 mCurves = defaultCurves;
1610 std::sort(mCurves.begin(), mCurves.end());
1611 // then add remaining user curves:
1612 for (int curveCount = 0; curveCount < numUserCurves; curveCount++) {
1613 bool isCustom = true;
1614 tempCurve = userCurves[curveCount];
1615 // is the name in the default set?
1616 for (int defCurveCount = 0; defCurveCount < numDefaultCurves; defCurveCount++) {
1617 if (tempCurve.Name == mCurves[defCurveCount].Name) {
1618 isCustom = false;
1619 break;
1620 }
1621 }
1622 // if tempCurve is not in the default set, add it to mCurves.
1623 if (isCustom) {
1624 mCurves.push_back(tempCurve);
1625 }
1626 }
1627 }
1628 else {
1629 // Import NEW factory defaults but retain all user modified curves.
1630 for (int defCurveCount = 0; defCurveCount < numDefaultCurves; defCurveCount++) {
1631 bool isUserCurve = false;
1632 // Add if the curve is in the user's set (preserve user's copy)
1633 for (int userCurveCount = 0; userCurveCount < numUserCurves; userCurveCount++) {
1634 if (userCurves[userCurveCount].Name == defaultCurves[defCurveCount].Name) {
1635 isUserCurve = true;
1636 mCurves.push_back(userCurves[userCurveCount]);
1637 break;
1638 }
1639 }
1640 if (!isUserCurve) {
1641 mCurves.push_back(defaultCurves[defCurveCount]);
1642 }
1643 }
1644 std::sort(mCurves.begin(), mCurves.end());
1645 // now add the rest of the user's curves.
1646 for (int userCurveCount = 0; userCurveCount < numUserCurves; userCurveCount++) {
1647 bool isDefaultCurve = false;
1648 tempCurve = userCurves[userCurveCount];
1649 for (int defCurveCount = 0; defCurveCount < numDefaultCurves; defCurveCount++) {
1650 if (tempCurve.Name == defaultCurves[defCurveCount].Name) {
1651 isDefaultCurve = true;
1652 break;
1653 }
1654 }
1655 if (!isDefaultCurve) {
1656 mCurves.push_back(tempCurve);
1657 }
1658 }
1659 }
1660 defaultCurves.clear();
1661 userCurves.clear();
1662
1663 // Add back old "unnamed"
1664 if(userUnnamed.Name == unnamed) {
1665 mCurves.push_back( userUnnamed ); // we always need a default curve to use
1666 }
1667
1668 SaveCurves();
1669
1670 // Write current EqCurve version number
1671 // TODO: Probably better if we used pluginregistry.cfg
1672 wxString eqCurvesCurrentVersion = wxString::Format(wxT("%d.%d"), EQCURVES_VERSION, EQCURVES_REVISION);
1673 gPrefs->Write(GetPrefsPrefix()+"PresetVersion", eqCurvesCurrentVersion);
1674 gPrefs->Flush();
1675
1676 return;
1677}
std::vector< EQCurve > EQCurveArray
Definition: Equalization.h:91
void SaveCurves(const wxString &fileName={})
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:143

References EQCURVES_REVISION, EQCURVES_VERSION, FileConfig::Flush(), fn, GetPrefsPrefix(), gPrefs, mCurves, EQCurve::Name, XMLFileReader::Parse(), FileNames::ResourcesDir(), and SaveCurves().

Referenced by LoadCurves().

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

◆ UpdateDraw()

void EffectEqualization::UpdateDraw ( )
private

Definition at line 2249 of file Equalization.cpp.

2250{
2251 size_t numPoints = mLogEnvelope->GetNumberOfPoints();
2252 Doubles when{ numPoints };
2253 Doubles value{ numPoints };
2254 double deltadB = 0.1;
2255 double dx, dy, dx1, dy1, err;
2256
2257 mLogEnvelope->GetPoints( when.get(), value.get(), numPoints );
2258
2259 // set 'unnamed' as the selected curve
2261
2262 bool flag = true;
2263 while (flag)
2264 {
2265 flag = false;
2266 int numDeleted = 0;
2267 mLogEnvelope->GetPoints( when.get(), value.get(), numPoints );
2268 for (size_t j = 0; j + 2 < numPoints; j++)
2269 {
2270 dx = when[j+2+numDeleted] - when[j+numDeleted];
2271 dy = value[j+2+numDeleted] - value[j+numDeleted];
2272 dx1 = when[j+numDeleted+1] - when[j+numDeleted];
2273 dy1 = dy * dx1 / dx;
2274 err = fabs(value[j+numDeleted+1] - (value[j+numDeleted] + dy1));
2275 if( err < deltadB )
2276 { // within < deltadB dB?
2277 mLogEnvelope->Delete(j+1);
2278 numPoints--;
2279 numDeleted++;
2280 flag = true;
2281 }
2282 }
2283 }
2284
2285 if(mLin) // do not use IsLinear() here
2286 {
2287 EnvLogToLin();
2288 mEnvelope = mLinEnvelope.get();
2289 mFreqRuler->ruler.SetLog(false);
2291 }
2292
2293 szrV->Show(szrG,false);
2294 szrH->Show(szrI,false);
2295 szrH->Show(szrL,true);
2296
2297 mUIParent->Layout();
2298 wxGetTopLevelParent(mUIParent)->Layout();
2299 ForceRecalc(); // it may have changed slightly due to the deletion of points
2300}

References EnvelopeUpdated(), EnvLogToLin(), flag, ForceRecalc(), mEnvelope, mFreqRuler, mHiFreq, mLin, mLinEnvelope, mLogEnvelope, Effect::mUIParent, RulerPanel::ruler, Ruler::SetLog(), Ruler::SetRange(), szrG, szrH, szrI, szrL, and szrV.

Referenced by OnDrawMode().

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

◆ UpdateGraphic()

void EffectEqualization::UpdateGraphic ( void  )
private

Definition at line 2302 of file Equalization.cpp.

2303{
2304 double loLog = log10(mLoFreq);
2305 double hiLog = log10(mHiFreq);
2306 double denom = hiLog - loLog;
2307
2308 if(mLin) //going from lin to log freq scale - do not use IsLinear() here
2309 { // add some extra points to the linear envelope for the graphic to follow
2310 double step = pow(2., 1./12.); // twelve steps per octave
2311 double when,value;
2312 for(double freq=10.; freq<mHiFreq; freq*=step)
2313 {
2314 when = freq/mHiFreq;
2315 value = mLinEnvelope->GetValue(when);
2316 mLinEnvelope->Insert(when, value);
2317 }
2318
2319 EnvLinToLog();
2320 mEnvelope = mLogEnvelope.get();
2321 mFreqRuler->ruler.SetLog(true);
2323 }
2324
2325 for (size_t i = 0; i < mBandsInUse; i++)
2326 {
2327 if( kThirdOct[i] == mLoFreq )
2328 mWhenSliders[i] = 0.;
2329 else
2330 mWhenSliders[i] = (log10(kThirdOct[i])-loLog)/denom;
2331 mEQVals[i] = mLogEnvelope->GetValue(mWhenSliders[i]); //set initial values of sliders
2332 if( mEQVals[i] > 20.)
2333 mEQVals[i] = 20.;
2334 if( mEQVals[i] < -20.)
2335 mEQVals[i] = -20.;
2336 }
2337 ErrMin(); //move sliders to minimise error
2338 for (size_t i = 0; i < mBandsInUse; i++)
2339 {
2340 mSliders[i]->SetValue(lrint(mEQVals[i])); //actually set slider positions
2341 mSlidersOld[i] = mSliders[i]->GetValue();
2342 wxString tip;
2343 if( kThirdOct[i] < 1000.)
2344 tip.Printf( wxT("%dHz\n%.1fdB"), (int)kThirdOct[i], mEQVals[i] );
2345 else
2346 tip.Printf( wxT("%gkHz\n%.1fdB"), kThirdOct[i]/1000., mEQVals[i] );
2347 mSliders[i]->SetToolTip(tip);
2348 }
2349
2350 szrV->Show(szrG,true); // eq sliders
2351 szrH->Show(szrI,mOptions == kEqLegacy ); // interpolation choice
2352 szrH->Show(szrL,false); // linear freq checkbox
2353
2354 mUIParent->Layout();
2355 wxGetTopLevelParent(mUIParent)->Layout();
2356 mUIParent->Layout();
2357 wxGetTopLevelParent(mUIParent)->Layout();
2358
2359 GraphicEQ(mLogEnvelope.get());
2360 mDrawMode = false;
2361}
#define lrint(dbl)
Definition: float_cast.h:169

References EnvLinToLog(), ErrMin(), GraphicEQ(), kEqLegacy, kThirdOct, lrint, mBandsInUse, mDrawMode, mEnvelope, mEQVals, mFreqRuler, mHiFreq, mLin, mLinEnvelope, mLoFreq, mLogEnvelope, mOptions, mSliders, mSlidersOld, Effect::mUIParent, mWhenSliders, RulerPanel::ruler, Ruler::SetLog(), Ruler::SetRange(), szrG, szrH, szrI, szrL, and szrV.

Referenced by OnCurve(), OnGraphicMode(), and TransferDataToWindow().

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

◆ UpdateRuler()

void EffectEqualization::UpdateRuler ( )
private

Definition at line 1157 of file Equalization.cpp.

1158{
1159 // Refresh ruler when values have changed
1160 int w1, w2, h;
1161 mdBRuler->ruler.GetMaxSize(&w1, &h);
1163 mdBRuler->ruler.GetMaxSize(&w2, &h);
1164 if( w1 != w2 ) // Reduces flicker
1165 {
1166 mdBRuler->SetSize(wxSize(w2,h));
1167 mFreqRuler->Refresh(false);
1168 }
1169 mdBRuler->Refresh(false);
1170
1171 mPanel->Refresh(false);
1172}
void GetMaxSize(wxCoord *width, wxCoord *height)
Definition: Ruler.cpp:1603

References Ruler::GetMaxSize(), mdBMax, mdBMin, mdBRuler, mFreqRuler, mPanel, RulerPanel::ruler, and Ruler::SetRange().

Referenced by OnSliderDBMAX(), and OnSliderDBMIN().

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

◆ ValidateUI()

bool EffectEqualization::ValidateUI ( EffectSettings )
overridevirtual

Reimplemented from Effect.

Definition at line 518 of file Equalization.cpp.

519{
520 // If editing a macro, we don't want to be using the unnamed curve so
521 // we offer to save it.
522
523 if (mDisallowCustom && mCurveName == wxT("unnamed"))
524 {
525 // PRL: This is unreachable. mDisallowCustom is always false.
526
528 XO("To use this filter curve in a macro, please choose a new name for it.\nChoose the 'Save/Manage Curves...' button and rename the 'unnamed' curve, then use that one."),
529 wxOK | wxCENTRE,
530 XO("Filter Curve EQ needs a different name") );
531 return false;
532 }
533
534 // Update unnamed curve (so it's there for next time)
535 //(done in a hurry, may not be the neatest -MJS)
536 if (mDirty && !mDrawMode)
537 {
538 size_t numPoints = mLogEnvelope->GetNumberOfPoints();
539 Doubles when{ numPoints };
540 Doubles value{ numPoints };
541 mLogEnvelope->GetPoints(when.get(), value.get(), numPoints);
542 for (size_t i = 0, j = 0; j + 2 < numPoints; i++, j++)
543 {
544 if ((value[i] < value[i + 1] + .05) && (value[i] > value[i + 1] - .05) &&
545 (value[i + 1] < value[i + 2] + .05) && (value[i + 1] > value[i + 2] - .05))
546 { // within < 0.05 dB?
547 mLogEnvelope->Delete(j + 1);
548 numPoints--;
549 j--;
550 }
551 }
552 Select((int) mCurves.size() - 1);
553 }
554 SaveCurves();
555
556 // TODO: just visit these effect settings the default way
558 CurrentSettingsGroup(), wxT("dBMin"), mdBMin);
560 CurrentSettingsGroup(), wxT("dBMax"), mdBMax);
562 CurrentSettingsGroup(), wxT("DrawMode"), mDrawMode);
564 CurrentSettingsGroup(), wxT("DrawGrid"), mDrawGrid);
565
566 return true;
567}
const EffectSettingsManager & GetDefinition() const override
Definition: Effect.cpp:453
bool SetConfig(const EffectDefinitionInterface &ident, ConfigurationType type, const RegistryPath &group, const RegistryPath &key, const Value &value)

References CurrentSettingsGroup(), Effect::GetDefinition(), mCurveName, mCurves, mdBMax, mdBMin, mDirty, mDisallowCustom, mDrawGrid, mDrawMode, Effect::MessageBox(), mLogEnvelope, PluginSettings::Private, SaveCurves(), Select(), PluginSettings::SetConfig(), and XO.

Here is the call graph for this function:

◆ VisitSettings() [1/2]

bool EffectEqualization::VisitSettings ( ConstSettingsVisitor visitor,
const EffectSettings settings 
) const
overridevirtual

Visit settings (read-only), if defined. false means no defined settings. Default implementation returns false

Reimplemented from Effect.

Definition at line 377 of file Equalization.cpp.

379{
381
382 // Curve point parameters -- how many isn't known statically
383 if( dynamic_cast<ShuttleGetAutomation*>(&visitor)) {
384 int numPoints = mCurves[ 0 ].points.size();
385 int point;
386 for( point = 0; point < numPoints; point++ )
387 {
388 const wxString nameFreq = wxString::Format("f%i",point);
389 const wxString nameVal = wxString::Format("v%i",point);
390 visitor.Define( mCurves[ 0 ].points[ point ].Freq, nameFreq,
391 0.0, 0.0, 0.0, 0.0 );
392 visitor.Define( mCurves[ 0 ].points[ point ].dB, nameVal,
393 0.0, 0.0, 0.0, 0.0 );
394 }
395 }
396 return true;
397}
bool VisitSettings(SettingsVisitor &visitor, EffectSettings &settings) override
Definition: Effect.cpp:217
virtual void Define(Arg< bool > var, const wxChar *key, bool vdefault, bool vmin=false, bool vmax=false, bool vscl=false)
Definition: Shuttle.cpp:359
SettingsVisitor that gets parameter values into a string.

References SettingsVisitorBase< Const >::Define(), mCurves, settings(), and Effect::VisitSettings().

Here is the call graph for this function:

◆ VisitSettings() [2/2]

bool EffectEqualization::VisitSettings ( SettingsVisitor visitor,
EffectSettings settings 
)
overridevirtual

Visit settings (and maybe change them), if defined. false means no defined settings. Default implementation returns false

Reimplemented from Effect.

Definition at line 399 of file Equalization.cpp.

401{
403
404 // Curve point parameters -- how many isn't known statically
405 {
406 mCurves[0].points.clear();
407
408 for (int i = 0; i < 200; i++)
409 {
410 const wxString nameFreq = wxString::Format("f%i",i);
411 const wxString nameVal = wxString::Format("v%i",i);
412 double f = -1000.0;
413 double d = 0.0;
414 visitor.Define( f, nameFreq, 0.0, -10000.0, 1000000.0, 0.0 );
415 visitor.Define( d, nameVal, 0.0, -10000.0, 10000.0, 0.0 );
416 if( f <= 0.0 )
417 break;
418 mCurves[0].points.push_back( EQPoint( f,d ));
419 }
420 setCurve( 0 );
421 }
422 return true;
423}

References SettingsVisitorBase< Const >::Define(), mCurves, setCurve(), settings(), and Effect::VisitSettings().

Referenced by LoadFactoryPreset().

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

◆ WriteXML()

void EffectEqualization::WriteXML ( XMLWriter xmlFile) const
private

Definition at line 2179 of file Equalization.cpp.

2181{
2182 // Start our hierarchy
2183 xmlFile.StartTag( wxT( "equalizationeffect" ) );
2184
2185 // Write all curves
2186 int numCurves = mCurves.size();
2187 int curve;
2188 for( curve = 0; curve < numCurves; curve++ )
2189 {
2190 // Start a NEW curve
2191 xmlFile.StartTag( wxT( "curve" ) );
2192 xmlFile.WriteAttr( wxT( "name" ), mCurves[ curve ].Name );
2193
2194 // Write all points
2195 int numPoints = mCurves[ curve ].points.size();
2196 int point;
2197 for( point = 0; point < numPoints; point++ )
2198 {
2199 // Write NEW point
2200 xmlFile.StartTag( wxT( "point" ) );
2201 xmlFile.WriteAttr( wxT( "f" ), mCurves[ curve ].points[ point ].Freq, 12 );
2202 xmlFile.WriteAttr( wxT( "d" ), mCurves[ curve ].points[ point ].dB, 12 );
2203 xmlFile.EndTag( wxT( "point" ) );
2204 }
2205
2206 // Terminate curve
2207 xmlFile.EndTag( wxT( "curve" ) );
2208 }
2209
2210 // Terminate our hierarchy
2211 xmlFile.EndTag( wxT( "equalizationeffect" ) );
2212}
virtual void StartTag(const wxString &name)
Definition: XMLWriter.cpp:80
void WriteAttr(const wxString &name, const Identifier &value)
Definition: XMLWriter.h:37
virtual void EndTag(const wxString &name)
Definition: XMLWriter.cpp:103

Referenced by SaveCurves().

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ EditCurvesDialog

friend class EditCurvesDialog
friend

Definition at line 290 of file Equalization.h.

◆ EqualizationPanel

friend class EqualizationPanel
friend

Definition at line 289 of file Equalization.h.

Referenced by PopulateOrExchange().

Member Data Documentation

◆ CurveName

constexpr EffectParameter EffectEqualization::CurveName
staticconstexprprivate
Initial value:
L"CurveName", L"unnamed", L"", L"", L""}

Definition at line 304 of file Equalization.h.

◆ dBMax

constexpr EffectParameter EffectEqualization::dBMax
staticconstexprprivate
Initial value:
L"", 30.0f, 0.0, 60.0, 0 }

Definition at line 316 of file Equalization.h.

Referenced by DoLoadFactoryDefaults().

◆ dBMin

constexpr EffectParameter EffectEqualization::dBMin
staticconstexprprivate
Initial value:
L"", -30.0f, -120.0, -10.0, 0 }

Definition at line 314 of file Equalization.h.

Referenced by DoLoadFactoryDefaults().

◆ DrawGrid

constexpr EffectParameter EffectEqualization::DrawGrid
staticconstexprprivate
Initial value:
L"", true, false, true, false }

Definition at line 312 of file Equalization.h.

Referenced by DoLoadFactoryDefaults().

◆ DrawMode

constexpr EffectParameter EffectEqualization::DrawMode
staticconstexprprivate
Initial value:
L"", true, false, true, false }

Definition at line 310 of file Equalization.h.

Referenced by DoLoadFactoryDefaults().

◆ FilterLength

constexpr EffectParameter EffectEqualization::FilterLength
staticconstexprprivate
Initial value:
L"FilterLength", 8191, 21, 8191, 0 }

Definition at line 302 of file Equalization.h.

Referenced by Parameters().

◆ hFFT

HFFT EffectEqualization::hFFT
private

Definition at line 215 of file Equalization.h.

Referenced by Filter().

◆ InterpLin

constexpr EffectParameter EffectEqualization::InterpLin
staticconstexprprivate
Initial value:
L"InterpolateLin", false, false, true, false }

Definition at line 306 of file Equalization.h.

Referenced by Parameters().

◆ InterpMeth

constexpr EnumParameter EffectEqualization::InterpMeth
staticconstexprprivate
Initial value:
L"InterpolationMethod", 0, 0, 0, 0, kInterpStrings, nInterpolations }

Definition at line 308 of file Equalization.h.

Referenced by Parameters().

◆ kInterpStrings

const EnumValueSymbol EffectEqualization::kInterpStrings
staticprivate
Initial value:
=
{
{ XO("B-spline") },
{ XO("Cosine") },
{ XO("Cubic") }
}

Definition at line 299 of file Equalization.h.

Referenced by PopulateOrExchange().

◆ mBandsInUse

size_t EffectEqualization::mBandsInUse
private

Definition at line 228 of file Equalization.h.

Referenced by ErrMin(), Flatten(), GraphicEQ(), Init(), OnInvert(), OnSlider(), and UpdateGraphic().

◆ mCurve

wxChoice* EffectEqualization::mCurve
private

Definition at line 272 of file Equalization.h.

Referenced by CloseUI(), OnCurve(), OnManage(), PopulateOrExchange(), Select(), and UpdateCurves().

◆ mCurveName

wxString EffectEqualization::mCurveName
private

Definition at line 218 of file Equalization.h.

Referenced by Init(), Select(), UpdateCurves(), and ValidateUI().

◆ mCurves

EQCurveArray EffectEqualization::mCurves
private

◆ mdBMax

float EffectEqualization::mdBMax
private

◆ mdBMaxSlider

wxSlider* EffectEqualization::mdBMaxSlider
private

Definition at line 277 of file Equalization.h.

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

◆ mdBMin

float EffectEqualization::mdBMin
private

◆ mdBMinSlider

wxSlider* EffectEqualization::mdBMinSlider
private

Definition at line 276 of file Equalization.h.

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

◆ mdBRuler

RulerPanel* EffectEqualization::mdBRuler
private

Definition at line 229 of file Equalization.h.

Referenced by EqualizationPanel::OnPaint(), PopulateOrExchange(), and UpdateRuler().

◆ mDirty

bool EffectEqualization::mDirty
private

Definition at line 236 of file Equalization.h.

Referenced by EnvelopeUpdated(), and ValidateUI().

◆ mDisallowCustom

bool EffectEqualization::mDisallowCustom
private

Definition at line 232 of file Equalization.h.

Referenced by ValidateUI().

◆ mDraw

wxRadioButton* EffectEqualization::mDraw
private

Definition at line 267 of file Equalization.h.

Referenced by PopulateOrExchange(), and TransferDataToWindow().

◆ mDrawGrid

bool EffectEqualization::mDrawGrid
private

◆ mDrawMode

bool EffectEqualization::mDrawMode
private

◆ mEnvelope

Envelope* EffectEqualization::mEnvelope
private

◆ mEQVals

double EffectEqualization::mEQVals[NUMBER_OF_BANDS+1]
private

◆ mFFTBuffer

Floats EffectEqualization::mFFTBuffer
private

Definition at line 216 of file Equalization.h.

Referenced by Filter().

◆ mFilterFuncI

Floats EffectEqualization::mFilterFuncI
private

◆ mFilterFuncR

Floats EffectEqualization::mFilterFuncR
private

◆ mFreqRuler

RulerPanel* EffectEqualization::mFreqRuler
private

◆ mGraphic

wxRadioButton* EffectEqualization::mGraphic
private

Definition at line 268 of file Equalization.h.

Referenced by PopulateOrExchange(), and TransferDataToWindow().

◆ mGridOnOff

wxCheckBox* EffectEqualization::mGridOnOff
private

Definition at line 270 of file Equalization.h.

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

◆ mHiFreq

double EffectEqualization::mHiFreq
private

◆ mInterp

int EffectEqualization::mInterp
private

Definition at line 223 of file Equalization.h.

Referenced by GraphicEQ(), OnInterp(), and TransferDataToWindow().

◆ mInterpChoice

wxChoice* EffectEqualization::mInterpChoice
private

Definition at line 271 of file Equalization.h.

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

◆ mLeftSpacer

wxSizerItem* EffectEqualization::mLeftSpacer
private

Definition at line 263 of file Equalization.h.

◆ mLin

bool EffectEqualization::mLin
private

◆ mLinEnvelope

std::unique_ptr<Envelope> EffectEqualization::mLinEnvelope
private

◆ mLinFreq

wxCheckBox* EffectEqualization::mLinFreq
private

Definition at line 269 of file Equalization.h.

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

◆ mLoFreq

double EffectEqualization::mLoFreq
private

◆ mLogEnvelope

std::unique_ptr<Envelope> EffectEqualization::mLogEnvelope
private

◆ mM

size_t EffectEqualization::mM
private

◆ mManage

wxButton* EffectEqualization::mManage
private

Definition at line 273 of file Equalization.h.

◆ mMSlider

wxSlider* EffectEqualization::mMSlider
private

Definition at line 275 of file Equalization.h.

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

◆ mMText

wxStaticText* EffectEqualization::mMText
private

Definition at line 274 of file Equalization.h.

Referenced by OnSliderM(), and PopulateOrExchange().

◆ mOptions

int EffectEqualization::mOptions
private

◆ mPanel

EqualizationPanel* EffectEqualization::mPanel
private

Definition at line 265 of file Equalization.h.

Referenced by CloseUI(), ForceRecalc(), OnGridOnOff(), PopulateOrExchange(), and UpdateRuler().

◆ mSliders

wxSlider* EffectEqualization::mSliders[NUMBER_OF_BANDS]
private

Definition at line 278 of file Equalization.h.

Referenced by Flatten(), OnInvert(), OnSlider(), PopulateOrExchange(), and UpdateGraphic().

◆ mSlidersOld

int EffectEqualization::mSlidersOld[NUMBER_OF_BANDS]
private

Definition at line 237 of file Equalization.h.

Referenced by Flatten(), OnInvert(), OnSlider(), PopulateOrExchange(), and UpdateGraphic().

◆ mWhens

double EffectEqualization::mWhens[NUM_PTS]
private

Definition at line 226 of file Equalization.h.

Referenced by ErrMin(), and GraphicEQ().

◆ mWhenSliders

double EffectEqualization::mWhenSliders[NUMBER_OF_BANDS+1]
private

Definition at line 227 of file Equalization.h.

Referenced by GraphicEQ(), and UpdateGraphic().

◆ mWindowSize

size_t EffectEqualization::mWindowSize
private

◆ Symbol

const ComponentInterfaceSymbol EffectEqualization::Symbol { XO("Equalization") }
static

Definition at line 103 of file Equalization.h.

Referenced by GetSymbol().

◆ szr1

wxSizer* EffectEqualization::szr1
private

Definition at line 257 of file Equalization.h.

Referenced by PopulateOrExchange(), and TransferDataToWindow().

◆ szr2

wxSizer* EffectEqualization::szr2
private

Definition at line 258 of file Equalization.h.

◆ szr3

wxSizer* EffectEqualization::szr3
private

Definition at line 259 of file Equalization.h.

◆ szr4

wxSizer* EffectEqualization::szr4
private

Definition at line 260 of file Equalization.h.

◆ szr5

wxSizer* EffectEqualization::szr5
private

Definition at line 261 of file Equalization.h.

◆ szrC

wxSizer* EffectEqualization::szrC
private

Definition at line 251 of file Equalization.h.

◆ szrG

wxSizer* EffectEqualization::szrG
private

◆ szrH

wxSizer* EffectEqualization::szrH
private

◆ szrI

wxSizer* EffectEqualization::szrI
private

◆ szrL

wxSizer* EffectEqualization::szrL
private

◆ szrV

wxSizer* EffectEqualization::szrV
private

◆ windowSize

const size_t EffectEqualization::windowSize = 16384u
staticprivate

Definition at line 149 of file Equalization.h.

Referenced by ProcessOne().


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