Audacity  2.2.0
EffectDistortion Class Referencefinal

A WaveShaper distortion effect. More...

#include <Distortion.h>

Inheritance diagram for EffectDistortion:
Effect

Classes

struct  Params
 

Public Member Functions

 EffectDistortion ()
 
virtual ~EffectDistortion ()
 
wxString GetSymbol () override
 
wxString GetDescription () override
 
wxString ManualPage () override
 
EffectType GetType () override
 
bool SupportsRealtime () override
 
unsigned GetAudioInCount () override
 
unsigned GetAudioOutCount () override
 
bool ProcessInitialize (sampleCount totalLen, ChannelNames chanMap=NULL) override
 
size_t ProcessBlock (float **inBlock, float **outBlock, size_t blockLen) override
 
bool RealtimeInitialize () override
 
bool RealtimeAddProcessor (unsigned numChannels, float sampleRate) override
 
bool RealtimeFinalize () override
 
size_t RealtimeProcess (int group, float **inbuf, float **outbuf, size_t numSamples) override
 
bool GetAutomationParameters (EffectAutomationParameters &parms) override
 
bool SetAutomationParameters (EffectAutomationParameters &parms) override
 
wxArrayString GetFactoryPresets () override
 
bool LoadFactoryPreset (int id) override
 
void PopulateOrExchange (ShuttleGui &S) override
 
bool TransferDataToWindow () override
 
bool TransferDataFromWindow () override
 
- Public Member Functions inherited from Effect
 Effect ()
 
virtual ~Effect ()
 
wxString GetPath () override
 
wxString GetSymbol () override
 
wxString GetName () override
 
wxString GetVendor () override
 
wxString GetVersion () override
 
wxString GetDescription () override
 
EffectType GetType () override
 
wxString GetFamily () override
 
bool IsInteractive () override
 
bool IsDefault () override
 
bool IsLegacy () override
 
bool SupportsRealtime () override
 
bool SupportsAutomation () override
 
bool SetHost (EffectHostInterface *host) override
 
unsigned GetAudioInCount () override
 
unsigned GetAudioOutCount () override
 
int GetMidiInCount () override
 
int GetMidiOutCount () override
 
sampleCount GetLatency () override
 
size_t GetTailSize () override
 
void SetSampleRate (double rate) override
 
size_t SetBlockSize (size_t maxBlockSize) override
 
bool IsReady () override
 
bool ProcessInitialize (sampleCount totalLen, ChannelNames chanMap=NULL) override
 
bool ProcessFinalize () override
 
size_t ProcessBlock (float **inBlock, float **outBlock, size_t blockLen) override
 
bool RealtimeInitialize () override
 
bool RealtimeAddProcessor (unsigned numChannels, float sampleRate) override
 
bool RealtimeFinalize () override
 
bool RealtimeSuspend () override
 
bool RealtimeResume () override
 
bool RealtimeProcessStart () override
 
size_t RealtimeProcess (int group, float **inbuf, float **outbuf, size_t numSamples) override
 
bool RealtimeProcessEnd () override
 
bool ShowInterface (wxWindow *parent, bool forceModal=false) override
 
bool GetAutomationParameters (EffectAutomationParameters &parms) override
 
bool SetAutomationParameters (EffectAutomationParameters &parms) override
 
bool LoadUserPreset (const wxString &name) override
 
bool SaveUserPreset (const wxString &name) override
 
wxArrayString GetFactoryPresets () override
 
bool LoadFactoryPreset (int id) override
 
bool LoadFactoryDefaults () override
 
void SetHostUI (EffectUIHostInterface *host) override
 
bool PopulateUI (wxWindow *parent) override
 
bool IsGraphicalUI () override
 
bool ValidateUI () override
 
bool HideUI () override
 
bool CloseUI () override
 
bool CanExportPresets () override
 
void ExportPresets () override
 
void ImportPresets () override
 
bool HasOptions () override
 
void ShowOptions () override
 
double GetDefaultDuration () override
 
double GetDuration () override
 
wxString GetDurationFormat () override
 
virtual wxString GetSelectionFormat ()
 
void SetDuration (double duration) override
 
bool Apply () override
 
void Preview () override
 
