Audacity  3.2.0
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
EffectPhaser Class Referencefinal

An Effect that changes frequencies in a time varying manner. More...

#include <Phaser.h>

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

Public Member Functions

 EffectPhaser ()
 
virtual ~EffectPhaser ()
 
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 SupportsRealtime () override
 Whether the effect supports realtime previewing (while audio is playing). 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...
 
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
 
size_t RealtimeProcess (int group, float **inbuf, float **outbuf, size_t numSamples) override
 
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
 
VendorSymbol GetVendor () override
 
wxString GetVersion () override
 
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 SupportsAutomation () override
 Whether the effect can be used without the UI, in a macro. 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
 
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 ProcessFinalize () override
 Called for destructive, non-realtime effect computation. More...
 
bool RealtimeSuspend () override
 
bool RealtimeResume () noexcept override
 
bool RealtimeProcessStart () 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("Phaser") }
 
- 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 Member Functions

void InstanceInit (EffectPhaserState &data, float sampleRate)
 
size_t InstanceProcess (EffectPhaserState &data, float **inBlock, float **outBlock, size_t blockLen)
 
void OnStagesSlider (wxCommandEvent &evt)
 
void OnDryWetSlider (wxCommandEvent &evt)
 
void OnFeedbackSlider (wxCommandEvent &evt)
 
void OnDepthSlider (wxCommandEvent &evt)
 
void OnPhaseSlider (wxCommandEvent &evt)
 
void OnFreqSlider (wxCommandEvent &evt)
 
void OnGainSlider (wxCommandEvent &evt)
 
void OnStagesText (wxCommandEvent &evt)
 
void OnDryWetText (wxCommandEvent &evt)
 
void OnFeedbackText (wxCommandEvent &evt)
 
void OnDepthText (wxCommandEvent &evt)
 
void OnPhaseText (wxCommandEvent &evt)
 
void OnFreqText (wxCommandEvent &evt)
 
void OnGainText (wxCommandEvent &evt)
 

Private Attributes

EffectPhaserState mMaster
 
std::vector< EffectPhaserStatemSlaves
 
int mStages
 
int mDryWet
 
double mFreq
 
double mPhase
 
int mDepth
 
int mFeedback
 
double mOutGain
 
wxTextCtrl * mStagesT
 
wxTextCtrl * mDryWetT
 
wxTextCtrl * mFreqT
 
wxTextCtrl * mPhaseT
 
wxTextCtrl * mDepthT
 
wxTextCtrl * mFeedbackT
 
wxTextCtrl * mOutGainT
 
wxSlider * mStagesS
 
wxSlider * mDryWetS
 
wxSlider * mFreqS
 
wxSlider * mPhaseS
 
wxSlider * mDepthS
 
wxSlider * mFeedbackS
 
wxSlider * mOutGainS
 

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 changes frequencies in a time varying manner.

Definition at line 42 of file Phaser.h.

Constructor & Destructor Documentation

◆ EffectPhaser()

EffectPhaser::EffectPhaser ( )

Definition at line 89 of file Phaser.cpp.

90 {
91  mStages = DEF_Stages;
92  mDryWet = DEF_DryWet;
93  mFreq = DEF_Freq;
94  mPhase = DEF_Phase;
95  mDepth = DEF_Depth;
96  mFeedback = DEF_Feedback;
97  mOutGain = DEF_OutGain;
98 
99  SetLinearEffectFlag(true);
100 }

◆ ~EffectPhaser()

EffectPhaser::~EffectPhaser ( )
virtual

Definition at line 102 of file Phaser.cpp.

103 {
104 }

Member Function Documentation

◆ DefineParams()

bool EffectPhaser::DefineParams ( ShuttleParams S)
override

Definition at line 198 of file Phaser.cpp.

198  {
199  S.SHUTTLE_PARAM( mStages, Stages );
200  S.SHUTTLE_PARAM( mDryWet, DryWet );
201  S.SHUTTLE_PARAM( mFreq, Freq );
202  S.SHUTTLE_PARAM( mPhase, Phase );
203  S.SHUTTLE_PARAM( mDepth, Depth );
204  S.SHUTTLE_PARAM( mFeedback, Feedback );
205  S.SHUTTLE_PARAM( mOutGain, OutGain );
206  return true;
207 }

References mDepth, mDryWet, mFeedback, mFreq, mOutGain, mPhase, mStages, and S.

◆ GetAudioInCount()

unsigned EffectPhaser::GetAudioInCount ( )
overridevirtual

Reimplemented from Effect.

Definition at line 137 of file Phaser.cpp.

138 {
139  return 1;
140 }

◆ GetAudioOutCount()

unsigned EffectPhaser::GetAudioOutCount ( )
overridevirtual

Reimplemented from Effect.

