Audacity  3.0.3
Public Member Functions | Static Public Attributes | Private Attributes | List of all members
EffectEcho Class Referencefinal

An Effect that causes an echo, variable delay and volume. More...

#include <Echo.h>

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

Public Member Functions

 EffectEcho ()
 
virtual ~EffectEcho ()
 
ComponentInterfaceSymbol GetSymbol () override
 
TranslatableString GetDescription () override
 
wxString ManualPage () override
 
EffectType GetType () override
 
unsigned GetAudioInCount () override
 
unsigned GetAudioOutCount () override
 
bool ProcessInitialize (sampleCount totalLen, ChannelNames chanMap=NULL) override
 
bool ProcessFinalize () override
 
size_t ProcessBlock (float **inBlock, float **outBlock, size_t blockLen) override
 
bool DefineParams (ShuttleParams &S) override
 
bool GetAutomationParameters (CommandParameters &parms) override
 
bool SetAutomationParameters (CommandParameters &parms) override
 
void PopulateOrExchange (ShuttleGui &S) override
 
bool TransferDataToWindow () override
 
bool TransferDataFromWindow () override
 
- Public Member Functions inherited from Effect
 Effect ()
 
virtual ~Effect ()
 
PluginPath GetPath () override
 
ComponentInterfaceSymbol GetSymbol () override
 
VendorSymbol GetVendor () override
 
wxString GetVersion () override
 
TranslatableString GetDescription () override
 
EffectType GetType () override
 
EffectFamilySymbol 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
 
size_t GetBlockSize () const 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, const EffectDialogFactory &factory, bool forceModal=false) override
 
bool GetAutomationParameters (CommandParameters &parms) override
 
bool SetAutomationParameters (CommandParameters &parms) override
 
bool LoadUserPreset (const RegistryPath &name) override
 
bool SaveUserPreset (const RegistryPath &name) override
 
RegistryPaths GetFactoryPresets () override
 
bool LoadFactoryPreset (int id) override
 
bool LoadFactoryDefaults () override
 
void SetHostUI (EffectUIHostInterface *host) override
 
bool PopulateUI (ShuttleGui &S) final
 
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
 
NumericFormatSymbol GetDurationFormat () override
 
virtual NumericFormatSymbol GetSelectionFormat ()
 
void SetDuration (double duration) override
 
RegistryPath GetUserPresetsGroup (const RegistryPath &name) override
 
RegistryPath GetCurrentSettingsGroup () override
 
RegistryPath GetFactoryDefaultsGroup () override
 
virtual wxString GetSavedStateGroup ()
 
bool HasSharedConfigGroup (const RegistryPath &group) override
 
bool GetSharedConfigSubgroups (const RegistryPath &group, RegistryPaths &subgroups) override
 
bool GetSharedConfig (const RegistryPath &group, const RegistryPath &key, wxString &value, const wxString &defval={}) override
 
bool GetSharedConfig (const RegistryPath &group, const RegistryPath &key, int &value, int defval=0) override
 
bool GetSharedConfig (const RegistryPath &group, const RegistryPath &key, bool &value, bool defval=false) override
 
bool GetSharedConfig (const RegistryPath &group, const RegistryPath &key, float &value, float defval=0.0) override
 
bool GetSharedConfig (const RegistryPath &group, const RegistryPath &key, double &value, double defval=0.0) override
 
bool SetSharedConfig (const RegistryPath &group, const RegistryPath &key, const wxString &value) override
 
bool SetSharedConfig (const RegistryPath &group, const RegistryPath &key, const int &value) override
 
bool SetSharedConfig (const RegistryPath &group, const RegistryPath &key, const bool &value) override
 
bool SetSharedConfig (const RegistryPath &group, const RegistryPath &key, const float &value) override
 
bool SetSharedConfig (const RegistryPath &group, const RegistryPath &key, const double &value) override
 
bool RemoveSharedConfigSubgroup (const RegistryPath &group) override
 
