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...
 
OptionalMessage LoadFactoryDefaults (EffectSettings &settings) const override
 
OptionalMessage DoLoadFactoryDefaults (EffectSettings &settings)
 
RegistryPaths GetFactoryPresets () const override
 Report names of factory presets. More...
 
OptionalMessage LoadFactoryPreset (int id, EffectSettings &settings) const override
 
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, const EffectOutputs *pOutputs) 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, EffectOutputs *pOutputs, unsigned numChannels, float sampleRate)
 
virtual bool RealtimeSuspend ()
 
virtual bool RealtimeResume ()
 
virtual bool RealtimeProcessStart (MessagePackage &package)
 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
 
virtual unsigned GetAudioInCount () const
 How many input buffers to allocate at once. More...
 
virtual unsigned GetAudioOutCount () const
 How many output buffers to allocate at once. More...
 
virtual sampleCount GetLatency () 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...
 
OptionalMessage LoadUserPreset (const RegistryPath &name, EffectSettings &settings) const override
 
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...
 
OptionalMessage LoadFactoryPreset (int id, EffectSettings &settings) const override
 
OptionalMessage LoadFactoryDefaults (EffectSettings &settings) const override
 
virtual const EffectParameterMethodsParameters () const
 
int ShowClientInterface (wxWindow &parent, wxDialog &dialog, EffectUIValidator *pValidator, bool forceModal) override
 
EffectUIClientInterfaceGetEffectUIClientInterface () override
 Returns the EffectUIClientInterface instance for this effect. More...
 
std::unique_ptr< EffectUIValidatorPopulateUI (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) 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
 
OptionalMessage 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
 
OptionalMessage 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
 
void SetTracks (TrackList *pTracks)
 
- Public Member Functions inherited from EffectUIClientInterface
virtual ~EffectUIClientInterface ()
 
virtual int ShowClientInterface (wxWindow &parent, wxDialog &dialog, EffectUIValidator *pValidator, bool forceModal=false)=0
 
virtual bool IsGraphicalUI ()=0
 
virtual std::unique_ptr< EffectUIValidatorPopulateUI (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs)=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 OptionalMessage ImportPresets (EffectSettings &settings)=0
 
virtual bool HasOptions ()=0
 
virtual void ShowOptions ()=0
 
virtual bool ValidateUI (EffectSettings &settings)=0
 
virtual bool CloseUI ()=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 EffectUIClientInterfaceGetEffectUIClientInterface ()=0
 Returns the EffectUIClientInterface instance for this effect. More...
 
virtual void Preview (EffectSettingsAccess &access, bool dryOnly)=0
 
virtual bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const =0
 
virtual OptionalMessage 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...
 
- 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...
 
virtual std::unique_ptr< EffectOutputsMakeOutputs () const
 Produce an object to hold values to send to effect output meters. 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 StatefulEffectBase
using MessagePackage = EffectInstance::MessagePackage
 
- 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, const EffectOutputs *pOutputs)
 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
 
- 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 }
 
- 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 155 of file Equalization.h.

◆ kInterpolations

Enumerator
kBspline 
kCosine 
kCubic 
nInterpolations 

Definition at line 294 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 1329 of file Equalization.cpp.

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

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

684{
685 mCurve = NULL;
686 mPanel = NULL;
687
688 return Effect::CloseUI();
689}
EqualizationPanel * mPanel
Definition: Equalization.h:267
bool CloseUI() override
Definition: Effect.cpp:313

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

Here is the call graph for this function:

◆ DoLoadFactoryDefaults()

OptionalMessage EffectEqualization::DoLoadFactoryDefaults ( EffectSettings settings)

Definition at line 435 of file Equalization.cpp.

436{
437 mdBMin = dBMin.def;
438 mdBMax = dBMax.def;
441
443 mDrawMode = true;
445 mDrawMode = false;
446
448}
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:314
static constexpr EffectParameter dBMin
Definition: Equalization.h:316
static constexpr EffectParameter DrawMode
Definition: Equalization.h:312
static constexpr EffectParameter dBMax
Definition: Equalization.h:318
OptionalMessage LoadFactoryDefaults(EffectSettings &settings) const override
Definition: Effect.cpp:273
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 1967 of file Equalization.cpp.