Definition at line 142 of file Phaser.cpp.

143 {
144  return 1;
145 }

◆ GetAutomationParameters()

bool EffectPhaser::GetAutomationParameters ( CommandParameters parms)
overridevirtual

Save current settings into parms.

Reimplemented from Effect.

Definition at line 209 of file Phaser.cpp.

210 {
211  parms.Write(KEY_Stages, mStages);
212  parms.Write(KEY_DryWet, mDryWet);
213  parms.Write(KEY_Freq, mFreq);
214  parms.Write(KEY_Phase, mPhase);
215  parms.Write(KEY_Depth, mDepth);
216  parms.Write(KEY_Feedback, mFeedback);
217  parms.Write(KEY_OutGain, mOutGain);
218 
219  return true;
220 }

References mDepth, mDryWet, mFeedback, mFreq, mOutGain, mPhase, and mStages.

◆ GetDescription()

TranslatableString EffectPhaser::GetDescription ( )
overridevirtual

Reimplemented from Effect.

Definition at line 113 of file Phaser.cpp.

114 {
115  return XO("Combines phase-shifted signals with the original signal");
116 }

References XO.

◆ GetSymbol()

ComponentInterfaceSymbol EffectPhaser::GetSymbol ( )
overridevirtual

Reimplemented from Effect.

Definition at line 108 of file Phaser.cpp.

109 {
110  return Symbol;
111 }

References Symbol.

◆ GetType()

EffectType EffectPhaser::GetType ( )
overridevirtual

Type determines how it behaves.

Reimplemented from Effect.

Definition at line 125 of file Phaser.cpp.

126 {
127  return EffectTypeProcess;
128 }

References EffectTypeProcess.

◆ InstanceInit()

void EffectPhaser::InstanceInit ( EffectPhaserState data,
float  sampleRate 
)
private

Definition at line 378 of file Phaser.cpp.

379 {
380  data.samplerate = sampleRate;
381 
382  for (int j = 0; j < mStages; j++)
383  {
384  data.old[j] = 0;
385  }
386 
387  data.skipcount = 0;
388  data.gain = 0;
389  data.fbout = 0;
390  data.laststages = 0;
391  data.outgain = 0;
392 
393  return;
394 }

References EffectPhaserState::fbout, EffectPhaserState::gain, EffectPhaserState::laststages, mStages, EffectPhaserState::old, EffectPhaserState::outgain, EffectPhaserState::samplerate, and EffectPhaserState::skipcount.

Referenced by ProcessInitialize(), and RealtimeAddProcessor().

Here is the caller graph for this function:

◆ InstanceProcess()

size_t EffectPhaser::InstanceProcess ( EffectPhaserState data,
float **  inBlock,
float **  outBlock,
size_t  blockLen 
)
private

Definition at line 396 of file Phaser.cpp.

397 {
398  float *ibuf = inBlock[0];
399  float *obuf = outBlock[0];
400 
401  for (int j = data.laststages; j < mStages; j++)
402  {
403  data.old[j] = 0;
404  }
405  data.laststages = mStages;
406 
407  data.lfoskip = mFreq * 2 * M_PI / data.samplerate;
408  data.phase = mPhase * M_PI / 180;
409  data.outgain = DB_TO_LINEAR(mOutGain);
410 
411  for (decltype(blockLen) i = 0; i < blockLen; i++)
412  {
413  double in = ibuf[i];
414 
415  double m = in + data.fbout * mFeedback / 101; // Feedback must be less than 100% to avoid infinite gain.
416 
417  if (((data.skipcount++) % lfoskipsamples) == 0)
418  {
419  //compute sine between 0 and 1
420  data.gain =
421  (1.0 +
422  cos(data.skipcount.as_double() * data.lfoskip
423  + data.phase)) / 2.0;
424 
425  // change lfo shape
426  data.gain = expm1(data.gain * phaserlfoshape) / expm1(phaserlfoshape);
427 
428  // attenuate the lfo
429  data.gain = 1.0 - data.gain / 255.0 * mDepth;
430  }
431 
432  // phasing routine
433  for (int j = 0; j < mStages; j++)
434  {
435  double tmp = data.old[j];
436  data.old[j] = data.gain * tmp + m;
437  m = tmp - data.gain * data.old[j];
438  }
439  data.fbout = m;
440 
441  obuf[i] = (float) (data.outgain * (m * mDryWet + in * (255 - mDryWet)) / 255);
442  }
443 
444  return blockLen;
445 }

References sampleCount::as_double(), DB_TO_LINEAR(), EffectPhaserState::fbout, EffectPhaserState::gain, EffectPhaserState::laststages, EffectPhaserState::lfoskip, lfoskipsamples, M_PI, mDepth, mDryWet, mFeedback, mFreq, mOutGain, mPhase, mStages, EffectPhaserState::old, EffectPhaserState::outgain, EffectPhaserState::phase, phaserlfoshape, EffectPhaserState::samplerate, and EffectPhaserState::skipcount.