wxDialog * CreateUI (wxWindow *parent, EffectUIClientInterface *client) override
 
wxString GetUserPresetsGroup (const wxString &name) override
 
wxString GetCurrentSettingsGroup () override
 
wxString GetFactoryDefaultsGroup () override
 
virtual wxString GetSavedStateGroup ()
 
bool HasSharedConfigGroup (const wxString &group) override
 
bool GetSharedConfigSubgroups (const wxString &group, wxArrayString &subgroups) override
 
bool GetSharedConfig (const wxString &group, const wxString &key, wxString &value, const wxString &defval=wxEmptyString) override
 
bool GetSharedConfig (const wxString &group, const wxString &key, int &value, int defval=0) override
 
bool GetSharedConfig (const wxString &group, const wxString &key, bool &value, bool defval=false) override
 
bool GetSharedConfig (const wxString &group, const wxString &key, float &value, float defval=0.0) override
 
bool GetSharedConfig (const wxString &group, const wxString &key, double &value, double defval=0.0) override
 
bool SetSharedConfig (const wxString &group, const wxString &key, const wxString &value) override
 
bool SetSharedConfig (const wxString &group, const wxString &key, const int &value) override
 
bool SetSharedConfig (const wxString &group, const wxString &key, const bool &value) override
 
bool SetSharedConfig (const wxString &group, const wxString &key, const float &value) override
 
bool SetSharedConfig (const wxString &group, const wxString &key, const double &value) override
 
bool RemoveSharedConfigSubgroup (const wxString &group) override
 
bool RemoveSharedConfig (const wxString &group, const wxString &key) override
 
bool HasPrivateConfigGroup (const wxString &group) override
 
bool GetPrivateConfigSubgroups (const wxString &group, wxArrayString &subgroups) override
 
bool GetPrivateConfig (const wxString &group, const wxString &key, wxString &value, const wxString &defval=wxEmptyString) override
 
bool GetPrivateConfig (const wxString &group, const wxString &key, int &value, int defval=0) override
 
bool GetPrivateConfig (const wxString &group, const wxString &key, bool &value, bool defval=false) override
 
bool GetPrivateConfig (const wxString &group, const wxString &key, float &value, float defval=0.0) override
 
bool GetPrivateConfig (const wxString &group, const wxString &key, double &value, double defval=0.0) override
 
bool SetPrivateConfig (const wxString &group, const wxString &key, const wxString &value) override
 
bool SetPrivateConfig (const wxString &group, const wxString &key, const int &value) override
 
bool SetPrivateConfig (const wxString &group, const wxString &key, const bool &value) override
 
bool SetPrivateConfig (const wxString &group, const wxString &key, const float &value) override
 
bool SetPrivateConfig (const wxString &group, const wxString &key, const double &value) override
 
bool RemovePrivateConfigSubgroup (const wxString &group) override
 
bool RemovePrivateConfig (const wxString &group, const wxString &key) override
 
virtual PluginID GetID ()
 
virtual bool Startup (EffectClientInterface *client)
 
virtual bool Startup ()
 
virtual bool GetAutomationParameters (wxString &parms)
 
virtual bool SetAutomationParameters (const wxString &parms)
 
virtual wxArrayString GetUserPresets ()
 
virtual bool HasCurrentSettings ()
 
virtual bool HasFactoryDefaults ()
 
virtual wxString GetPreset (wxWindow *parent, const wxString &parms)
 
virtual wxString HelpPage ()
 
virtual bool IsBatchProcessing ()
 
virtual void SetBatchProcessing (bool start)
 
void SetPresetParameters (const wxArrayString *Names, const wxArrayString *Values)
 
bool DoEffect (wxWindow *parent, double projectRate, TrackList *list, TrackFactory *factory, SelectedRegion *selectedRegion, bool shouldPrompt=true)
 
bool Delegate (Effect &delegate, wxWindow *parent, SelectedRegion *selectedRegion, bool shouldPrompt)
 
bool RealtimeAddProcessor (int group, unsigned chans, float rate)
 
size_t RealtimeProcess (int group, unsigned chans, float **inbuf, float **outbuf, size_t numSamples)
 
bool IsRealtimeActive ()
 
virtual bool IsHidden ()
 