1968{
1969 if (IsLinear())
1970 {
1971 EnvelopeUpdated(mLinEnvelope.get(), true);
1972 }
1973 else
1974 {
1975 EnvelopeUpdated(mLogEnvelope.get(), false);
1976 }
1977}

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

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

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

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

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

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

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

1443{
1444 float re,im;
1445 // Apply FFT
1446 RealFFTf(buffer, hFFT.get());
1447 //FFT(len, false, inr, NULL, outr, outi);
1448
1449 // Apply filter
1450 // DC component is purely real
1451 mFFTBuffer[0] = buffer[0] * mFilterFuncR[0];
1452 for(size_t i = 1; i < (len / 2); i++)
1453 {
1454 re=buffer[hFFT->BitReversed[i] ];
1455 im=buffer[hFFT->BitReversed[i]+1];
1456 mFFTBuffer[2*i ] = re*mFilterFuncR[i] - im*mFilterFuncI[i];
1457 mFFTBuffer[2*i+1] = re*mFilterFuncI[i] + im*mFilterFuncR[i];
1458 }
1459 // Fs/2 component is purely real
1460 mFFTBuffer[1] = buffer[1] * mFilterFuncR[len/2];
1461
1462 // Inverse FFT and normalization
1463 InverseRealFFTf(mFFTBuffer.get(), hFFT.get());
1464 ReorderToTime(hFFT.get(), mFFTBuffer.get(), buffer);
1465}
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 2037 of file Equalization.cpp.

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

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

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

1957{
1958 if (mPanel)
1959 {
1961 }
1962}

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

1687{
1688 // look in data dir first, in case the user has their own defaults (maybe downloaded ones)
1689 fileName = wxFileName( FileNames::DataDir(), wxT("EQDefaultCurves.xml") );
1690 if( !fileName.FileExists() )
1691 { // Default file not found in the data dir. Fall back to Resources dir.
1692 // See http://docs.wxwidgets.org/trunk/classwx_standard_paths.html#5514bf6288ee9f5a0acaf065762ad95d
1693 fileName = wxFileName( FileNames::ResourcesDir(), wxT("EQDefaultCurves.xml") );
1694 }
1695 if( !fileName.FileExists() )
1696 {
1697 // LLL: Is there really a need for an error message at all???
1698 //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")
1699 // .Format( FileNames::DataDir() );
1700 //BasicUI::ShowErrorDialog( wxWidgetsWindowPlacement{ mUIParent },
1701 // XO("EQCurves.xml and EQDefaultCurves.xml missing"),
1702 // errorMessage, wxT("http://wiki.audacityteam.org/wiki/EQCurvesDownload"), false);
1703
1704 // Have another go at finding EQCurves.xml in the data dir, in case 'help' helped
1705 fileName = wxFileName( FileNames::DataDir(), wxT("EQDefaultCurves.xml") );
1706 }
1707 return (fileName.FileExists());
1708}
FILES_API FilePath ResourcesDir()
FILES_API FilePath DataDir()
Audacity user data directory.

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

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

479{
481
482 for (size_t i = 0; i < WXSIZEOF(FactoryPresets); i++)
483 {
484 if ((mOptions == kEqOptionGraphic) && (FactoryPresets[i].bForBoth == false))
485 continue;
486 names.push_back(FactoryPresets[i].name.Translation());
487 }
488
489 return names;
490}
static const struct @26 FactoryPresets[]
const TranslatableString name
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 577 of file Equalization.cpp.

578{
579 wxString base = wxT("/Effects/Equalization/");
581 base = wxT("/Effects/GraphicEq/");
582 else if( mOptions == kEqOptionCurve )
583 base = wxT("/Effects/FilterCurve/");
584 return base;
585}

References kEqOptionCurve, kEqOptionGraphic, mOptions, and wxT().

Referenced by LoadCurves(), and UpdateDefaultCurves().

Here is the call graph for this function:
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:325
static const ComponentInterfaceSymbol Symbol
Definition: Equalization.h:333
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 2509 of file Equalization.cpp.

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

2161{
2162 if (tag == "equalizationeffect")
2163 {
2164 return this;
2165 }
2166
2167 if (tag == "curve")
2168 {
2169 return this;
2170 }
2171
2172 if (tag == "point")
2173 {
2174 return this;
2175 }
2176
2177 return NULL;
2178}