Referenced by ProcessBlock(), and RealtimeProcess().

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

◆ ManualPage()

ManualPageID EffectPhaser::ManualPage ( )
overridevirtual

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

Reimplemented from EffectDefinitionInterface.

Definition at line 118 of file Phaser.cpp.

119 {
120  return L"Phaser";
121 }

◆ OnDepthSlider()

void EffectPhaser::OnDepthSlider ( wxCommandEvent &  evt)
private

Definition at line 479 of file Phaser.cpp.

480 {
481  mDepth = evt.GetInt() / SCL_Depth;
482  mDepthT->GetValidator()->TransferToWindow();
483  EnableApply(mUIParent->Validate());
484 }

References Effect::EnableApply(), mDepth, mDepthT, and Effect::mUIParent.

Here is the call graph for this function:

◆ OnDepthText()

void EffectPhaser::OnDepthText ( wxCommandEvent &  evt)
private

Definition at line 544 of file Phaser.cpp.

545 {
546  if (!EnableApply(mUIParent->TransferDataFromWindow()))
547  {
548  return;
549  }
550 
551  mDepthS->SetValue((int) (mDepth * SCL_Depth));
552 }

References Effect::EnableApply(), mDepth, mDepthS, and Effect::mUIParent.

Here is the call graph for this function:

◆ OnDryWetSlider()

void EffectPhaser::OnDryWetSlider ( wxCommandEvent &  evt)
private

Definition at line 454 of file Phaser.cpp.

455 {
456  mDryWet = evt.GetInt() / SCL_DryWet;
457  mDryWetT->GetValidator()->TransferToWindow();
458  EnableApply(mUIParent->Validate());
459 }

References Effect::EnableApply(), mDryWet, mDryWetT, and Effect::mUIParent.

Here is the call graph for this function:

◆ OnDryWetText()

void EffectPhaser::OnDryWetText ( wxCommandEvent &  evt)
private

Definition at line 514 of file Phaser.cpp.

515 {
516  if (!EnableApply(mUIParent->TransferDataFromWindow()))
517  {
518  return;
519  }
520 
521  mDryWetS->SetValue((int) (mDryWet * SCL_DryWet));
522 }

References Effect::EnableApply(), mDryWet, mDryWetS, and Effect::mUIParent.

Here is the call graph for this function:

◆ OnFeedbackSlider()

void EffectPhaser::OnFeedbackSlider ( wxCommandEvent &  evt)
private

Definition at line 486 of file Phaser.cpp.

487 {
488  int val = evt.GetInt();
489  val = ((val + (val > 0 ? 5 : -5)) / 10) * 10; // round to nearest multiple of 10
490  val = val > MAX_Feedback * SCL_Feedback ? MAX_Feedback * SCL_Feedback : val;
491  mFeedbackS->SetValue(val);
492  mFeedback = val / SCL_Feedback;
493  mFeedbackT->GetValidator()->TransferToWindow();
494  EnableApply(mUIParent->Validate());
495 }

References Effect::EnableApply(), mFeedback, mFeedbackS, mFeedbackT, and Effect::mUIParent.

Here is the call graph for this function:

◆ OnFeedbackText()

void EffectPhaser::OnFeedbackText ( wxCommandEvent &  evt)
private

Definition at line 554 of file Phaser.cpp.

555 {
556  if (!EnableApply(mUIParent->TransferDataFromWindow()))
557  {
558  return;
559  }
560 
561  mFeedbackS->SetValue((int) (mFeedback * SCL_Feedback));
562 }

References Effect::EnableApply(), mFeedback, mFeedbackS, and Effect::mUIParent.

Here is the call graph for this function:

◆ OnFreqSlider()

void EffectPhaser::OnFreqSlider ( wxCommandEvent &  evt)
private

Definition at line 461 of file Phaser.cpp.

462 {
463  mFreq = (double) evt.GetInt() / SCL_Freq;
464  if (mFreq < MIN_Freq) mFreq = MIN_Freq;
465  mFreqT->GetValidator()->TransferToWindow();
466  EnableApply(mUIParent->Validate());
467 }

References Effect::EnableApply(), mFreq, mFreqT, and Effect::mUIParent.

Here is the call graph for this function:

◆ OnFreqText()

void EffectPhaser::OnFreqText ( wxCommandEvent &  evt)
private

Definition at line 524 of file Phaser.cpp.

525 {
526  if (!EnableApply(mUIParent->TransferDataFromWindow()))
527  {
528  return;
529  }
530 
531  mFreqS->SetValue((int) (mFreq * SCL_Freq));
532 }

