Audacity  3.2.0
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
 
ManualPageID ManualPage () override
 Name of a page in the Audacity alpha manual, default is empty. More...
 
EffectType GetType () override
 Type determines how it behaves. More...
 
bool GetAutomationParameters (CommandParameters &parms) override
 Save current settings into parms. More...
 
bool SetAutomationParameters (CommandParameters &parms) override
 Change settings to those stored in parms. More...
 
unsigned GetAudioInCount () override
 
unsigned GetAudioOutCount () override
 
bool ProcessInitialize (sampleCount totalLen, ChannelNames chanMap=NULL) override
 Called for destructive, non-realtime effect computation. More...
 
bool ProcessFinalize () override
 Called for destructive, non-realtime effect computation. More...
 
size_t ProcessBlock (float **inBlock, float **outBlock, size_t blockLen) override
 Called for destructive, non-realtime effect computation. More...
 
bool DefineParams (ShuttleParams &S) 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
 Type determines how it behaves. More...
 
EffectFamilySymbol GetFamily () override
 Report identifier and user-visible name of the effect protocol. More...
 
bool IsInteractive () override
 Whether the effect needs a dialog for entry of settings. More...
 
bool IsDefault () override
 Whether the effect sorts "above the line" in the menus. More...
 
bool IsLegacy () override
 
bool SupportsRealtime () override
 Whether the effect supports realtime previewing (while audio is playing). More...
 
bool SupportsAutomation () override
 Whether the effect can be used without the UI, in a macro. More...
 
bool GetAutomationParameters (CommandParameters &parms) override
 Save current settings into parms. More...
 
bool SetAutomationParameters (CommandParameters &parms) override
 Change settings to those stored in parms. More...
 
bool LoadUserPreset (const RegistryPath &name) override
 Change settings to a user-named preset. More...
 
bool SaveUserPreset (const RegistryPath &name) override
 Save current settings as a user-named preset. More...
 
RegistryPaths GetFactoryPresets () override
 Report names of factory presets. More...
 
bool LoadFactoryPreset (int id) override
 Change settings to the preset whose name is GetFactoryPresets()[id] More...
 
bool LoadFactoryDefaults () override
 Change settings back to "factory default". More...
 
bool SetHost (EffectHostInterface *host) override
 
unsigned GetAudioInCount () override
 
unsigned GetAudioOutCount () override
 
int GetMidiInCount () override
 
int GetMidiOutCount () override
 
sampleCount GetLatency () override
 Called for destructive, non-realtime effect computation. More...
 
size_t GetTailSize () override
 
void SetSampleRate (double rate) override
 
size_t SetBlockSize (size_t maxBlockSize) override
 
size_t GetBlockSize () const override
 
bool ProcessInitialize (sampleCount totalLen, ChannelNames chanMap=NULL) override
 Called for destructive, non-realtime effect computation. More...
 
bool ProcessFinalize () override
 Called for destructive, non-realtime effect computation. More...
 
size_t ProcessBlock (float **inBlock, float **outBlock, size_t blockLen) override
 Called for destructive, non-realtime effect computation. More...
 
bool RealtimeInitialize () override
 
bool RealtimeAddProcessor (unsigned numChannels, float sampleRate) override
 
bool RealtimeFinalize () override
 
bool RealtimeSuspend () override
 
bool RealtimeResume () noexcept override
 
bool RealtimeProcessStart () override
 
size_t RealtimeProcess (int group, float **inbuf, float **outbuf, size_t numSamples) override
 
bool RealtimeProcessEnd () noexcept override
 
int ShowClientInterface (wxWindow &parent, wxDialog &dialog, bool forceModal=false) override
 
bool PopulateUI (ShuttleGui &S) final
 Adds controls to a panel that is given as the parent window of S More...
 
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
 
EffectDefinitionInterfaceGetDefinition () 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 ()
 
int ShowHostInterface (wxWindow &parent, const EffectDialogFactory &factory, bool forceModal=false) override
 
unsigned TestUIFlags (unsigned mask)
 
void SetPresetParameters (const wxArrayString *Names, const wxArrayString *Values)
 
virtual bool Startup (EffectUIClientInterface *client)
 
virtual bool GetAutomationParametersAsString (wxString &parms)
 
virtual bool SetAutomationParametersFromString (const wxString &parms)
 
virtual bool IsBatchProcessing ()
 
virtual void SetBatchProcessing (bool start)
 
bool DoEffect (double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, wxWindow *pParent=nullptr, const EffectDialogFactory &dialogFactory={})
 
bool Delegate (Effect &delegate, wxWindow &parent, const EffectDialogFactory &factory)
 
int MessageBox (const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
 
virtual bool Startup ()
 
- Public Member Functions inherited from EffectUIClientInterface
virtual ~EffectUIClientInterface ()
 
- Public Member Functions inherited from EffectProcessor
virtual ~EffectProcessor ()
 
- Public Member Functions inherited from EffectDefinitionInterface
virtual ~EffectDefinitionInterface ()
 
virtual EffectType GetClassification ()
 Determines which menu it appears in; default same as GetType(). More...
 
virtual bool EnablesDebug ()
 Whether the effect dialog should have a Debug button; default, always false. More...
 
virtual FilePath HelpPage ()
 Fully qualified local help file name, default is empty. More...
 
virtual bool IsHiddenFromMenus ()
 Default is false. More...
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
TranslatableString GetName ()
 
virtual bool DefineParams (ShuttleParams &WXUNUSED(S))
 
- Public Member Functions inherited from EffectUIHostInterface
virtual ~EffectUIHostInterface ()
 
- Public Member Functions inherited from EffectHostInterface
virtual ~EffectHostInterface ()
 

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 }
 