◆ HandleXMLTag()

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

Implements XMLTagHandler.

Definition at line 2066 of file Equalization.cpp.

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

References mCurves, and wxT().

Here is the call graph for this function:

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

588{
589 int selcount = 0;
590 double rate = 0.0;
591
592 if (const auto project = FindProject()) {
593 auto trackRange = TrackList::Get(*project).Selected<const WaveTrack>();
594 if (trackRange) {
595 rate = (*(trackRange.first++)) -> GetRate();
596 ++selcount;
597
598 for (auto track : trackRange) {
599 if (track->GetRate() != rate) {
601 XO(
602 "To apply Equalization, all selected tracks must have the same sample rate.") );
603 return(false);
604 }
605 ++selcount;
606 }
607 }
608 }
609 else
610 // Editing macro parameters, use this default
611 rate = 44100.0;
612
613 mHiFreq = rate / 2.0;
614 // Unlikely, but better than crashing.
615 if (mHiFreq <= loFreqI) {
617 XO("Track sample rate is too low for this effect."),
618 wxOK | wxCENTRE,
619 XO("Effect Unavailable") );
620 return(false);
621 }
622
624
625 mBandsInUse = 0;
626 while (kThirdOct[mBandsInUse] <= mHiFreq) {
627 mBandsInUse++;
629 break;
630 }
631
633
635
636 CalcFilter();
637
638 return(true);
639}
const AudacityProject * FindProject() const
Definition: EffectBase.cpp:319
Envelope * mEnvelope
Definition: Equalization.h:245
int MessageBox(const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={}) const
Definition: Effect.cpp:863
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:486
auto Selected() -> TrackIterRange< TrackType >
Definition: Track.h:1454
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 2029 of file Equalization.cpp.

2030{
2031 return mDrawMode && mLin;
2032}

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

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

OptionalMessage EffectEqualization::LoadFactoryDefaults ( EffectSettings settings) const
overridevirtual

Change settings back to "factory default"

Returns
nullopt for failure

Reimplemented from Effect.

Definition at line 426 of file Equalization.cpp.

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

References DoLoadFactoryDefaults(), and settings().

Here is the call graph for this function:

◆ LoadFactoryPreset()

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

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

Returns
nullopt for failure

Reimplemented from Effect.

Definition at line 493 of file Equalization.cpp.

494{
495 int index = -1;
496 for (size_t i = 0; i < WXSIZEOF(FactoryPresets); i++)
497 {
498 if ((mOptions == kEqOptionGraphic) && (FactoryPresets[i].bForBoth == false))
499 continue;
500 if (id-- == 0) {
501 index = i;
502 break;
503 }
504 }
505 if (index < 0)
506 return {};
507
508 // mParams =
509 wxString params = FactoryPresets[index].values;
510
513 S.SetForWriting( &eap );
514 // To do: externalize state so const_cast isn't needed
515 if (!const_cast<EffectEqualization*>(this)->VisitSettings(S, settings))
516 return {};
517 return { nullptr };
518}
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 2830 of file Equalization.cpp.

2831{
2832 Flatten();
2833}

References Flatten().

Here is the call graph for this function:

◆ OnCurve()

void EffectEqualization::OnCurve ( wxCommandEvent &  event)
private

Definition at line 2806 of file Equalization.cpp.

2807{
2808 // Select NEW curve
2809 wxASSERT( mCurve != NULL );
2810 setCurve( mCurve->GetCurrentSelection() );
2811 if( !mDrawMode )
2812 UpdateGraphic();
2813}
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 2749 of file Equalization.cpp.

2750{
2751 mDrawMode = true;
2752 UpdateDraw();
2753}

References mDrawMode, and UpdateDraw().

Here is the call graph for this function:

◆ OnErase()

void EffectEqualization::OnErase ( wxEvent &  event)
private

Definition at line 2690 of file Equalization.cpp.

2691{
2692}

Referenced by PopulateOrExchange().

Here is the caller graph for this function:

◆ OnGraphicMode()

void EffectEqualization::OnGraphicMode ( wxCommandEvent &  event)
private

Definition at line 2755 of file Equalization.cpp.

2756{
2757 mDrawMode = false;
2758 UpdateGraphic();
2759}

References mDrawMode, and UpdateGraphic().