References Effect::EnableApply(), mFreq, mFreqS, and Effect::mUIParent.

Here is the call graph for this function:

◆ OnGainSlider()

void EffectPhaser::OnGainSlider ( wxCommandEvent &  evt)
private

Definition at line 497 of file Phaser.cpp.

498 {
499  mOutGain = evt.GetInt() / SCL_OutGain;
500  mOutGainT->GetValidator()->TransferToWindow();
501  EnableApply(mUIParent->Validate());
502 }

References Effect::EnableApply(), mOutGain, mOutGainT, and Effect::mUIParent.

Here is the call graph for this function:

◆ OnGainText()

void EffectPhaser::OnGainText ( wxCommandEvent &  evt)
private

Definition at line 564 of file Phaser.cpp.

565 {
566  if (!EnableApply(mUIParent->TransferDataFromWindow()))
567  {
568  return;
569  }
570 
571  mOutGainS->SetValue((int) (mOutGain * SCL_OutGain));
572 }

References Effect::EnableApply(), mOutGain, mOutGainS, and Effect::mUIParent.

Here is the call graph for this function:

◆ OnPhaseSlider()

void EffectPhaser::OnPhaseSlider ( wxCommandEvent &  evt)
private

Definition at line 469 of file Phaser.cpp.

470 {
471  int val = ((evt.GetInt() + 5) / 10) * 10; // round to nearest multiple of 10
472  val = val > MAX_Phase * SCL_Phase ? MAX_Phase * SCL_Phase : val;
473  mPhaseS->SetValue(val);
474  mPhase = (double) val / SCL_Phase;
475  mPhaseT->GetValidator()->TransferToWindow();
476  EnableApply(mUIParent->Validate());
477 }

References Effect::EnableApply(), mPhase, mPhaseS, mPhaseT, and Effect::mUIParent.

Here is the call graph for this function:

◆ OnPhaseText()

void EffectPhaser::OnPhaseText ( wxCommandEvent &  evt)
private

Definition at line 534 of file Phaser.cpp.

535 {
536  if (!EnableApply(mUIParent->TransferDataFromWindow()))
537  {
538  return;
539  }
540 
541  mPhaseS->SetValue((int) (mPhase * SCL_Phase));
542 }

References Effect::EnableApply(), mPhase, mPhaseS, and Effect::mUIParent.

Here is the call graph for this function:

◆ OnStagesSlider()

void EffectPhaser::OnStagesSlider ( wxCommandEvent &  evt)
private

Definition at line 447 of file Phaser.cpp.

448 {
449  mStages = (evt.GetInt() / SCL_Stages) & ~1; // must be even;
450  mStagesT->GetValidator()->TransferToWindow();
451  EnableApply(mUIParent->Validate());
452 }

References Effect::EnableApply(), mStages, mStagesT, and Effect::mUIParent.

Here is the call graph for this function:

◆ OnStagesText()

void EffectPhaser::OnStagesText ( wxCommandEvent &  evt)
private

Definition at line 504 of file Phaser.cpp.

505 {
506  if (!EnableApply(mUIParent->TransferDataFromWindow()))
507  {
508  return;
509  }
510 
511  mStagesS->SetValue((int) (mStages * SCL_Stages));
512 }

References Effect::EnableApply(), mStages, mStagesS, and Effect::mUIParent.

Here is the call graph for this function:

◆ PopulateOrExchange()

void EffectPhaser::PopulateOrExchange ( ShuttleGui S)
overridevirtual

Reimplemented from Effect.

Definition at line 250 of file Phaser.cpp.