int MessageBox (const wxString &message, long style=DefaultMessageBoxStyle, const wxString &titleStr=wxString{})
 

Private Types

enum  control {
  ID_Type = 10000, ID_DCBlock, ID_Threshold, ID_NoiseFloor,
  ID_Param1, ID_Param2, ID_Repeats
}
 

Private Member Functions

void InstanceInit (EffectDistortionState &data, float sampleRate)
 
size_t InstanceProcess (EffectDistortionState &data, float **inBlock, float **outBlock, size_t blockLen)
 
void OnTypeChoice (wxCommandEvent &evt)
 
void OnDCBlockCheckbox (wxCommandEvent &evt)
 
void OnThresholdText (wxCommandEvent &evt)
 
void OnThresholdSlider (wxCommandEvent &evt)
 
void OnNoiseFloorText (wxCommandEvent &evt)
 
void OnNoiseFloorSlider (wxCommandEvent &evt)
 
void OnParam1Text (wxCommandEvent &evt)
 
void OnParam1Slider (wxCommandEvent &evt)
 
void OnParam2Text (wxCommandEvent &evt)
 
void OnParam2Slider (wxCommandEvent &evt)
 
void OnRepeatsText (wxCommandEvent &evt)
 
void OnRepeatsSlider (wxCommandEvent &evt)
 
void UpdateUI ()
 
void UpdateControl (control id, bool enable, wxString name)
 
void UpdateControlText (wxTextCtrl *textCtrl, wxString &string, bool enabled)
 
void MakeTable ()
 
float WaveShaper (float sample)
 
float DCFilter (EffectDistortionState &data, float sample)
 
void HardClip ()
 
void SoftClip ()
 
void ExponentialTable ()
 
void LogarithmicTable ()
 
void HalfSinTable ()
 
void CubicTable ()
 
void EvenHarmonicTable ()
 
void SineTable ()
 
void Leveller ()
 
void Rectifier ()
 
void HardLimiter ()
 
void CopyHalfTable ()
 
float LogCurve (double threshold, float value, double ratio)
 
double Cubic (double x)
 

Private Attributes

EffectDistortionState mMaster
 
EffectDistortionStateArray mSlaves
 
double mTable [TABLESIZE]
 
double mThreshold
 
bool mbSavedFilterState
 
double mMakeupGain
 
int mTypChoiceIndex
 
wxArrayString mTableTypes
 
wxChoice * mTypeChoiceCtrl
 
wxTextCtrl * mThresholdT
 
wxTextCtrl * mNoiseFloorT
 
wxTextCtrl * mParam1T
 
wxTextCtrl * mParam2T
 
wxTextCtrl * mRepeatsT
 
wxSlider * mThresholdS
 
wxSlider * mNoiseFloorS
 
wxSlider * mParam1S
 
wxSlider * mParam2S
 
wxSlider * mRepeatsS
 
wxCheckBox * mDCBlockCheckBox
 
wxStaticText * mThresholdTxt
 
wxStaticText * mNoiseFloorTxt
 
wxStaticText * mParam1Txt
 
wxStaticText * mParam2Txt
 
wxStaticText * mRepeatsTxt
 
wxString mOldThresholdTxt
 
wxString mOldmNoiseFloorTxt
 
wxString mOldParam1Txt
 
wxString mOldParam2Txt
 
wxString mOldRepeatsTxt
 
Params mParams
 

Additional Inherited Members

- Public Types inherited from Effect
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
- Protected Member Functions inherited from Effect
virtual bool Init ()
 
virtual bool PromptUser (wxWindow *parent)
 
virtual bool CheckWhetherSkipEffect ()
 
virtual bool Process ()
 
virtual bool ProcessPass ()
 
virtual bool InitPass1 ()
 
virtual bool InitPass2 ()
 
virtual int GetPass ()
 
virtual void End ()
 
virtual double CalcPreviewInputLength (double previewLength)
 
virtual void Preview (bool dryOnly)
 
virtual bool EnableApply (bool enable=true)
 
virtual bool EnablePreview (bool enable=true)
 
virtual void EnableDebug (bool enable=true)
 
bool TotalProgress (double frac)
 