Here is the call graph for this function:

◆ OnGridOnOff()

void EffectEqualization::OnGridOnOff ( wxCommandEvent &  event)
private

Definition at line 2903 of file Equalization.cpp.

2904{
2905 mDrawGrid = mGridOnOff->IsChecked();
2906 mPanel->Refresh(false);
2907}
wxCheckBox * mGridOnOff
Definition: Equalization.h:272

References mDrawGrid, mGridOnOff, and mPanel.

◆ OnInterp()

void EffectEqualization::OnInterp ( wxCommandEvent &  event)
private

Definition at line 2738 of file Equalization.cpp.

2739{
2740 bool bIsGraphic = !mDrawMode;
2741 if (bIsGraphic)
2742 {
2743 GraphicEQ(mLogEnvelope.get());
2745 }
2746 mInterp = mInterpChoice->GetSelection();
2747}
wxChoice * mInterpChoice
Definition: Equalization.h:273

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

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

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

Here is the call graph for this function:

◆ OnLinFreq()

void EffectEqualization::OnLinFreq ( wxCommandEvent &  event)
private

Definition at line 2909 of file Equalization.cpp.

2910{
2911 mLin = mLinFreq->IsChecked();
2912 if(IsLinear()) //going from log to lin freq scale
2913 {
2914 mFreqRuler->ruler.SetLog(false);
2916 EnvLogToLin();
2917 mEnvelope = mLinEnvelope.get();
2918 mLin = true;
2919 }
2920 else //going from lin to log freq scale
2921 {
2922 mFreqRuler->ruler.SetLog(true);
2924 EnvLinToLog();
2925 mEnvelope = mLogEnvelope.get();
2926 mLin = false;
2927 }
2928 mFreqRuler->Refresh(false);
2929 ForceRecalc();
2930}
wxCheckBox * mLinFreq
Definition: Equalization.h:271
RulerPanel * mFreqRuler
Definition: Equalization.h:232
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 2818 of file Equalization.cpp.

2819{
2820 EditCurvesDialog d(mUIParent, this, mCurve->GetSelection());
2821 d.ShowModal();
2822
2823 // Reload the curve names
2824 UpdateCurves();
2825
2826 // Allow control to resize
2827 mUIParent->Layout();
2828}
wxWindow * mUIParent
Definition: Effect.h:307

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

Here is the call graph for this function:

◆ OnSize()

void EffectEqualization::OnSize ( wxSizeEvent &  event)
private

Definition at line 2694 of file Equalization.cpp.

2695{
2696 mUIParent->Layout();
2697 event.Skip();
2698}

References Effect::mUIParent.

◆ OnSlider()

void EffectEqualization::OnSlider ( wxCommandEvent &  event)
private

Definition at line 2700 of file Equalization.cpp.

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

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

Here is the call graph for this function:

◆ OnSliderDBMAX()

void EffectEqualization::OnSliderDBMAX ( wxCommandEvent &  event)
private

Definition at line 2791 of file Equalization.cpp.

2792{
2793 float dB = mdBMaxSlider->GetValue();
2794 if (dB != mdBMax) {
2795 mdBMax = dB;
2796 wxString tip;
2797 tip.Printf(_("%d dB"), (int)mdBMax);
2798 mdBMaxSlider->SetToolTip(tip);
2799 UpdateRuler();
2800 }
2801}
wxSlider * mdBMaxSlider
Definition: Equalization.h:279

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

Here is the call graph for this function:

◆ OnSliderDBMIN()

void EffectEqualization::OnSliderDBMIN ( wxCommandEvent &  event)
private

Definition at line 2779 of file Equalization.cpp.

2780{
2781 float dB = mdBMinSlider->GetValue();
2782 if (dB != mdBMin) {
2783 mdBMin = dB;
2784 wxString tip;
2785 tip.Printf(_("%d dB"), (int)mdBMin);
2786 mdBMinSlider->SetToolTip(tip);
2787 UpdateRuler();
2788 }
2789}
wxSlider * mdBMinSlider
Definition: Equalization.h:278

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

Here is the call graph for this function:

◆ OnSliderM()

void EffectEqualization::OnSliderM ( wxCommandEvent &  event)
private