251 {
252  S.SetBorder(5);
253  S.AddSpace(0, 5);
254 
255  S.StartMultiColumn(3, wxEXPAND);
256  {
257  S.SetStretchyCol(2);
258 
259  mStagesT = S.Id(ID_Stages)
260  .Validator<IntegerValidator<int>>(
261  &mStages, NumValidatorStyle::DEFAULT, MIN_Stages, MAX_Stages)
262  .AddTextBox(XXO("&Stages:"), wxT(""), 15);
263 
264  mStagesS = S.Id(ID_Stages)
265  .Name(XO("Stages"))
266  .Style(wxSL_HORIZONTAL)
267  .MinSize( { 100, -1 } )
268  .AddSlider( {}, DEF_Stages * SCL_Stages, MAX_Stages * SCL_Stages, MIN_Stages * SCL_Stages);
269  mStagesS->SetLineSize(2);
270 
271  mDryWetT = S.Id(ID_DryWet)
272  .Validator<IntegerValidator<int>>(
273  &mDryWet, NumValidatorStyle::DEFAULT, MIN_DryWet, MAX_DryWet)
274  .AddTextBox(XXO("&Dry/Wet:"), wxT(""), 15);
275 
276  mDryWetS = S.Id(ID_DryWet)
277  .Name(XO("Dry Wet"))
278  .Style(wxSL_HORIZONTAL)
279  .MinSize( { 100, -1 } )
280  .AddSlider( {}, DEF_DryWet * SCL_DryWet, MAX_DryWet * SCL_DryWet, MIN_DryWet * SCL_DryWet);
281 
282  mFreqT = S.Id(ID_Freq)
283  .Validator<FloatingPointValidator<double>>(
284  5, &mFreq, NumValidatorStyle::ONE_TRAILING_ZERO, MIN_Freq, MAX_Freq)
285  .AddTextBox(XXO("LFO Freq&uency (Hz):"), wxT(""), 15);
286 
287  mFreqS = S.Id(ID_Freq)
288  .Name(XO("LFO frequency in hertz"))
289  .Style(wxSL_HORIZONTAL)
290  .MinSize( { 100, -1 } )
291  .AddSlider( {}, DEF_Freq * SCL_Freq, MAX_Freq * SCL_Freq, 0.0);
292 
293  mPhaseT = S.Id(ID_Phase)
294  .Validator<FloatingPointValidator<double>>(
295  1, &mPhase, NumValidatorStyle::DEFAULT, MIN_Phase, MAX_Phase)
296  .AddTextBox(XXO("LFO Sta&rt Phase (deg.):"), wxT(""), 15);
297 
298  mPhaseS = S.Id(ID_Phase)
299  .Name(XO("LFO start phase in degrees"))
300  .Style(wxSL_HORIZONTAL)
301  .MinSize( { 100, -1 } )
302  .AddSlider( {}, DEF_Phase * SCL_Phase, MAX_Phase * SCL_Phase, MIN_Phase * SCL_Phase);
303  mPhaseS->SetLineSize(10);
304 
305  mDepthT = S.Id(ID_Depth)
306  .Validator<IntegerValidator<int>>(
307  &mDepth, NumValidatorStyle::DEFAULT, MIN_Depth, MAX_Depth)
308  .AddTextBox(XXO("Dept&h:"), wxT(""), 15);
309 
310  mDepthS = S.Id(ID_Depth)
311  .Name(XO("Depth in percent"))
312  .Style(wxSL_HORIZONTAL)
313  .MinSize( { 100, -1 } )
314  .AddSlider( {}, DEF_Depth * SCL_Depth, MAX_Depth * SCL_Depth, MIN_Depth * SCL_Depth);
315 
316  mFeedbackT = S.Id(ID_Feedback)
317  .Validator<IntegerValidator<int>>(
318  &mFeedback, NumValidatorStyle::DEFAULT, MIN_Feedback, MAX_Feedback)
319  .AddTextBox(XXO("Feedbac&k (%):"), wxT(""), 15);
320 
321  mFeedbackS = S.Id(ID_Feedback)
322  .Name(XO("Feedback in percent"))
323  .Style(wxSL_HORIZONTAL)
324  .MinSize( { 100, -1 } )
325  .AddSlider( {}, DEF_Feedback * SCL_Feedback, MAX_Feedback * SCL_Feedback, MIN_Feedback * SCL_Feedback);
326  mFeedbackS->SetLineSize(10);
327 
328  mOutGainT = S.Id(ID_OutGain)
329  .Validator<FloatingPointValidator<double>>(
330  1, &mOutGain, NumValidatorStyle::DEFAULT, MIN_OutGain, MAX_OutGain)
331  .AddTextBox(XXO("&Output gain (dB):"), wxT(""), 12);
332 
333  mOutGainS = S.Id(ID_OutGain)
334  .Name(XO("Output gain (dB)"))
335  .Style(wxSL_HORIZONTAL)
336  .MinSize( { 100, -1 } )
337  .AddSlider( {}, DEF_OutGain * SCL_OutGain, MAX_OutGain * SCL_OutGain, MIN_OutGain * SCL_OutGain);
338  }
339  S.EndMultiColumn();
340 }

References ID_Depth, ID_DryWet, ID_Feedback, ID_Freq, ID_OutGain, ID_Phase, ID_Stages, mDepth, mDepthS, mDepthT, mDryWet, mDryWetS, mDryWetT, mFeedback, mFeedbackS, mFeedbackT, mFreq, mFreqS, mFreqT, mOutGain, mOutGainS, mOutGainT, mPhase, mPhaseS, mPhaseT, mStages, mStagesS, mStagesT, S, XO, and XXO.

◆ ProcessBlock()

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

Called for destructive, non-realtime effect computation.

Reimplemented from Effect.

Definition at line 158 of file Phaser.cpp.

159 {
160  return InstanceProcess(mMaster, inBlock, outBlock, blockLen);
161 }

References InstanceProcess(), and mMaster.

Here is the call graph for this function:

◆ ProcessInitialize()

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

Called for destructive, non-realtime effect computation.

Reimplemented from Effect.

Definition at line 147 of file Phaser.cpp.

148 {
150  if (chanMap[0] == ChannelNameFrontRight)
151  {
152  mMaster.phase += M_PI;
153  }
154 
155  return true;
156 }

References ChannelNameFrontRight, InstanceInit(), M_PI, mMaster, Effect::mSampleRate, and EffectPhaserState::phase.

Here is the call graph for this function:

◆ RealtimeAddProcessor()

bool EffectPhaser::RealtimeAddProcessor ( unsigned  numChannels,
float  sampleRate 
)
overridevirtual

Reimplemented from Effect.

Definition at line 172 of file Phaser.cpp.

173 {
174  EffectPhaserState slave;
175 
176  InstanceInit(slave, sampleRate);
177 
178  mSlaves.push_back(slave);
179 
180  return true;
181 }

References InstanceInit(), and mSlaves.

Here is the call graph for this function:

◆ RealtimeFinalize()

bool EffectPhaser::RealtimeFinalize ( )
overridevirtual

Reimplemented from Effect.

Definition at line 183 of file Phaser.cpp.

184 {
185  mSlaves.clear();
186 
187  return true;
188 }

References mSlaves.

◆ RealtimeInitialize()

bool EffectPhaser::RealtimeInitialize ( )
overridevirtual

Reimplemented from Effect.

Definition at line 163 of file Phaser.cpp.

164 {
165  SetBlockSize(512);
166 
167  mSlaves.clear();
168 
169  return true;
170 }

References mSlaves, and Effect::SetBlockSize().

Here is the call graph for this function:

◆ RealtimeProcess()

size_t EffectPhaser::RealtimeProcess ( int  group,
float **  inbuf,
float **  outbuf,
size_t  numSamples 
)
overridevirtual

Reimplemented from Effect.

Definition at line 190 of file Phaser.cpp.

194 {
195 
196  return InstanceProcess(mSlaves[group], inbuf, outbuf, numSamples);
197 }

References InstanceProcess(), and mSlaves.

Here is the call graph for this function:

◆ SetAutomationParameters()

bool EffectPhaser::SetAutomationParameters ( CommandParameters parms)
overridevirtual

Change settings to those stored in parms.

Reimplemented from Effect.

Definition at line 222 of file Phaser.cpp.

223 {
224  ReadAndVerifyInt(Stages);
225  ReadAndVerifyInt(DryWet);
226  ReadAndVerifyDouble(Freq);
227  ReadAndVerifyDouble(Phase);
228  ReadAndVerifyInt(Depth);
229  ReadAndVerifyInt(Feedback);
230  ReadAndVerifyDouble(OutGain);
231 
232  if (Stages & 1) // must be even, but don't complain about it
233  {
234  Stages &= ~1;
235  }
236 
237  mFreq = Freq;
238  mFeedback = Feedback;
239  mStages = Stages;
240  mDryWet = DryWet;
241  mDepth = Depth;
242  mPhase = Phase;
243  mOutGain = OutGain;
244 
245  return true;
246 }

References mDepth, mDryWet, mFeedback, mFreq, mOutGain, mPhase, mStages, ReadAndVerifyDouble, and ReadAndVerifyInt.

◆ SupportsRealtime()

bool EffectPhaser::SupportsRealtime ( )
overridevirtual

Whether the effect supports realtime previewing (while audio is playing).

Reimplemented from Effect.

Definition at line 130 of file Phaser.cpp.

131 {
132  return true;
133 }

◆ TransferDataFromWindow()

bool EffectPhaser::TransferDataFromWindow ( )
overridevirtual

Reimplemented from Effect.

Definition at line 360 of file Phaser.cpp.

361 {
362  if (!mUIParent->Validate() || !mUIParent->TransferDataFromWindow())
363  {
364  return false;
365  }
366 
367  if (mStages & 1) // must be even
368  {
369  mStages &= ~1;
370  mStagesT->GetValidator()->TransferToWindow();
371  }
372 
373  return true;
374 }

References mStages, mStagesT, and Effect::mUIParent.

◆ TransferDataToWindow()

bool EffectPhaser::TransferDataToWindow ( )
overridevirtual

Reimplemented from Effect.

Definition at line 342 of file Phaser.cpp.

343 {
344  if (!mUIParent->TransferDataToWindow())
345  {
346  return false;
347  }
348 
349  mStagesS->SetValue((int) (mStages * SCL_Stages));
350  mDryWetS->SetValue((int) (mDryWet * SCL_DryWet));
351  mFreqS->SetValue((int) (mFreq * SCL_Freq));
352  mPhaseS->SetValue((int) (mPhase * SCL_Phase));
353  mDepthS->SetValue((int) (mDepth * SCL_Depth));
354  mFeedbackS->SetValue((int) (mFeedback * SCL_Feedback));
355  mOutGainS->SetValue((int) (mOutGain * SCL_OutGain));
356 
357  return true;
358 }

