Audacity  2.2.2
Public Member Functions | 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:
Effect EffectClientInterface EffectUIClientInterface EffectHostInterface EffectDefinitionInterface ConfigClientInterface IdentInterface ParamsInterface

Public Member Functions

 EffectEcho ()
 
virtual ~EffectEcho ()
 
IdentInterfaceSymbol GetSymbol () override
 
wxString 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 ()
 
wxString GetPath () override
 
IdentInterfaceSymbol GetSymbol () override
 
IdentInterfaceSymbol GetVendor () override
 
wxString GetVersion () override
 
wxString GetDescription () override
 
EffectType GetType () override
 
IdentInterfaceSymbol GetFamilyId () 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 (CommandParameters &parms) override
 
bool SetAutomationParameters (CommandParameters &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
 
NumericFormatId GetDurationFormat () override
 
virtual NumericFormatId 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, 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{})
 
- Public Member Functions inherited from EffectClientInterface
virtual ~EffectClientInterface ()
 
- Public Member Functions inherited from EffectDefinitionInterface
virtual ~EffectDefinitionInterface ()
 
- Public Member Functions inherited from IdentInterface
virtual ~IdentInterface ()
 
const wxString & GetTranslatedName ()
 
- Public Member Functions inherited from ParamsInterface
virtual ~ParamsInterface ()
 
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 ()
 

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 }
 
- 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
 
SelectedRegionmpSelectedRegion {}
 
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

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

Definition at line 26 of file Echo.h.

Constructor & Destructor Documentation

EffectEcho::EffectEcho ( )

Definition at line 41 of file Echo.cpp.

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

42 {
43  delay = DEF_Delay;
44  decay = DEF_Decay;
45 
46  SetLinearEffectFlag(true);
47 }
void SetLinearEffectFlag(bool linearEffectFlag)
Definition: Effect.cpp:1961
double delay
Definition: Echo.h:62
double decay
Definition: Echo.h:63
EffectEcho::~EffectEcho ( )
virtual

Definition at line 49 of file Echo.cpp.

50 {
51 }

Member Function Documentation

bool EffectEcho::DefineParams ( ShuttleParams S)
override

Definition at line 139 of file Echo.cpp.

References decay, and delay.

139  {
140  S.SHUTTLE_PARAM( delay, Delay );
141  S.SHUTTLE_PARAM( decay, Decay );
142  return true;
143 }
double delay
Definition: Echo.h:62
double decay
Definition: Echo.h:63
unsigned EffectEcho::GetAudioInCount ( )
overridevirtual

Implements EffectClientInterface.

Definition at line 79 of file Echo.cpp.

80 {
81  return 1;
82 }
unsigned EffectEcho::GetAudioOutCount ( )
overridevirtual

Implements EffectClientInterface.

Definition at line 84 of file Echo.cpp.

85 {
86  return 1;
87 }
bool EffectEcho::GetAutomationParameters ( CommandParameters parms)
overridevirtual

Implements EffectClientInterface.

Definition at line 146 of file Echo.cpp.

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

147 {
148  parms.WriteFloat(KEY_Delay, delay);
149  parms.WriteFloat(KEY_Decay, decay);
150 
151  return true;
152 }
bool WriteFloat(const wxString &key, float f)
double delay
Definition: Echo.h:62
double decay
Definition: Echo.h:63
wxString EffectEcho::GetDescription ( )
overridevirtual

Implements IdentInterface.

Definition at line 60 of file Echo.cpp.

References _().

61 {
62  return _("Repeats the selected audio again and again");
63 }
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
IdentInterfaceSymbol EffectEcho::GetSymbol ( )
overridevirtual

Implements IdentInterface.

Definition at line 55 of file Echo.cpp.

References ECHO_PLUGIN_SYMBOL.

56 {
57  return ECHO_PLUGIN_SYMBOL;
58 }
#define ECHO_PLUGIN_SYMBOL
Definition: Echo.h:24
EffectType EffectEcho::GetType ( )
overridevirtual

Implements EffectDefinitionInterface.

Definition at line 72 of file Echo.cpp.

References EffectTypeProcess.

73 {
74  return EffectTypeProcess;
75 }
wxString EffectEcho::ManualPage ( )
overridevirtual

Reimplemented from Effect.

Definition at line 65 of file Echo.cpp.

66 {
67  return wxT("Echo");
68 }
void EffectEcho::PopulateOrExchange ( ShuttleGui S)
overridevirtual

Reimplemented from Effect.

Definition at line 165 of file Echo.cpp.

References _(), ShuttleGui::AddSpace(), ShuttleGuiBase::AddTextBox(), decay, delay, ShuttleGuiBase::EndMultiColumn(), and ShuttleGuiBase::StartMultiColumn().