bool RemoveSharedConfig (const RegistryPath &group, const RegistryPath &key) override
 
bool HasPrivateConfigGroup (const RegistryPath &group) override
 
bool GetPrivateConfigSubgroups (const RegistryPath &group, RegistryPaths &paths) override
 
bool GetPrivateConfig (const RegistryPath &group, const RegistryPath &key, wxString &value, const wxString &defval={}) override
 
bool GetPrivateConfig (const RegistryPath &group, const RegistryPath &key, int &value, int defval=0) override
 
bool GetPrivateConfig (const RegistryPath &group, const RegistryPath &key, bool &value, bool defval=false) override
 
bool GetPrivateConfig (const RegistryPath &group, const RegistryPath &key, float &value, float defval=0.0) override
 
bool GetPrivateConfig (const RegistryPath &group, const RegistryPath &key, double &value, double defval=0.0) override
 
bool SetPrivateConfig (const RegistryPath &group, const RegistryPath &key, const wxString &value) override
 
bool SetPrivateConfig (const RegistryPath &group, const RegistryPath &key, const int &value) override
 
bool SetPrivateConfig (const RegistryPath &group, const RegistryPath &key, const bool &value) override
 
bool SetPrivateConfig (const RegistryPath &group, const RegistryPath &key, const float &value) override
 
bool SetPrivateConfig (const RegistryPath &group, const RegistryPath &key, const double &value) override
 
bool RemovePrivateConfigSubgroup (const RegistryPath &group) override
 