bool TrackProgress (int whichTrack, double frac, const wxString &=wxEmptyString)
 
bool TrackGroupProgress (int whichGroup, double frac, const wxString &=wxEmptyString)
 
int GetNumWaveTracks ()
 
int GetNumWaveGroups ()
 
void GetSamples (const WaveTrack *track, sampleCount *start, sampleCount *len)
 
void SetLinearEffectFlag (bool linearEffectFlag)
 
void SetPreviewFullSelectionFlag (bool previewDurationFlag)
 
bool IsPreviewing ()
 
void IncludeNotSelectedPreviewTracks (bool includeNotSelected)
 
void CopyInputTracks ()
 
void CopyInputTracks (int trackType)
 
std::shared_ptr
< AddedAnalysisTrack
AddAnalysisTrack (const wxString &name=wxString())
 
ModifiedAnalysisTrack ModifyAnalysisTrack (const LabelTrack *pOrigTrack, const wxString &name=wxString())
 
void ReplaceProcessedTracks (const bool bGoodResult)
 
TrackAddToOutputTracks (std::unique_ptr< Track > &&t)
 
TrackListinputTracks () const
 
- Protected Attributes inherited from Effect
ProgressDialogmProgress
 
double mProjectRate
 
double mSampleRate
 
TrackFactorymFactory
 
std::shared_ptr< TrackListmOutputTracks
 
double mT0
 
double mT1
 
double mF0
 
double mF1
 
wxArrayString mPresetNames
 
wxArrayString mPresetValues
 
int mPass
 
wxDialog * mUIDialog
 
wxWindow * mUIParent
 
int mUIResultID
 
sampleCount mSampleCnt
 
int mOutputTracksType
 

Detailed Description

A WaveShaper distortion effect.

Member Enumeration Documentation

Enumerator
ID_Type 
ID_DCBlock 
ID_Threshold 
ID_NoiseFloor 
ID_Param1 
ID_Param2 
ID_Repeats 

Constructor & Destructor Documentation

EffectDistortion::EffectDistortion ( )
EffectDistortion::~EffectDistortion ( )
virtual

Member Function Documentation

void EffectDistortion::CopyHalfTable ( )
private
double EffectDistortion::Cubic ( double  x)
inlineprivate

References EffectDistortion::Params::mParam1, and mParams.

Referenced by CubicTable().

void EffectDistortion::CubicTable ( )
private
float EffectDistortion::DCFilter ( EffectDistortionState data,
float  sample 
)
private
void EffectDistortion::EvenHarmonicTable ( )
private
void EffectDistortion::ExponentialTable ( )
private
unsigned EffectDistortion::GetAudioInCount ( )
override
unsigned EffectDistortion::GetAudioOutCount ( )
override
wxString EffectDistortion::GetDescription ( )
override

References XO.

wxArrayString EffectDistortion::GetFactoryPresets ( )
override

References FactoryPresets, name, and names().

wxString EffectDistortion::GetSymbol ( )
override
EffectType EffectDistortion::GetType ( )
override
void EffectDistortion::HalfSinTable ( )
private
void EffectDistortion::HardClip ( )
private

References mMakeupGain, mTable, mThreshold, STEPS, and TABLESIZE.

Referenced by HardLimiter(), and MakeTable().

void EffectDistortion::HardLimiter ( )
private

References HardClip().

Referenced by MakeTable().

bool EffectDistortion::LoadFactoryPreset ( int  id)
override
void EffectDistortion::LogarithmicTable ( )
private
float EffectDistortion::LogCurve ( double  threshold,
float  value,
double  ratio 
)
inlineprivate

Referenced by SoftClip().

wxString EffectDistortion::ManualPage ( )
overridevirtual

Reimplemented from Effect.