166 {
167  S.AddSpace(0, 5);
168 
169  S.StartMultiColumn(2, wxALIGN_CENTER);
170  {
171  FloatingPointValidator<double> vldDelay(3, &delay, NumValidatorStyle::NO_TRAILING_ZEROES);
172  vldDelay.SetRange(MIN_Delay, MAX_Delay);
173  S.AddTextBox(_("Delay time (seconds):"), wxT(""), 10)->SetValidator(vldDelay);
174 
175  FloatingPointValidator<double> vldDecay(3, &decay, NumValidatorStyle::NO_TRAILING_ZEROES);
176  vldDecay.SetRange(MIN_Decay, MAX_Decay);
177  S.AddTextBox(_("Decay factor:"), wxT(""), 10)->SetValidator(vldDecay);
178  }
179  S.EndMultiColumn();
180 }
void EndMultiColumn()
wxTextCtrl * AddTextBox(const wxString &Caption, const wxString &Value, const int nChars)
Definition: ShuttleGui.cpp:540
double delay
Definition: Echo.h:62
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
wxSizerItem * AddSpace(int width, int height)
double decay
Definition: Echo.h:63
size_t EffectEcho::ProcessBlock ( float **  inBlock,
float **  outBlock,
size_t  blockLen 
)
overridevirtual

Implements EffectClientInterface.

Definition at line 122 of file Echo.cpp.

References decay, histLen, history, and histPos.

123 {
124  float *ibuf = inBlock[0];
125  float *obuf = outBlock[0];
126 
127  for (decltype(blockLen) i = 0; i < blockLen; i++, histPos++)
128  {
129  if (histPos == histLen)
130  {
131  histPos = 0;
132  }
133  history[histPos] = obuf[i] = ibuf[i] + history[histPos] * decay;
134  }
135 
136  return blockLen;
137 }
Floats history
Definition: Echo.h:64
size_t histLen
Definition: Echo.h:66
size_t histPos
Definition: Echo.h:65
double decay
Definition: Echo.h:63
bool EffectEcho::ProcessFinalize ( )
overridevirtual

Implements EffectClientInterface.

Definition at line 116 of file Echo.cpp.

References history.

117 {
118  history.reset();
119  return true;
120 }
Floats history
Definition: Echo.h:64
bool EffectEcho::ProcessInitialize ( sampleCount  totalLen,
ChannelNames  chanMap = NULL 
)
overridevirtual

Implements EffectClientInterface.

Definition at line 89 of file Echo.cpp.

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

90 {
91  if (delay == 0.0)
92  {
93  return false;
94  }
95 
96  histPos = 0;
97  auto requestedHistLen = (sampleCount) (mSampleRate * delay);
98 
99  // Guard against extreme delay values input by the user
100  try {
101  // Guard against huge delay values from the user.
102  // Don't violate the assertion in as_size_t
103  if (requestedHistLen !=
104  (histLen = static_cast<size_t>(requestedHistLen.as_long_long())))
105  throw std::bad_alloc{};
106  history.reinit(histLen, true);
107  }
108  catch ( const std::bad_alloc& ) {
109  Effect::MessageBox(_("Requested value exceeds memory capacity."));
110  return false;
111  }
112 
113  return history != NULL;
114 }
int MessageBox(const wxString &message, long style=DefaultMessageBoxStyle, const wxString &titleStr=wxString{})
Definition: Effect.cpp:2646
void reinit(Integral count, bool initialize=false)
Definition: MemoryX.h:117
Floats history
Definition: Echo.h:64
size_t histLen
Definition: Echo.h:66
double mSampleRate
Definition: Effect.h:455
double delay
Definition: Echo.h:62
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
size_t histPos
Definition: Echo.h:65
bool EffectEcho::SetAutomationParameters ( CommandParameters parms)
overridevirtual

Implements EffectClientInterface.

Definition at line 154 of file Echo.cpp.

References decay, delay, and ReadAndVerifyFloat.

155 {
156  ReadAndVerifyFloat(Delay);
157  ReadAndVerifyFloat(Decay);
158 
159  delay = Delay;
160  decay = Decay;
161 
162  return true;
163 }
#define ReadAndVerifyFloat(name)
Definition: Effect.h:799
double delay
Definition: Echo.h:62
double decay
Definition: Echo.h:63
bool EffectEcho::TransferDataFromWindow ( )
overridevirtual

Reimplemented from Effect.

Definition at line 192 of file Echo.cpp.

References Effect::mUIParent.

193 {
194  if (!mUIParent->Validate() || !mUIParent->TransferDataFromWindow())
195  {
196  return false;
197  }
198 
199  return true;
200 }
wxWindow * mUIParent
Definition: Effect.h:472
bool EffectEcho::TransferDataToWindow ( )
overridevirtual

Reimplemented from Effect.

Definition at line 182 of file Echo.cpp.

References Effect::mUIParent.

183 {
184  if (!mUIParent->TransferDataToWindow())
185  {
186  return false;
187  }
188 
189  return true;
190 }
wxWindow * mUIParent
Definition: Effect.h:472

Member Data Documentation

double EffectEcho::decay
private
double EffectEcho::delay
private
size_t EffectEcho::histLen
private

Definition at line 66 of file Echo.h.

Referenced by ProcessBlock(), and ProcessInitialize().

Floats EffectEcho::history
private

Definition at line 64 of file Echo.h.

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

size_t EffectEcho::histPos
private

Definition at line 65 of file Echo.h.

Referenced by ProcessBlock(), and ProcessInitialize().


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