References mDepth, mDepthS, mDryWet, mDryWetS, mFeedback, mFeedbackS, mFreq, mFreqS, mOutGain, mOutGainS, mPhase, mPhaseS, mStages, mStagesS, and Effect::mUIParent.

Member Data Documentation

◆ mDepth

int EffectPhaser::mDepth
private

◆ mDepthS

wxSlider* EffectPhaser::mDepthS
private

Definition at line 142 of file Phaser.h.

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

◆ mDepthT

wxTextCtrl* EffectPhaser::mDepthT
private

Definition at line 134 of file Phaser.h.

Referenced by OnDepthSlider(), and PopulateOrExchange().

◆ mDryWet

int EffectPhaser::mDryWet
private

◆ mDryWetS

wxSlider* EffectPhaser::mDryWetS
private

Definition at line 139 of file Phaser.h.

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

◆ mDryWetT

wxTextCtrl* EffectPhaser::mDryWetT
private

Definition at line 131 of file Phaser.h.

Referenced by OnDryWetSlider(), and PopulateOrExchange().

◆ mFeedback

int EffectPhaser::mFeedback
private

◆ mFeedbackS

wxSlider* EffectPhaser::mFeedbackS
private

◆ mFeedbackT

wxTextCtrl* EffectPhaser::mFeedbackT
private

Definition at line 135 of file Phaser.h.

Referenced by OnFeedbackSlider(), and PopulateOrExchange().

◆ mFreq

double EffectPhaser::mFreq
private

◆ mFreqS

wxSlider* EffectPhaser::mFreqS
private

Definition at line 140 of file Phaser.h.

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

◆ mFreqT

wxTextCtrl* EffectPhaser::mFreqT
private

Definition at line 132 of file Phaser.h.

Referenced by OnFreqSlider(), and PopulateOrExchange().

◆ mMaster

EffectPhaserState EffectPhaser::mMaster
private

Definition at line 118 of file Phaser.h.

Referenced by ProcessBlock(), and ProcessInitialize().

◆ mOutGain

double EffectPhaser::mOutGain
private

◆ mOutGainS

wxSlider* EffectPhaser::mOutGainS
private

Definition at line 144 of file Phaser.h.

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

◆ mOutGainT

wxTextCtrl* EffectPhaser::mOutGainT
private

Definition at line 136 of file Phaser.h.

Referenced by OnGainSlider(), and PopulateOrExchange().

◆ mPhase

double EffectPhaser::mPhase
private

◆ mPhaseS

wxSlider* EffectPhaser::mPhaseS
private

Definition at line 141 of file Phaser.h.

Referenced by OnPhaseSlider(), OnPhaseText(), PopulateOrExchange(), and TransferDataToWindow().

◆ mPhaseT

wxTextCtrl* EffectPhaser::mPhaseT
private

Definition at line 133 of file Phaser.h.

Referenced by OnPhaseSlider(), and PopulateOrExchange().

◆ mSlaves

std::vector<EffectPhaserState> EffectPhaser::mSlaves
private

◆ mStages

int EffectPhaser::mStages
private

◆ mStagesS

wxSlider* EffectPhaser::mStagesS
private

Definition at line 138 of file Phaser.h.

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

◆ mStagesT

wxTextCtrl* EffectPhaser::mStagesT
private

Definition at line 130 of file Phaser.h.

Referenced by OnStagesSlider(), PopulateOrExchange(), and TransferDataFromWindow().

◆ Symbol

const ComponentInterfaceSymbol EffectPhaser::Symbol { XO("Phaser") }
static

Definition at line 45 of file Phaser.h.

Referenced by GetSymbol().