void EffectDistortion::OnDCBlockCheckbox ( wxCommandEvent &  evt)
private
void EffectDistortion::OnNoiseFloorSlider ( wxCommandEvent &  evt)
private
void EffectDistortion::OnNoiseFloorText ( wxCommandEvent &  evt)
private
void EffectDistortion::OnParam1Slider ( wxCommandEvent &  evt)
private
void EffectDistortion::OnParam1Text ( wxCommandEvent &  evt)
private
void EffectDistortion::OnParam2Slider ( wxCommandEvent &  evt)
private
void EffectDistortion::OnParam2Text ( wxCommandEvent &  evt)
private
void EffectDistortion::OnRepeatsSlider ( wxCommandEvent &  evt)
private
void EffectDistortion::OnRepeatsText ( wxCommandEvent &  evt)
private
void EffectDistortion::OnThresholdSlider ( wxCommandEvent &  evt)
private
void EffectDistortion::OnThresholdText ( wxCommandEvent &  evt)
private
void EffectDistortion::OnTypeChoice ( wxCommandEvent &  evt)
private

References mTypeChoiceCtrl, and UpdateUI().

size_t EffectDistortion::ProcessBlock ( float **  inBlock,
float **  outBlock,
size_t  blockLen 
)
override

References InstanceProcess(), and mMaster.

bool EffectDistortion::ProcessInitialize ( sampleCount  totalLen,
ChannelNames  chanMap = NULL 
)
override
bool EffectDistortion::RealtimeAddProcessor ( unsigned  numChannels,
float  sampleRate 
)
override

References InstanceInit(), and mSlaves.

bool EffectDistortion::RealtimeFinalize ( )
override

References mSlaves.

bool EffectDistortion::RealtimeInitialize ( )
override

References mSlaves, and Effect::SetBlockSize().

size_t EffectDistortion::RealtimeProcess ( int  group,
float **  inbuf,
float **  outbuf,
size_t  numSamples 
)
override

References InstanceProcess(), and mSlaves.

void EffectDistortion::Rectifier ( )
private
void EffectDistortion::SineTable ( )
private
void EffectDistortion::SoftClip ( )
private
bool EffectDistortion::SupportsRealtime ( )
override
bool EffectDistortion::TransferDataFromWindow ( )
overridevirtual
void EffectDistortion::UpdateControlText ( wxTextCtrl *  textCtrl,
wxString &  string,
bool  enabled 
)
private

Referenced by UpdateUI().

float EffectDistortion::WaveShaper ( float  sample)
private

Member Data Documentation

bool EffectDistortion::mbSavedFilterState
private
wxCheckBox* EffectDistortion::mDCBlockCheckBox
private
double EffectDistortion::mMakeupGain
private

Referenced by HardClip(), InstanceProcess(), and SoftClip().

EffectDistortionState EffectDistortion::mMaster
private

Referenced by ProcessBlock(), and ProcessInitialize().

wxSlider* EffectDistortion::mNoiseFloorS
private
wxTextCtrl* EffectDistortion::mNoiseFloorT
private
wxStaticText* EffectDistortion::mNoiseFloorTxt
private
wxString EffectDistortion::mOldmNoiseFloorTxt
private

Referenced by UpdateUI().

wxString EffectDistortion::mOldParam1Txt
private

Referenced by UpdateUI().

wxString EffectDistortion::mOldParam2Txt
private

Referenced by UpdateUI().

wxString EffectDistortion::mOldRepeatsTxt
private

Referenced by UpdateUI().

wxString EffectDistortion::mOldThresholdTxt
private

Referenced by UpdateUI().

wxSlider* EffectDistortion::mParam1S
private
wxTextCtrl* EffectDistortion::mParam1T
private
wxStaticText* EffectDistortion::mParam1Txt
private
wxSlider* EffectDistortion::mParam2S
private
wxTextCtrl* EffectDistortion::mParam2T
private
wxStaticText* EffectDistortion::mParam2Txt
private
wxSlider* EffectDistortion::mRepeatsS
private
wxTextCtrl* EffectDistortion::mRepeatsT
private
wxStaticText* EffectDistortion::mRepeatsTxt
private
EffectDistortionStateArray EffectDistortion::mSlaves
private
wxArrayString EffectDistortion::mTableTypes
private

Referenced by PopulateOrExchange().

wxSlider* EffectDistortion::mThresholdS
private
wxTextCtrl* EffectDistortion::mThresholdT
private
wxStaticText* EffectDistortion::mThresholdTxt
private
int EffectDistortion::mTypChoiceIndex
private
wxChoice* EffectDistortion::mTypeChoiceCtrl
private

Referenced by OnTypeChoice(), and PopulateOrExchange().


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