Definition at line 2761 of file Equalization.cpp.

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

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

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:308
EffectEqualization(int Options=kEqLegacy)
static constexpr EffectParameter FilterLength
Definition: Equalization.h:304
static constexpr EnumParameter InterpMeth
Definition: Equalization.h:310
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,
const EffectOutputs pOutputs 
)
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 691 of file Equalization.cpp.

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

642{
643#ifdef EXPERIMENTAL_EQ_SSE_THREADED
644 if(mEffectEqualization48x) {
645 if(mBench) {
646 mBench=false;
647 return mEffectEqualization48x->Benchmark(this);
648 }
649 else
650 return mEffectEqualization48x->Process(this);
651 }
652#endif
653 this->CopyInputTracks(); // Set up mOutputTracks.
654 CalcFilter();
655 bool bGoodResult = true;
656
657 int count = 0;
658 for( auto track : mOutputTracks->Selected< WaveTrack >() ) {
659 double trackStart = track->GetStartTime();
660 double trackEnd = track->GetEndTime();
661 double t0 = mT0 < trackStart? trackStart: mT0;
662 double t1 = mT1 > trackEnd? trackEnd: mT1;
663
664 if (t1 > t0) {
665 auto start = track->TimeToLongSamples(t0);
666 auto end = track->TimeToLongSamples(t1);
667 auto len = end - start;
668
669 if (!ProcessOne(count, track, start, len))
670 {
671 bGoodResult = false;
672 break;
673 }
674 }
675
676 count++;
677 }
678
679 this->ReplaceProcessedTracks(bGoodResult);
680 return bGoodResult;
681}
double mT1
Definition: EffectBase.h:109
std::shared_ptr< TrackList > mOutputTracks
Definition: EffectBase.h:107
double mT0
Definition: EffectBase.h:108
void ReplaceProcessedTracks(const bool bGoodResult)
Definition: EffectBase.cpp:240
bool ProcessOne(int count, WaveTrack *t, sampleCount start, sampleCount len)
void CopyInputTracks(bool allSyncLockSelected=false)
Definition: Effect.cpp:733
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 1180 of file Equalization.cpp.

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

1715{
1716 wxFileName fn;
1717 if( fileName.empty() )
1718 {
1719 // Construct default curve filename
1720 //
1721 // LLL: Wouldn't you know that as of WX 2.6.2, there is a conflict
1722 // between wxStandardPaths and wxConfig under Linux. The latter
1723 // creates a normal file as "$HOME/.audacity", while the former
1724 // expects the ".audacity" portion to be a directory.
1725 fn = wxFileName( FileNames::DataDir(), wxT("EQCurves.xml") );
1726
1727 // If the directory doesn't exist...
1728 if( !fn.DirExists() )
1729 {
1730 // Attempt to create it
1731 if( !fn.Mkdir( fn.GetPath(), 511, wxPATH_MKDIR_FULL ) )
1732 {
1733 // MkDir() will emit message
1734 return;
1735 }
1736 }
1737 }
1738 else
1739 fn = fileName;
1740
1741 GuardedCall( [&] {
1742 // Create/Open the file
1743 const wxString fullPath{ fn.GetFullPath() };
1744 XMLFileWriter eqFile{ fullPath, XO("Error Saving Equalization Curves") };
1745
1746 // Write the curves
1747 WriteXML( eqFile );
1748
1749 eqFile.Commit();
1750 } );
1751}
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:85

References FileNames::DataDir(), fn, GuardedCall(), WriteXML(), wxT(), 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 1943 of file Equalization.cpp.

1944{
1945 // Set current choice
1946 if (mCurve)
1947 {
1948 mCurve->SetSelection( curve );
1949 mCurveName = mCurves[ curve ].Name;
1950 }
1951}

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

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

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

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

1918{
1919 setCurve((int) mCurves.size() - 1);
1920}

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

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

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

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

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

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

Here is the call graph for this function:

◆ UpdateCurves()

void EffectEqualization::UpdateCurves ( )
private

Definition at line 2225 of file Equalization.cpp.

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

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

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

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

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

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

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

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