- Static Public Member Functions inherited from Effect
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...
 
- Protected Member Functions inherited from Effect
bool EnableApply (bool enable=true)
 
bool EnablePreview (bool enable=true)
 
virtual bool Init ()
 
virtual bool CheckWhetherSkipEffect ()
 
virtual bool Process ()
 
virtual bool ProcessPass ()
 
virtual bool InitPass1 ()
 
virtual bool InitPass2 ()
 
virtual void End ()
 
virtual double CalcPreviewInputLength (double previewLength)
 
virtual void Preview (bool dryOnly)
 
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
BasicUI::ProgressDialogmProgress = nullptr
 
double mProjectRate
 
double mSampleRate
 
WaveTrackFactorymFactory
 
std::shared_ptr< TrackListmOutputTracks
 
double mT0
 
double mT1
 
wxArrayString mPresetNames
 
wxArrayString mPresetValues
 
int mPass
 
wxWeakRef< wxDialog > mHostUIDialog
 This smart pointer tracks the lifetime of the dialog. More...
 
wxWeakRef< wxDialog > mUIDialog
 This weak pointer may be the same as the above, or null. More...
 
wxWindow * mUIParent
 
unsigned mUIFlags { 0 }
 
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 21 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, delay, and S.

◆ GetAudioInCount()

unsigned EffectEcho::GetAudioInCount ( )
overridevirtual

Implements EffectProcessor.

Definition at line 84 of file Echo.cpp.

85 {
86  return 1;
87 }

◆ GetAudioOutCount()

unsigned EffectEcho::GetAudioOutCount ( )
overridevirtual

Implements EffectProcessor.

Definition at line 89 of file Echo.cpp.

90 {
91  return 1;
92 }

◆ GetAutomationParameters()

bool EffectEcho::GetAutomationParameters ( CommandParameters parms)
overridevirtual

Save current settings into parms.

Implements EffectDefinitionInterface.

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

Type determines how it behaves.

Implements EffectDefinitionInterface.

Definition at line 77 of file Echo.cpp.

78 {
79  return EffectTypeProcess;
80 }

References EffectTypeProcess.

◆ ManualPage()

ManualPageID EffectEcho::ManualPage ( )
overridevirtual

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

Reimplemented from EffectDefinitionInterface.

Definition at line 70 of file Echo.cpp.

71 {
72  return L"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 decay, delay, S, and XXO.

◆ ProcessBlock()

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

Called for destructive, non-realtime effect computation.

Implements EffectProcessor.

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

Called for destructive, non-realtime effect computation.

Implements EffectProcessor.

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

Called for destructive, non-realtime effect computation.

Implements EffectProcessor.

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

Change settings to those stored in parms.

Implements EffectDefinitionInterface.

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 63 of file Echo.h.

Referenced by ProcessBlock(), and ProcessInitialize().

◆ history

Floats EffectEcho::history
private

Definition at line 61 of file Echo.h.

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

◆ histPos

size_t EffectEcho::histPos
private

Definition at line 62 of file Echo.h.

Referenced by ProcessBlock(), and ProcessInitialize().

◆ Symbol

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

Definition at line 24 of file Echo.h.

Referenced by GetSymbol().


The documentation for this class was generated from the following files:
EffectTypeProcess
@ EffectTypeProcess
Definition: EffectInterface.h:56
Effect::SetLinearEffectFlag
void SetLinearEffectFlag(bool linearEffectFlag)
Definition: Effect.cpp:1764
S
#define S(N)
Definition: ToChars.cpp:64
EffectEcho::Symbol
static const ComponentInterfaceSymbol Symbol
Definition: Echo.h:24
Effect::MessageBox
int MessageBox(const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
Definition: Effect.cpp:2238
EffectEcho::histLen
size_t histLen
Definition: Echo.h:63
EffectEcho::decay
double decay
Definition: Echo.h:60
ArrayOf::reinit
void reinit(Integral count, bool initialize=false)
Definition: MemoryX.h:57
EffectEcho::history
Floats history
Definition: Echo.h:61
XO
#define XO(s)
Definition: Internat.h:31
CommandParameters::WriteFloat
bool WriteFloat(const wxString &key, float f)
Definition: EffectAutomationParameters.h:155
XXO
#define XXO(s)
Definition: Internat.h:44
Effect::mSampleRate
double mSampleRate
Definition: Effect.h:418
Effect::mUIParent
wxWindow * mUIParent
Definition: Effect.h:438
sampleCount
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:18
EffectEcho::histPos
size_t histPos
Definition: Echo.h:62
EffectEcho::delay
double delay
Definition: Echo.h:59
ReadAndVerifyFloat
#define ReadAndVerifyFloat(name)
Definition: Effect.h:593