The documentation for this class was generated from the following files:
EffectPhaser::mFreq
double mFreq
Definition: Phaser.h:124
ID_OutGain
@ ID_OutGain
Definition: Phaser.cpp:43
ID_Stages
@ ID_Stages
Definition: Phaser.cpp:37
EffectPhaserState::outgain
double outgain
Definition: Phaser.h:36
EffectTypeProcess
@ EffectTypeProcess
Definition: EffectInterface.h:56
DB_TO_LINEAR
const double MIN_Threshold_Linear DB_TO_LINEAR(MIN_Threshold_dB)
EffectPhaser::mPhaseT
wxTextCtrl * mPhaseT
Definition: Phaser.h:133
Effect::SetLinearEffectFlag
void SetLinearEffectFlag(bool linearEffectFlag)
Definition: Effect.cpp:1764
Effect::EnableApply
bool EnableApply(bool enable=true)
Definition: Effect.cpp:1694
EffectPhaser::mDryWetT
wxTextCtrl * mDryWetT
Definition: Phaser.h:131
ID_Feedback
@ ID_Feedback
Definition: Phaser.cpp:42
S
#define S(N)
Definition: ToChars.cpp:64
EffectPhaser::mFeedback
int mFeedback
Definition: Phaser.h:127
ChannelNameFrontRight
@ ChannelNameFrontRight
Definition: EffectInterface.h:166
EffectPhaserState::samplerate
float samplerate
Definition: Phaser.h:31
EffectPhaserState::gain
double gain
Definition: Phaser.h:34
EffectPhaser::mFreqT
wxTextCtrl * mFreqT
Definition: Phaser.h:132
XO
#define XO(s)
Definition: Internat.h:31
EffectPhaser::mOutGain
double mOutGain
Definition: Phaser.h:128
ID_DryWet
@ ID_DryWet
Definition: Phaser.cpp:38
EffectPhaser::mStagesS
wxSlider * mStagesS
Definition: Phaser.h:138
EffectPhaser::mOutGainT
wxTextCtrl * mOutGainT
Definition: Phaser.h:136
EffectPhaserState
Definition: Phaser.h:28
EffectPhaser::InstanceInit
void InstanceInit(EffectPhaserState &data, float sampleRate)
Definition: Phaser.cpp:378
EffectPhaser::mDepthS
wxSlider * mDepthS
Definition: Phaser.h:142
ReadAndVerifyInt
#define ReadAndVerifyInt(name)
Definition: Effect.h:591
XXO
#define XXO(s)
Definition: Internat.h:44
sampleCount::as_double
double as_double() const
Definition: SampleCount.h:45
EffectPhaserState::lfoskip
double lfoskip
Definition: Phaser.h:37
EffectPhaser::mMaster
EffectPhaserState mMaster
Definition: Phaser.h:118
EffectPhaserState::phase
double phase
Definition: Phaser.h:38
EffectPhaser::mDryWet
int mDryWet
Definition: Phaser.h:123
EffectPhaserState::laststages
int laststages
Definition: Phaser.h:39
EffectPhaser::mStagesT
wxTextCtrl * mStagesT
Definition: Phaser.h:130
EffectPhaser::mPhase
double mPhase
Definition: Phaser.h:125
phaserlfoshape
#define phaserlfoshape
Definition: Phaser.cpp:58
EffectPhaserState::fbout
double fbout
Definition: Phaser.h:35
EffectPhaserState::skipcount
sampleCount skipcount
Definition: Phaser.h:32
ReadAndVerifyDouble
#define ReadAndVerifyDouble(name)
Definition: Effect.h:592
EffectPhaserState::old
double old[NUM_STAGES]
Definition: Phaser.h:33
EffectPhaser::InstanceProcess
size_t InstanceProcess(EffectPhaserState &data, float **inBlock, float **outBlock, size_t blockLen)
Definition: Phaser.cpp:396
EffectPhaser::mFeedbackS
wxSlider * mFeedbackS
Definition: Phaser.h:143
lfoskipsamples
#define lfoskipsamples
Definition: Phaser.cpp:61
EffectPhaser::mStages
int mStages
Definition: Phaser.h:122
Effect::mSampleRate
double mSampleRate
Definition: Effect.h:418
EffectPhaser::mSlaves
std::vector< EffectPhaserState > mSlaves
Definition: Phaser.h:119
EffectPhaser::mDryWetS
wxSlider * mDryWetS
Definition: Phaser.h:139
EffectPhaser::mOutGainS
wxSlider * mOutGainS
Definition: Phaser.h:144
Effect::mUIParent
wxWindow * mUIParent
Definition: Effect.h:438
EffectPhaser::mDepthT
wxTextCtrl * mDepthT
Definition: Phaser.h:134
EffectPhaser::mFreqS
wxSlider * mFreqS
Definition: Phaser.h:140
EffectPhaser::Symbol
static const ComponentInterfaceSymbol Symbol
Definition: Phaser.h:45
EffectPhaser::mDepth
int mDepth
Definition: Phaser.h:126
M_PI
#define M_PI
Definition: Distortion.cpp:29
ID_Phase
@ ID_Phase
Definition: Phaser.cpp:40
EffectPhaser::mFeedbackT
wxTextCtrl * mFeedbackT
Definition: Phaser.h:135
EffectPhaser::mPhaseS
wxSlider * mPhaseS
Definition: Phaser.h:141
Effect::SetBlockSize
size_t SetBlockSize(size_t maxBlockSize) override
Definition: Effect.cpp:294
ID_Freq
@ ID_Freq
Definition: Phaser.cpp:39
ID_Depth
@ ID_Depth
Definition: Phaser.cpp:41