1162{
1163 // Refresh ruler when values have changed
1164 int w1, w2, h;
1165 mdBRuler->ruler.GetMaxSize(&w1, &h);
1167 mdBRuler->ruler.GetMaxSize(&w2, &h);
1168 if( w1 != w2 ) // Reduces flicker
1169 {
1170 mdBRuler->SetSize(wxSize(w2,h));
1171 mFreqRuler->Refresh(false);
1172 }
1173 mdBRuler->Refresh(false);
1174
1175 mPanel->Refresh(false);
1176}
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(), OnSliderDBMIN(), and TransferDataToWindow().

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

525{
526 // If editing a macro, we don't want to be using the unnamed curve so
527 // we offer to save it.
528
529 if (mDisallowCustom && mCurveName == wxT("unnamed"))
530 {
531 // PRL: This is unreachable. mDisallowCustom is always false.
532
534 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."),
535 wxOK | wxCENTRE,
536 XO("Filter Curve EQ needs a different name") );
537 return false;
538 }
539
540 // Update unnamed curve (so it's there for next time)
541 //(done in a hurry, may not be the neatest -MJS)
542 if (mDirty && !mDrawMode)
543 {
544 size_t numPoints = mLogEnvelope->GetNumberOfPoints();
545 Doubles when{ numPoints };
546 Doubles value{ numPoints };
547 mLogEnvelope->GetPoints(when.get(), value.get(), numPoints);
548 for (size_t i = 0, j = 0; j + 2 < numPoints; i++, j++)
549 {
550 if ((value[i] < value[i + 1] + .05) && (value[i] > value[i + 1] - .05) &&
551 (value[i + 1] < value[i + 2] + .05) && (value[i + 1] > value[i + 2] - .05))
552 { // within < 0.05 dB?
553 mLogEnvelope->Delete(j + 1);
554 numPoints--;
555 j--;
556 }
557 }
558 Select((int) mCurves.size() - 1);
559 }
560 SaveCurves();
561
562 // TODO: just visit these effect settings the default way
564 CurrentSettingsGroup(), wxT("dBMin"), mdBMin);
566 CurrentSettingsGroup(), wxT("dBMax"), mdBMax);
568 CurrentSettingsGroup(), wxT("DrawMode"), mDrawMode);
570 CurrentSettingsGroup(), wxT("DrawGrid"), mDrawGrid);
571
572 return true;
573}
const RegistryPath & CurrentSettingsGroup()
Component of a configuration key path, for last-used destructive settings.
const EffectSettingsManager & GetDefinition() const override
Definition: Effect.cpp:448
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(), wxT(), 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:210
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 2183 of file Equalization.cpp.

2185{
2186 // Start our hierarchy
2187 xmlFile.StartTag( wxT( "equalizationeffect" ) );
2188
2189 // Write all curves
2190 int numCurves = mCurves.size();
2191 int curve;
2192 for( curve = 0; curve < numCurves; curve++ )
2193 {
2194 // Start a NEW curve
2195 xmlFile.StartTag( wxT( "curve" ) );
2196 xmlFile.WriteAttr( wxT( "name" ), mCurves[ curve ].Name );
2197
2198 // Write all points
2199 int numPoints = mCurves[ curve ].points.size();
2200 int point;
2201 for( point = 0; point < numPoints; point++ )
2202 {
2203 // Write NEW point
2204 xmlFile.StartTag( wxT( "point" ) );
2205 xmlFile.WriteAttr( wxT( "f" ), mCurves[ curve ].points[ point ].Freq, 12 );
2206 xmlFile.WriteAttr( wxT( "d" ), mCurves[ curve ].points[ point ].dB, 12 );
2207 xmlFile.EndTag( wxT( "point" ) );
2208 }
2209
2210 // Terminate curve
2211 xmlFile.EndTag( wxT( "curve" ) );
2212 }
2213
2214 // Terminate our hierarchy
2215 xmlFile.EndTag( wxT( "equalizationeffect" ) );
2216}
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

References wxT().

Referenced by SaveCurves().

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

Friends And Related Function Documentation

◆ EditCurvesDialog

friend class EditCurvesDialog
friend

Definition at line 292 of file Equalization.h.

◆ EqualizationPanel

friend class EqualizationPanel
friend

Definition at line 291 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 306 of file Equalization.h.

◆ dBMax

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

Definition at line 318 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 316 of file Equalization.h.

Referenced by DoLoadFactoryDefaults().

◆ DrawGrid

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

Definition at line 314 of file Equalization.h.

Referenced by DoLoadFactoryDefaults().