bool RemovePrivateConfig (const RegistryPath &group, const RegistryPath &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 RegistryPaths GetUserPresets ()
 
virtual bool HasCurrentSettings ()
 
virtual bool HasFactoryDefaults ()
 
virtual wxString HelpPage ()
 
virtual void SetUIFlags (unsigned flags)
 
virtual unsigned TestUIFlags (unsigned mask)
 
virtual bool IsBatchProcessing ()
 
virtual void SetBatchProcessing (bool start)
 
void SetPresetParameters (const wxArrayString *Names, const wxArrayString *Values)
 
bool DoEffect (double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, wxWindow *pParent=nullptr, const EffectDialogFactory &dialogFactory={})
 
bool Delegate (Effect &delegate, wxWindow &parent, const EffectDialogFactory &factory)
 
virtual bool IsHidden ()
 
int MessageBox (const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
 
- Public Member Functions inherited from EffectClientInterface
virtual ~EffectClientInterface ()
 
- Public Member Functions inherited from EffectDefinitionInterface
virtual ~EffectDefinitionInterface ()
 
virtual EffectType GetClassification ()
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
TranslatableString GetName ()
 
virtual bool DefineParams (ShuttleParams &WXUNUSED(S))
 
- Public Member Functions inherited from EffectUIClientInterface
virtual ~EffectUIClientInterface ()
 
- Public Member Functions inherited from EffectHostInterface
virtual ~EffectHostInterface ()
 
- Public Member Functions inherited from ConfigClientInterface
virtual ~ConfigClientInterface ()
 

Static Public Attributes

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

double delay
 
double decay
 
Floats history
 
size_t histPos
 
size_t histLen
 

Additional Inherited Members

- Public Types inherited from Effect
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
using VetoDialogHook = bool(*)(wxDialog *)
 
- Public Types inherited from EffectClientInterface
using EffectDialogFactory = std::function< wxDialog *(wxWindow &parent, EffectHostInterface *, EffectUIClientInterface *) >
 
- Static Public Member Functions inherited from Effect
static VetoDialogHook SetVetoDialogHook (VetoDialogHook hook)
 
static CommandID GetSquashedName (wxString name)
 
static void IncEffectCounter ()
 
- Protected Member Functions inherited from Effect
virtual bool Init ()
 
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, const TranslatableString &={})
 
bool TrackProgress (int whichTrack, double frac, const TranslatableString &={})
 
bool TrackGroupProgress (int whichGroup, double frac, const TranslatableString &={})
 
int GetNumWaveTracks ()
 
int GetNumWaveGroups ()
 
void GetBounds (const WaveTrack &track, const WaveTrack *pRight, sampleCount *start, sampleCount *len)
 
void SetLinearEffectFlag (bool linearEffectFlag)
 
void SetPreviewFullSelectionFlag (bool previewDurationFlag)
 
bool IsPreviewing ()
 
void IncludeNotSelectedPreviewTracks (bool includeNotSelected)
 
void CopyInputTracks (bool allSyncLockSelected=false)
 
std::shared_ptr< AddedAnalysisTrackAddAnalysisTrack (const wxString &name=wxString())
 
ModifiedAnalysisTrack ModifyAnalysisTrack (const LabelTrack *pOrigTrack, const wxString &name=wxString())
 
void ReplaceProcessedTracks (const bool bGoodResult)
 
TrackAddToOutputTracks (const std::shared_ptr< Track > &t)
 
const TrackListinputTracks () const
 
const AudacityProjectFindProject () const
 
- Protected Attributes inherited from Effect
ProgressDialogmProgress
 
double mProjectRate
 
double mSampleRate
 
wxWeakRef< NotifyingSelectedRegionmpSelectedRegion {}
 
WaveTrackFactorymFactory
 
std::shared_ptr< TrackListmOutputTracks
 
double mT0
 
double mT1
 
wxArrayString mPresetNames
 
wxArrayString mPresetValues
 
int mPass
 
wxDialog * mUIDialog
 
wxWindow * mUIParent
 
int mUIResultID
 
unsigned mUIFlags
 
sampleCount mSampleCnt
 
- Static Protected Attributes inherited from Effect
static int nEffectsDone =0
 

Detailed Description

An Effect that causes an echo, variable delay and volume.

Definition at line 19 of file Echo.h.

Constructor & Destructor Documentation

◆ EffectEcho()

EffectEcho::EffectEcho ( )

Definition at line 46 of file Echo.cpp.

47 {
48  delay = DEF_Delay;
49  decay = DEF_Decay;
50 
51  SetLinearEffectFlag(true);
52 }

References decay, delay, and Effect::SetLinearEffectFlag().

Here is the call graph for this function:

◆ ~EffectEcho()

EffectEcho::~EffectEcho ( )
virtual

Definition at line 54 of file Echo.cpp.

55 {
56 }

Member Function Documentation

◆ DefineParams()

bool EffectEcho::DefineParams ( ShuttleParams S)
override

Definition at line 144 of file Echo.cpp.

144  {
145  S.SHUTTLE_PARAM( delay, Delay );
146  S.SHUTTLE_PARAM( decay, Decay );
147  return true;
148 }

References decay, and delay.

◆ GetAudioInCount()

unsigned EffectEcho::GetAudioInCount ( )
overridevirtual

Implements EffectClientInterface.

Definition at line 84 of file Echo.cpp.

85 {
86  return 1;
87 }

◆ GetAudioOutCount()

unsigned EffectEcho::GetAudioOutCount ( )
overridevirtual

Implements EffectClientInterface.

Definition at line 89 of file Echo.cpp.

90 {
91  return 1;
92 }

◆ GetAutomationParameters()

bool EffectEcho::GetAutomationParameters ( CommandParameters parms)
overridevirtual

Implements EffectClientInterface.

Definition at line 151 of file Echo.cpp.

152 {
153  parms.WriteFloat(KEY_Delay, delay);
154  parms.WriteFloat(KEY_Decay, decay);
155 
156  return true;
157 }

References decay, delay, and CommandParameters::WriteFloat().

Here is the call graph for this function:

◆ GetDescription()

TranslatableString EffectEcho::GetDescription ( )
overridevirtual

Implements ComponentInterface.

Definition at line 65 of file Echo.cpp.

66 {
67  return XO("Repeats the selected audio again and again");
68 }

References XO.

◆ GetSymbol()

ComponentInterfaceSymbol EffectEcho::GetSymbol ( )
overridevirtual

Implements ComponentInterface.

Definition at line 60 of file Echo.cpp.

61 {
62  return Symbol;
63 }

References Symbol.

◆ GetType()

EffectType EffectEcho::GetType ( )
overridevirtual

Implements EffectDefinitionInterface.

Definition at line 77 of file Echo.cpp.

78 {
79  return EffectTypeProcess;
80 }

References EffectTypeProcess.

◆ ManualPage()

wxString EffectEcho::ManualPage ( )
overridevirtual

Reimplemented from Effect.

Definition at line 70 of file Echo.cpp.

71 {
72  return wxT("Echo");
73 }

◆ PopulateOrExchange()

void EffectEcho::PopulateOrExchange ( ShuttleGui S)
overridevirtual

Reimplemented from Effect.

Definition at line 170 of file Echo.cpp.

171 {
172  S.AddSpace(0, 5);
173 
174  S.StartMultiColumn(2, wxALIGN_CENTER);
175  {
176  S.Validator<FloatingPointValidator<double>>(
177  3, &delay, NumValidatorStyle::NO_TRAILING_ZEROES,
178  MIN_Delay, MAX_Delay
179  )
180  .AddTextBox(XXO("&Delay time (seconds):"), wxT(""), 10);
181 
182  S.Validator<FloatingPointValidator<double>>(
183  3, &decay, NumValidatorStyle::NO_TRAILING_ZEROES,
184  MIN_Decay, MAX_Decay)
185  .AddTextBox(XXO("D&ecay factor:"), wxT(""), 10);
186  }
187  S.EndMultiColumn();
188 }

References ShuttleGui::AddSpace(), decay, delay, ShuttleGuiBase::EndMultiColumn(), ShuttleGuiBase::StartMultiColumn(), ShuttleGui::Validator(), and XXO.

Here is the call graph for this function:

◆ ProcessBlock()

size_t EffectEcho::ProcessBlock ( float **  inBlock,
float **  outBlock,
size_t  blockLen 
)
overridevirtual

Implements EffectClientInterface.

Definition at line 127 of file Echo.cpp.

128 {
129  float *ibuf = inBlock[0];
130  float *obuf = outBlock[0];
131 
132  for (decltype(blockLen) i = 0; i < blockLen; i++, histPos++)
133  {
134  if (histPos == histLen)
135  {
136  histPos = 0;
137  }
138  history[histPos] = obuf[i] = ibuf[i] + history[histPos] * decay;
139  }
140 
141  return blockLen;
142 }

References decay, histLen, history, and histPos.

◆ ProcessFinalize()

bool EffectEcho::ProcessFinalize ( )
overridevirtual

Implements EffectClientInterface.

Definition at line 121 of file Echo.cpp.

122 {
123  history.reset();
124  return true;
125 }

References history.

◆ ProcessInitialize()

bool EffectEcho::ProcessInitialize ( sampleCount  totalLen,
ChannelNames  chanMap = NULL 
)
overridevirtual

Implements EffectClientInterface.

Definition at line 94 of file Echo.cpp.

95 {
96  if (delay == 0.0)
97  {
98  return false;
99  }
100 
101  histPos = 0;
102  auto requestedHistLen = (sampleCount) (mSampleRate * delay);
103 
104  // Guard against extreme delay values input by the user
105  try {
106  // Guard against huge delay values from the user.
107  // Don't violate the assertion in as_size_t
108  if (requestedHistLen !=
109  (histLen = static_cast<size_t>(requestedHistLen.as_long_long())))
110  throw std::bad_alloc{};
111  history.reinit(histLen, true);
112  }
113  catch ( const std::bad_alloc& ) {
114  Effect::MessageBox( XO("Requested value exceeds memory capacity.") );
115  return false;
116  }
117 
118  return history != NULL;
119 }

References delay, histLen, history, histPos, Effect::MessageBox(), Effect::mSampleRate, ArrayOf< X >::reinit(), and XO.

Here is the call graph for this function:

◆ SetAutomationParameters()

bool EffectEcho::SetAutomationParameters ( CommandParameters parms)
overridevirtual

Implements EffectClientInterface.

Definition at line 159 of file Echo.cpp.

160 {
161  ReadAndVerifyFloat(Delay);
162  ReadAndVerifyFloat(Decay);
163 
164  delay = Delay;
165  decay = Decay;
166 
167  return true;
168 }

References decay, delay, and ReadAndVerifyFloat.

◆ TransferDataFromWindow()

bool EffectEcho::TransferDataFromWindow ( )
overridevirtual

Reimplemented from Effect.

Definition at line 200 of file Echo.cpp.

201 {
202  if (!mUIParent->Validate() || !mUIParent->TransferDataFromWindow())
203  {
204  return false;
205  }
206 
207  return true;
208 }

References Effect::mUIParent.

◆ TransferDataToWindow()

bool EffectEcho::TransferDataToWindow ( )
overridevirtual

Reimplemented from Effect.

Definition at line 190 of file Echo.cpp.

191 {
192  if (!mUIParent->TransferDataToWindow())
193  {
194  return false;
195  }
196 
197  return true;
198 }

References Effect::mUIParent.

Member Data Documentation

◆ decay

double EffectEcho::decay
private

◆ delay

double EffectEcho::delay
private

◆ histLen

size_t EffectEcho::histLen
private

Definition at line 61 of file Echo.h.

Referenced by ProcessBlock(), and ProcessInitialize().

◆ history

Floats EffectEcho::history
private

Definition at line 59 of file Echo.h.

Referenced by ProcessBlock(), ProcessFinalize(), and ProcessInitialize().

◆ histPos

size_t EffectEcho::histPos
private

Definition at line 60 of file Echo.h.

Referenced by ProcessBlock(), and ProcessInitialize().

◆ Symbol

const ComponentInterfaceSymbol EffectEcho::Symbol { XO("Echo") }
static

Definition at line 22 of file Echo.h.

Referenced by GetSymbol().


The documentation for this class was generated from the following files:
EffectTypeProcess
@ EffectTypeProcess
Definition: EffectInterface.h:59
Effect::SetLinearEffectFlag
void SetLinearEffectFlag(bool linearEffectFlag)
Definition: Effect.cpp:2000
EffectEcho::Symbol
static const ComponentInterfaceSymbol Symbol
Definition: Echo.h:22
Effect::MessageBox
int MessageBox(const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
Definition: Effect.cpp:2478
EffectEcho::histLen
size_t histLen
Definition: Echo.h:61
EffectEcho::decay
double decay
Definition: Echo.h:58
ArrayOf::reinit
void reinit(Integral count, bool initialize=false)
Definition: MemoryX.h:56
EffectEcho::history
Floats history
Definition: Echo.h:59
ShuttleGui::AddSpace
wxSizerItem * AddSpace(int width, int height, int prop=0)
Definition: ShuttleGui.cpp:2421
XO
#define XO(s)
Definition: Internat.h:31
ShuttleGuiBase::EndMultiColumn
void EndMultiColumn()
Definition: ShuttleGui.cpp:1212
CommandParameters::WriteFloat
bool WriteFloat(const wxString &key, float f)
Definition: EffectAutomationParameters.h:157
XXO
#define XXO(s)
Definition: Internat.h:44
ShuttleGuiBase::StartMultiColumn
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
Definition: ShuttleGui.cpp:1203
ShuttleGui::Validator
ShuttleGui & Validator(const Factory &f)
Definition: ShuttleGui.h:672
Effect::mSampleRate
double mSampleRate
Definition: Effect.h:458
Effect::mUIParent
wxWindow * mUIParent
Definition: Effect.h:476
sampleCount
Definition: Types.h:66
EffectEcho::histPos
size_t histPos
Definition: Echo.h:60
EffectEcho::delay
double delay
Definition: Echo.h:57
ReadAndVerifyFloat
#define ReadAndVerifyFloat(name)
Definition: Effect.h:632