◆ DrawMode

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

Definition at line 312 of file Equalization.h.

Referenced by DoLoadFactoryDefaults().

◆ FilterLength

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

Definition at line 304 of file Equalization.h.

Referenced by Parameters().

◆ hFFT

HFFT EffectEqualization::hFFT
private

Definition at line 217 of file Equalization.h.

Referenced by Filter().

◆ InterpLin

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

Definition at line 308 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 310 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 301 of file Equalization.h.

Referenced by PopulateOrExchange().

◆ mBandsInUse

size_t EffectEqualization::mBandsInUse
private

Definition at line 230 of file Equalization.h.

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

◆ mCurve

wxChoice* EffectEqualization::mCurve
private

Definition at line 274 of file Equalization.h.

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

◆ mCurveName

wxString EffectEqualization::mCurveName
private

Definition at line 220 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 279 of file Equalization.h.

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

◆ mdBMin

float EffectEqualization::mdBMin
private

◆ mdBMinSlider

wxSlider* EffectEqualization::mdBMinSlider
private

Definition at line 278 of file Equalization.h.

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

◆ mdBRuler

RulerPanel* EffectEqualization::mdBRuler
private

Definition at line 231 of file Equalization.h.

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

◆ mDirty

bool EffectEqualization::mDirty
private

Definition at line 238 of file Equalization.h.

Referenced by EnvelopeUpdated(), and ValidateUI().

◆ mDisallowCustom

bool EffectEqualization::mDisallowCustom
private

Definition at line 234 of file Equalization.h.

Referenced by ValidateUI().

◆ mDraw

wxRadioButton* EffectEqualization::mDraw
private

Definition at line 269 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 218 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 270 of file Equalization.h.

Referenced by PopulateOrExchange(), and TransferDataToWindow().

◆ mGridOnOff

wxCheckBox* EffectEqualization::mGridOnOff
private

Definition at line 272 of file Equalization.h.

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

◆ mHiFreq

double EffectEqualization::mHiFreq
private

◆ mInterp

int EffectEqualization::mInterp
private

Definition at line 225 of file Equalization.h.

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

◆ mInterpChoice

wxChoice* EffectEqualization::mInterpChoice
private

Definition at line 273 of file Equalization.h.

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

◆ mLeftSpacer

wxSizerItem* EffectEqualization::mLeftSpacer
private

Definition at line 265 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 271 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 275 of file Equalization.h.

◆ mMSlider

wxSlider* EffectEqualization::mMSlider
private

Definition at line 277 of file Equalization.h.

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

◆ mMText

wxStaticText* EffectEqualization::mMText
private

Definition at line 276 of file Equalization.h.

Referenced by OnSliderM(), and PopulateOrExchange().

◆ mOptions

int EffectEqualization::mOptions
private

◆ mPanel

EqualizationPanel* EffectEqualization::mPanel
private

Definition at line 267 of file Equalization.h.

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

◆ mSliders

wxSlider* EffectEqualization::mSliders[NUMBER_OF_BANDS]
private

Definition at line 280 of file Equalization.h.

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

◆ mSlidersOld

int EffectEqualization::mSlidersOld[NUMBER_OF_BANDS]
private

Definition at line 239 of file Equalization.h.

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

◆ mWhens

double EffectEqualization::mWhens[NUM_PTS]
private

Definition at line 228 of file Equalization.h.

Referenced by ErrMin(), and GraphicEQ().

◆ mWhenSliders

double EffectEqualization::mWhenSliders[NUMBER_OF_BANDS+1]
private

Definition at line 229 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 259 of file Equalization.h.

Referenced by PopulateOrExchange(), and TransferDataToWindow().

◆ szr2

wxSizer* EffectEqualization::szr2
private

Definition at line 260 of file Equalization.h.

◆ szr3

wxSizer* EffectEqualization::szr3
private

Definition at line 261 of file Equalization.h.

◆ szr4

wxSizer* EffectEqualization::szr4
private

Definition at line 262 of file Equalization.h.

◆ szr5

wxSizer* EffectEqualization::szr5
private

Definition at line 263 of file Equalization.h.

◆ szrC

wxSizer* EffectEqualization::szrC
private

Definition at line 253 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 151 of file Equalization.h.

Referenced by ProcessOne().


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