Audacity  2.2.2
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
Effect Class Reference

Base class for many of the effects in Audacity. More...

#include <Effect.h>

Inheritance diagram for Effect:
EffectAmplify EffectAutoDuck EffectBassTreble EffectChangeSpeed EffectClickRemoval EffectDistortion EffectDtmf EffectEcho EffectEqualization EffectFade EffectFindClipping EffectInvert EffectNoise EffectNoiseReduction EffectNormalize EffectPaulstretch EffectPhaser EffectRepair EffectRepeat EffectReverb EffectReverse EffectScienFilter EffectSimpleMono EffectStereoToMono EffectToneGen EffectTruncSilence EffectTwoPassSimpleMono EffectWahwah Generator NyquistEffect

Classes

class  AddedAnalysisTrack
 
class  ModifiedAnalysisTrack
 

Public Types

enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 

Public Member Functions

 Effect ()
 
virtual ~Effect ()
 
wxString GetPath () override
 
wxString GetSymbol () override
 
wxString GetName () override
 
wxString GetVendor () override
 
wxString GetVersion () override
 
wxString GetDescription () override
 
EffectType GetType () override
 
wxString GetFamilyId () override
 
wxString GetFamilyName () override
 
bool IsInteractive () override
 
bool IsDefault () override
 
bool IsLegacy () override
 
bool SupportsRealtime () override
 
bool SupportsAutomation () override
 
bool SetHost (EffectHostInterface *host) override
 
unsigned GetAudioInCount () override
 
unsigned GetAudioOutCount () override
 
int GetMidiInCount () override
 
int GetMidiOutCount () override
 
sampleCount GetLatency () override
 
size_t GetTailSize () override
 
void SetSampleRate (double rate) override
 
size_t SetBlockSize (size_t maxBlockSize) override
 
bool IsReady () override
 
bool ProcessInitialize (sampleCount totalLen, ChannelNames chanMap=NULL) override
 
bool ProcessFinalize () override
 
size_t ProcessBlock (float **inBlock, float **outBlock, size_t blockLen) override
 
bool RealtimeInitialize () override
 
bool RealtimeAddProcessor (unsigned numChannels, float sampleRate) override
 
bool RealtimeFinalize () override
 
bool RealtimeSuspend () override
 
bool RealtimeResume () override
 
bool RealtimeProcessStart () override
 
size_t RealtimeProcess (int group, float **inbuf, float **outbuf, size_t numSamples) override
 
bool RealtimeProcessEnd () override
 
bool ShowInterface (wxWindow *parent, bool forceModal=false) override
 
bool GetAutomationParameters (EffectAutomationParameters &parms) override
 
bool SetAutomationParameters (EffectAutomationParameters &parms) override
 
bool LoadUserPreset (const wxString &name) override
 
bool SaveUserPreset (const wxString &name) override
 
wxArrayString GetFactoryPresets () override
 
bool LoadFactoryPreset (int id) override
 
bool LoadFactoryDefaults () override
 
void SetHostUI (EffectUIHostInterface *host) override
 
bool PopulateUI (wxWindow *parent) override
 
bool IsGraphicalUI () override
 
bool ValidateUI () override
 
bool HideUI () override
 
bool CloseUI () override
 
bool CanExportPresets () override
 
void ExportPresets () override
 
void ImportPresets () override
 
bool HasOptions () override
 
void ShowOptions () override
 
double GetDefaultDuration () override
 
double GetDuration () override
 
wxString GetDurationFormat () override
 
virtual wxString GetSelectionFormat ()
 
void SetDuration (double duration) override
 
bool Apply () override
 
void Preview () override
 
wxDialog * CreateUI (wxWindow *parent, EffectUIClientInterface *client) override
 
wxString GetUserPresetsGroup (const wxString &name) override
 
wxString GetCurrentSettingsGroup () override
 
wxString GetFactoryDefaultsGroup () override
 
virtual wxString GetSavedStateGroup ()
 
bool HasSharedConfigGroup (const wxString &group) override
 
bool GetSharedConfigSubgroups (const wxString &group, wxArrayString &subgroups) override
 
bool GetSharedConfig (const wxString &group, const wxString &key, wxString &value, const wxString &defval=wxEmptyString) override
 
bool GetSharedConfig (const wxString &group, const wxString &key, int &value, int defval=0) override
 
bool GetSharedConfig (const wxString &group, const wxString &key, bool &value, bool defval=false) override
 
bool GetSharedConfig (const wxString &group, const wxString &key, float &value, float defval=0.0) override
 
bool GetSharedConfig (const wxString &group, const wxString &key, double &value, double defval=0.0) override
 
bool SetSharedConfig (const wxString &group, const wxString &key, const wxString &value) override
 
bool SetSharedConfig (const wxString &group, const wxString &key, const int &value) override
 
bool SetSharedConfig (const wxString &group, const wxString &key, const bool &value) override
 
bool SetSharedConfig (const wxString &group, const wxString &key, const float &value) override
 
bool SetSharedConfig (const wxString &group, const wxString &key, const double &value) override
 
bool RemoveSharedConfigSubgroup (const wxString &group) override
 
bool RemoveSharedConfig (const wxString &group, const wxString &key) override
 
bool HasPrivateConfigGroup (const wxString &group) override
 
bool GetPrivateConfigSubgroups (const wxString &group, wxArrayString &subgroups) override
 
bool GetPrivateConfig (const wxString &group, const wxString &key, wxString &value, const wxString &defval=wxEmptyString) override
 
bool GetPrivateConfig (const wxString &group, const wxString &key, int &value, int defval=0) override
 
bool GetPrivateConfig (const wxString &group, const wxString &key, bool &value, bool defval=false) override
 
bool GetPrivateConfig (const wxString &group, const wxString &key, float &value, float defval=0.0) override
 
bool GetPrivateConfig (const wxString &group, const wxString &key, double &value, double defval=0.0) override
 
bool SetPrivateConfig (const wxString &group, const wxString &key, const wxString &value) override
 
bool SetPrivateConfig (const wxString &group, const wxString &key, const int &value) override
 
bool SetPrivateConfig (const wxString &group, const wxString &key, const bool &value) override
 
bool SetPrivateConfig (const wxString &group, const wxString &key, const float &value) override
 
bool SetPrivateConfig (const wxString &group, const wxString &key, const double &value) override
 
bool RemovePrivateConfigSubgroup (const wxString &group) override
 
bool RemovePrivateConfig (const wxString &group, const wxString &key) override
 
virtual PluginID GetID ()
 
virtual bool Startup (EffectClientInterface *client)
 
virtual bool Startup ()
 
virtual bool GetAutomationParameters (wxString &parms)
 
virtual bool SetAutomationParameters (const wxString &parms)
 
virtual wxArrayString GetUserPresets ()
 
virtual bool HasCurrentSettings ()
 
virtual bool HasFactoryDefaults ()
 
virtual wxString GetPreset (wxWindow *parent, const wxString &parms)
 
virtual wxString ManualPage ()
 
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{})
 

Protected Member Functions

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 void PopulateOrExchange (ShuttleGui &S)
 
virtual bool TransferDataToWindow ()
 
virtual bool TransferDataFromWindow ()
 
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

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
 

Private Member Functions

void CommonInit ()
 
void CountWaveTracks ()
 
bool ProcessTrack (int count, ChannelNames map, WaveTrack *left, WaveTrack *right, sampleCount leftStart, sampleCount rightStart, sampleCount len, FloatBuffers &inBuffer, FloatBuffers &outBuffer, ArrayOf< float * > &inBufPos, ArrayOf< float * > &outBufPos)
 

Private Attributes

TrackListmTracks
 
bool mIsBatch
 
bool mIsLinearEffect
 
bool mPreviewWithNotSelected
 
bool mPreviewFullSelection
 
bool mIsSelection
 
double mDuration
 
wxString mDurationFormat
 
bool mIsPreview
 
bool mUIDebug
 
std::vector< Track * > mIMap
 
std::vector< Track * > mOMap
 
int mNumTracks
 
int mNumGroups
 
EffectClientInterface * mClient
 
size_t mNumAudioIn
 
size_t mNumAudioOut
 
size_t mBufferSize
 
size_t mBlockSize
 
unsigned mNumChannels
 
std::vector< int > mGroupProcessor
 
int mCurrentProcessor
 
wxCriticalSection mRealtimeSuspendLock
 
int mRealtimeSuspendCount
 

Static Private Attributes

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>")
 

Friends

class EffectManager
 
class EffectRack
 
class EffectUIHost
 
class EffectPresetsDialog
 

Detailed Description

Base class for many of the effects in Audacity.

Definition at line 61 of file Effect.h.

Member Enumeration Documentation

anonymous enum : long
Enumerator
DefaultMessageBoxStyle 

Definition at line 271 of file Effect.h.

271 : long { DefaultMessageBoxStyle = wxOK | wxCENTRE };

Constructor & Destructor Documentation

Effect::Effect ( )

Definition at line 97 of file Effect.cpp.

References GetActiveProject(), AudacityProject::GetRate(), mBlockSize, mBufferSize, mClient, mDuration, mIsBatch, mIsLinearEffect, mIsPreview, mNumAudioIn, mNumAudioOut, mNumChannels, mNumGroups, mNumTracks, mOutputTracksType, mPreviewFullSelection, mPreviewWithNotSelected, mProgress, mProjectRate, mRealtimeSuspendCount, mRealtimeSuspendLock, mT0, mT1, mTracks, mUIDebug, mUIDialog, mUIParent, and Track::None.

98 {
99  mClient = NULL;
100 
101  mTracks = NULL;
103  mT0 = 0.0;
104  mT1 = 0.0;
105  mDuration = 0.0;
106  mIsPreview = false;
107  mIsLinearEffect = false;
108  mPreviewWithNotSelected = false;
109  mPreviewFullSelection = false;
110  mNumTracks = 0;
111  mNumGroups = 0;
112  mProgress = NULL;
113 
114  mRealtimeSuspendLock.Enter();
115  mRealtimeSuspendCount = 1; // Effects are initially suspended
116  mRealtimeSuspendLock.Leave();
117 
118  mUIParent = NULL;
119  mUIDialog = NULL;
120 
121  mNumAudioIn = 0;
122  mNumAudioOut = 0;
123 
124  mBufferSize = 0;
125  mBlockSize = 0;
126  mNumChannels = 0;
127 
128  mUIDebug = false;
129 
131  mProjectRate = p ? p->GetRate() : 44100;
132 
133  mIsBatch = false;
134 }
double mT1
Definition: Effect.h:464
ProgressDialog * mProgress
Definition: Effect.h:455
TrackList * mTracks
Definition: Effect.h:508
int mOutputTracksType
Definition: Effect.h:481
bool mPreviewFullSelection
Definition: Effect.h:513
bool mIsPreview
Definition: Effect.h:519
EffectClientInterface * mClient
Definition: Effect.h:530
size_t mBufferSize
Definition: Effect.h:534
size_t mNumAudioIn
Definition: Effect.h:531
wxCriticalSection mRealtimeSuspendLock
Definition: Effect.h:541
size_t mNumAudioOut
Definition: Effect.h:532
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:158
size_t mBlockSize
Definition: Effect.h:535
int mNumTracks
Definition: Effect.h:526
bool mIsLinearEffect
Definition: Effect.h:511
int mRealtimeSuspendCount
Definition: Effect.h:542
bool mPreviewWithNotSelected
Definition: Effect.h:512
wxWindow * mUIParent
Definition: Effect.h:475
double mProjectRate
Definition: Effect.h:456
unsigned mNumChannels
Definition: Effect.h:536
wxDialog * mUIDialog
Definition: Effect.h:474
bool mUIDebug
Definition: Effect.h:521
AUDACITY_DLL_API AudacityProject * GetActiveProject()
Definition: Project.cpp:300
double mDuration
Definition: Effect.h:516
double GetRate() const
Definition: Project.h:181
bool mIsBatch
Definition: Effect.h:510
double mT0
Definition: Effect.h:463
int mNumGroups
Definition: Effect.h:527
Effect::~Effect ( )
virtual

Definition at line 136 of file Effect.cpp.

References mUIDialog.

137 {
138  if (mUIDialog)
139  {
140  mUIDialog->Close();
141  }
142 }
wxDialog * mUIDialog
Definition: Effect.h:474

Member Function Documentation

auto Effect::AddAnalysisTrack ( const wxString &  name = wxString())
protected

Definition at line 2107 of file Effect.cpp.

References name, and safenew.

Referenced by EffectFindClipping::Process().

2108 {
2109  return std::shared_ptr<AddedAnalysisTrack>
2110  { safenew AddedAnalysisTrack{ this, name } };
2111 }
#define safenew
Definition: Audacity.h:223
const wxChar * name
Definition: Distortion.cpp:94
Track * Effect::AddToOutputTracks ( std::unique_ptr< Track > &&  t)
protected

Definition at line 2070 of file Effect.cpp.

References mIMap, mOMap, and mOutputTracks.

Referenced by NyquistEffect::ProcessOne().

2071 {
2072  mIMap.push_back(NULL);
2073  mOMap.push_back(t.get());
2074  return mOutputTracks->Add(std::move(t));
2075 }
std::vector< Track * > mOMap
Definition: Effect.h:524
std::vector< Track * > mIMap
Definition: Effect.h:523
std::shared_ptr< TrackList > mOutputTracks
Definition: Effect.h:462
bool Effect::Apply ( )
override

Definition at line 786 of file Effect.cpp.

References AudacityProject::DoEffect(), GetActiveProject(), GetID(), and AudacityProject::OnEffectFlags::kConfigured.

787 {
788  // This is absolute hackage...but easy and I can't think of another way just now.
789  //
790  // It should callback to the EffectManager to kick off the processing
792 }
static const int kConfigured
Definition: Project.h:483
virtual PluginID GetID()
Definition: Effect.cpp:982
bool DoEffect(const PluginID &ID, int flags)
Definition: Menus.cpp:4316
AUDACITY_DLL_API AudacityProject * GetActiveProject()
Definition: Project.cpp:300
double Effect::CalcPreviewInputLength ( double  previewLength)
protectedvirtual

Reimplemented in EffectTruncSilence, EffectChangeSpeed, and EffectPaulstretch.

Definition at line 2282 of file Effect.cpp.

Referenced by Preview(), and ProcessTrack().

2283 {
2284  return previewLength;
2285 }
bool Effect::CanExportPresets ( )
override

Definition at line 718 of file Effect.cpp.

719 {
720  return false;
721 }
virtual bool Effect::CheckWhetherSkipEffect ( )
inlineprotectedvirtual

Reimplemented in NyquistEffect, EffectBassTreble, EffectChangeSpeed, EffectClickRemoval, EffectNormalize, and EffectNoiseReduction.

Definition at line 300 of file Effect.h.

Referenced by DoEffect().

300 { return false; }
bool Effect::CloseUI ( )
override

Definition at line 707 of file Effect.cpp.

References mUIDialog, and mUIParent.

Referenced by EffectEqualization::CloseUI().

708 {
709  if (mUIParent)
710  mUIParent->RemoveEventHandler(this);
711 
712  mUIParent = NULL;
713  mUIDialog = NULL;
714 
715  return true;
716 }
wxWindow * mUIParent
Definition: Effect.h:475
wxDialog * mUIDialog
Definition: Effect.h:474
void Effect::CommonInit ( )
private
void Effect::CopyInputTracks ( )
protected
void Effect::CopyInputTracks ( int  trackType)
protected

Definition at line 2044 of file Effect.cpp.

References Track::All, TrackList::Create(), TrackListCondIterator::First(), mIMap, mOMap, mOutputTracks, mOutputTracksType, mTracks, and TrackListCondIterator::Next().

2045 {
2046  // Reset map
2047  mIMap.clear();
2048  mOMap.clear();
2049 
2051  mOutputTracksType = trackType;
2052 
2053  //iterate over tracks of type trackType (All types if Track::All)
2054  TrackListOfKindIterator aIt(trackType, mTracks);
2055  t2bHash added;
2056 
2057  for (Track *aTrack = aIt.First(); aTrack; aTrack = aIt.Next())
2058  {
2059  // Include selected tracks, plus sync-lock selected tracks for Track::All.
2060  if (aTrack->GetSelected() ||
2061  (trackType == Track::All && aTrack->IsSyncLockSelected()))
2062  {
2063  Track *o = mOutputTracks->Add(aTrack->Duplicate());
2064  mIMap.push_back(aTrack);
2065  mOMap.push_back(o);
2066  }
2067  }
2068 }
std::unordered_map< void *, bool > t2bHash
Definition: Effect.cpp:95
TrackList * mTracks
Definition: Effect.h:508
int mOutputTracksType
Definition: Effect.h:481
static std::shared_ptr< TrackList > Create()
Definition: Track.cpp:788
std::vector< Track * > mOMap
Definition: Effect.h:524
Fundamental data object of Audacity, placed in the TrackPanel. Classes derived form it include the Wa...
Definition: Track.h:94
std::vector< Track * > mIMap
Definition: Effect.h:523
std::shared_ptr< TrackList > mOutputTracks
Definition: Effect.h:462
void Effect::CountWaveTracks ( )
private

Definition at line 2259 of file Effect.cpp.

References TrackListCondIterator::First(), Track::GetKind(), Track::GetLinked(), Track::GetSelected(), mNumGroups, mNumTracks, mTracks, TrackListCondIterator::Next(), and Track::Wave.

Referenced by DoEffect(), and Preview().

2260 {
2261  mNumTracks = 0;
2262  mNumGroups = 0;
2263 
2265  Track *t = iter.First();
2266 
2267  while(t) {
2268  if (!t->GetSelected()) {
2269  t = iter.Next();
2270  continue;
2271  }
2272 
2273  if (t->GetKind() == Track::Wave) {
2274  mNumTracks++;
2275  if (!t->GetLinked())
2276  mNumGroups++;
2277  }
2278  t = iter.Next();
2279  }
2280 }
TrackList * mTracks
Definition: Effect.h:508
bool GetSelected() const
Definition: Track.h:268
bool GetLinked() const
Definition: Track.h:271
virtual int GetKind() const
Definition: Track.h:322
int mNumTracks
Definition: Effect.h:526
Fundamental data object of Audacity, placed in the TrackPanel. Classes derived form it include the Wa...
Definition: Track.h:94
int mNumGroups
Definition: Effect.h:527
wxDialog * Effect::CreateUI ( wxWindow *  parent,
EffectUIClientInterface *  client 
)
override

Definition at line 799 of file Effect.cpp.

References safenew.

Referenced by ShowInterface().

800 {
802  { safenew EffectUIHost{ parent, this, client} };
803 
804  if (dlg->Initialize())
805  {
806  // release() is safe because parent will own it
807  return dlg.release();
808  }
809 
810  return NULL;
811 }
#define safenew
Definition: Audacity.h:223
std::unique_ptr< T, Destroyer< T >> Destroy_ptr
Definition: MemoryX.h:814
bool Effect::Delegate ( Effect delegate,
wxWindow *  parent,
bool  shouldPrompt 
)

Definition at line 1260 of file Effect.cpp.

References DoEffect(), mFactory, mProjectRate, mpSelectedRegion, and mTracks.

Referenced by NyquistEffect::ShowInterface().

1261 {
1262  return delegate.DoEffect( parent, mProjectRate, mTracks, mFactory,
1263  mpSelectedRegion, shouldPrompt );
1264 }
TrackList * mTracks
Definition: Effect.h:508
bool DoEffect(wxWindow *parent, double projectRate, TrackList *list, TrackFactory *factory, SelectedRegion *selectedRegion, bool shouldPrompt=true)
Definition: Effect.cpp:1161
double mProjectRate
Definition: Effect.h:456
TrackFactory * mFactory
Definition: Effect.h:460
SelectedRegion * mpSelectedRegion
Definition: Effect.h:459
bool Effect::DoEffect ( wxWindow *  parent,
double  projectRate,
TrackList list,
TrackFactory factory,
SelectedRegion selectedRegion,
bool  shouldPrompt = true 
)

Definition at line 1161 of file Effect.cpp.

References _(), CheckWhetherSkipEffect(), CountWaveTracks(), SelectedRegion::duration(), End(), SelectedRegion::f0(), SelectedRegion::f1(), GetCurrentSettingsGroup(), GetDefaultDuration(), GetPrivateConfig(), GetType(), Init(), IsInteractive(), mDuration, mDurationFormat, mF0, mF1, mFactory, mOutputTracks, mProgress, mProjectRate, mpSelectedRegion, mT0, mT1, mTracks, name, pdlgHideStopButton, Process(), PromptUser(), QUANTIZED_TIME, ReplaceProcessedTracks(), SetPresetParameters(), SelectedRegion::setTimes(), SelectedRegion::t0(), SelectedRegion::t1(), SelectedRegion::UndefinedFrequency, and valueRestorer().

Referenced by Delegate(), and EffectManager::DoEffect().

1167 {
1168  wxASSERT(selectedRegion->duration() >= 0.0);
1169 
1170  mOutputTracks.reset();
1171 
1172  mpSelectedRegion = selectedRegion;
1173  mFactory = factory;
1174  mProjectRate = projectRate;
1175  mTracks = list;
1176 
1177  bool isSelection = false;
1178 
1179  mDuration = 0.0;
1180 
1181  if (GetType() == EffectTypeGenerate)
1182  {
1183  GetPrivateConfig(GetCurrentSettingsGroup(), wxT("LastUsedDuration"), mDuration, GetDefaultDuration());
1184  }
1185 
1186  mT0 = selectedRegion->t0();
1187  mT1 = selectedRegion->t1();
1188  if (mT1 > mT0)
1189  {
1190  // there is a selection: let's fit in there...
1191  // MJS: note that this is just for the TTC and is independent of the track rate
1192  // but we do need to make sure we have the right number of samples at the project rate
1193  double quantMT0 = QUANTIZED_TIME(mT0, mProjectRate);
1194  double quantMT1 = QUANTIZED_TIME(mT1, mProjectRate);
1195  mDuration = quantMT1 - quantMT0;
1196  mT1 = mT0 + mDuration;
1197 
1198  isSelection = true;
1199  }
1200 
1201  mDurationFormat = isSelection ? _("hh:mm:ss + samples") : _("hh:mm:ss + milliseconds");
1202 
1203 #ifdef EXPERIMENTAL_SPECTRAL_EDITING
1204  mF0 = selectedRegion->f0();
1205  mF1 = selectedRegion->f1();
1206  wxArrayString Names;
1208  Names.Add(wxT("control-f0"));
1210  Names.Add(wxT("control-f1"));
1211  SetPresetParameters( &Names, NULL );
1212 
1213 #endif
1214  CountWaveTracks();
1215 
1216  // Note: Init may read parameters from preferences
1217  if (!Init())
1218  {
1219  return false;
1220  }
1221 
1222  // Prompting will be bypassed when applying an effect that has already
1223  // been configured, e.g. repeating the last effect on a different selection.
1224  // Prompting may call Effect::Preview
1225  if (shouldPrompt && IsInteractive() && !PromptUser(parent))
1226  {
1227  return false;
1228  }
1229 
1230  auto cleanup = finally( [&] {
1231  End();
1232 
1233  // In case of failed effect, be sure to free memory.
1234  ReplaceProcessedTracks( false );
1235  } );
1236 
1237  bool returnVal = true;
1238  bool skipFlag = CheckWhetherSkipEffect();
1239  if (skipFlag == false)
1240  {
1241  auto name = GetTranslatedName();
1242  ProgressDialog progress{
1243  name,
1244  wxString::Format(_("Applying %s..."), name),
1246  };
1247  auto vr = valueRestorer( mProgress, &progress );
1248 
1249  returnVal = Process();
1250  }
1251 
1252  if (returnVal)
1253  {
1254  selectedRegion->setTimes(mT0, mT1);
1255  }
1256 
1257  return returnVal;
1258 }
double mT1
Definition: Effect.h:464
void CountWaveTracks()
Definition: Effect.cpp:2259
double t0() const
ProgressDialog Class.
ProgressDialog * mProgress
Definition: Effect.h:455
TrackList * mTracks
Definition: Effect.h:508
bool GetPrivateConfig(const wxString &group, const wxString &key, wxString &value, const wxString &defval=wxEmptyString) override
Definition: Effect.cpp:920
wxString GetCurrentSettingsGroup() override
Definition: Effect.cpp:824
virtual bool Init()
Definition: Effect.cpp:1267
#define QUANTIZED_TIME(time, rate)
Definition: Audacity.h:207
void ReplaceProcessedTracks(const bool bGoodResult)
Definition: Effect.cpp:2170
void SetPresetParameters(const wxArrayString *Names, const wxArrayString *Values)
Definition: Effect.h:243
wxString mDurationFormat
Definition: Effect.h:517
virtual bool Process()
Definition: Effect.cpp:1293
double t1() const
double mF0
Definition: Effect.h:466
double f0() const
EffectType GetType() override
Definition: Effect.cpp:146
virtual void End()
Definition: Effect.cpp:1870
double GetDefaultDuration() override
Definition: Effect.cpp:742
bool IsInteractive() override
Definition: Effect.cpp:245
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom"))), OnMoveTrack) void TrackMenuTable::OnSetName(wxCommandEvent &)
double mProjectRate
Definition: Effect.h:456
bool setTimes(double t0, double t1)
TrackFactory * mFactory
Definition: Effect.h:460
ValueRestorer< T > valueRestorer(T &var)
Definition: MemoryX.h:875
const wxChar * name
Definition: Distortion.cpp:94
SelectedRegion * mpSelectedRegion
Definition: Effect.h:459
double f1() const
double mDuration
Definition: Effect.h:516
double mF1
Definition: Effect.h:467
double duration() const
virtual bool PromptUser(wxWindow *parent)
Definition: Effect.cpp:1273
static const int UndefinedFrequency
std::shared_ptr< TrackList > mOutputTracks
Definition: Effect.h:462
virtual bool CheckWhetherSkipEffect()
Definition: Effect.h:300
double mT0
Definition: Effect.h:463
bool Effect::EnableApply ( bool  enable = true)
protectedvirtual

Definition at line 1889 of file Effect.cpp.

References EnablePreview(), mUIDialog, and mUIParent.

Referenced by EffectAmplify::CheckClip(), EffectRepeat::DisplayNewTime(), EffectAmplify::OnAmpText(), EffectBassTreble::OnBassSlider(), EffectBassTreble::OnBassText(), EffectTruncSilence::OnControlChange(), EffectToneGen::OnControlUpdate(), EffectScienFilter::OnCutoff(), EffectWahwah::OnDepthSlider(), EffectPhaser::OnDepthSlider(), EffectWahwah::OnDepthText(), EffectPhaser::OnDepthText(), EffectPhaser::OnDryWetSlider(), EffectPhaser::OnDryWetText(), EffectPhaser::OnFeedbackSlider(), EffectPhaser::OnFeedbackText(), EffectWahwah::OnFreqOffSlider(), EffectWahwah::OnFreqOffText(), EffectWahwah::OnFreqSlider(), EffectPhaser::OnFreqSlider(), EffectWahwah::OnFreqText(), EffectPhaser::OnFreqText(), EffectWahwah::OnGainSlider(), EffectPhaser::OnGainSlider(), EffectBassTreble::OnGainSlider(), EffectBassTreble::OnGainText(), EffectWahwah::OnGainText(), EffectPhaser::OnGainText(), EffectAmplify::OnPeakText(), EffectWahwah::OnPhaseSlider(), EffectPhaser::OnPhaseSlider(), EffectWahwah::OnPhaseText(), EffectPhaser::OnPhaseText(), EffectWahwah::OnResonanceSlider(), EffectWahwah::OnResonanceText(), EffectScienFilter::OnRipple(), EffectPhaser::OnStagesSlider(), EffectPhaser::OnStagesText(), EffectScienFilter::OnStopbandRipple(), EffectPaulstretch::OnText(), EffectBassTreble::OnTrebleSlider(), EffectBassTreble::OnTrebleText(), EffectNormalize::UpdateUI(), and EffectChangeSpeed::UpdateUI().

1890 {
1891  // May be called during initialization, so try to find the dialog
1892  wxWindow *dlg = mUIDialog;
1893  if (!dlg && mUIParent)
1894  {
1895  dlg = wxGetTopLevelParent(mUIParent);
1896  }
1897 
1898  if (dlg)
1899  {
1900  wxWindow *apply = dlg->FindWindow(wxID_APPLY);
1901 
1902  // Don't allow focus to get trapped
1903  if (!enable)
1904  {
1905  wxWindow *focus = dlg->FindFocus();
1906  if (focus == apply)
1907  {
1908  dlg->FindWindow(wxID_CLOSE)->SetFocus();
1909  }
1910  }
1911 
1912  apply->Enable(enable);
1913  }
1914 
1915  EnablePreview(enable);
1916 
1917  return enable;
1918 }
wxWindow * mUIParent
Definition: Effect.h:475
wxDialog * mUIDialog
Definition: Effect.h:474
virtual bool EnablePreview(bool enable=true)
Definition: Effect.cpp:1920
void Effect::EnableDebug ( bool  enable = true)
protectedvirtual

Definition at line 1959 of file Effect.cpp.

References mUIDebug.

Referenced by NyquistEffect::PopulateOrExchange().

1960 {
1961  mUIDebug = enable;
1962 }
bool mUIDebug
Definition: Effect.h:521
bool Effect::EnablePreview ( bool  enable = true)
protectedvirtual

Definition at line 1920 of file Effect.cpp.

References kFFwdID, kPlayID, kRewindID, mUIDialog, mUIParent, and SupportsRealtime().

Referenced by EnableApply(), and NyquistEffect::TransferDataToWindow().

1921 {
1922  // May be called during initialization, so try to find the dialog
1923  wxWindow *dlg = mUIDialog;
1924  if (!dlg && mUIParent)
1925  {
1926  dlg = wxGetTopLevelParent(mUIParent);
1927  }
1928 
1929  if (dlg)
1930  {
1931  wxWindow *play = dlg->FindWindow(kPlayID);
1932  if (play)
1933  {
1934  wxWindow *rewind = dlg->FindWindow(kRewindID);
1935  wxWindow *ffwd = dlg->FindWindow(kFFwdID);
1936 
1937  // Don't allow focus to get trapped
1938  if (!enable)
1939  {
1940  wxWindow *focus = dlg->FindFocus();
1941  if (focus && (focus == play || focus == rewind || focus == ffwd))
1942  {
1943  dlg->FindWindow(wxID_CLOSE)->SetFocus();
1944  }
1945  }
1946 
1947  play->Enable(enable);
1948  if (SupportsRealtime())
1949  {
1950  rewind->Enable(enable);
1951  ffwd->Enable(enable);
1952  }
1953  }
1954  }
1955 
1956  return enable;
1957 }
static const int kPlayID
Definition: Effect.cpp:81
static const int kFFwdID
Definition: Effect.cpp:83
static const int kRewindID
Definition: Effect.cpp:82
wxWindow * mUIParent
Definition: Effect.h:475
wxDialog * mUIDialog
Definition: Effect.h:474
bool SupportsRealtime() override
Definition: Effect.cpp:275
void Effect::End ( )
protectedvirtual

Reimplemented in EffectAutoDuck, and EffectStereoToMono.

Definition at line 1870 of file Effect.cpp.

Referenced by DoEffect(), and Preview().

1871 {
1872 }
void Effect::ExportPresets ( )
override

Definition at line 723 of file Effect.cpp.

724 {
725 }
unsigned Effect::GetAudioInCount ( )
override

Definition at line 307 of file Effect.cpp.

References mClient.

Referenced by Process(), and Startup().

308 {
309  if (mClient)
310  {
311  return mClient->GetAudioInCount();
312  }
313 
314  return 0;
315 }
EffectClientInterface * mClient
Definition: Effect.h:530
unsigned Effect::GetAudioOutCount ( )
override

Definition at line 317 of file Effect.cpp.

References mClient.

Referenced by Process(), and Startup().

318 {
319  if (mClient)
320  {
321  return mClient->GetAudioOutCount();
322  }
323 
324  return 0;
325 }
EffectClientInterface * mClient
Definition: Effect.h:530
bool Effect::GetAutomationParameters ( EffectAutomationParameters &  parms)
override

Definition at line 589 of file Effect.cpp.

References mClient.

Referenced by GetAutomationParameters(), EffectManager::GetEffectParameters(), and SaveUserPreset().

590 {
591  if (mClient)
592  {
593  return mClient->GetAutomationParameters(parms);
594  }
595 
596  return true;
597 }
EffectClientInterface * mClient
Definition: Effect.h:530
bool Effect::GetAutomationParameters ( wxString &  parms)
virtual

Definition at line 1025 of file Effect.cpp.

References GetAutomationParameters(), mUIDialog, and TransferDataFromWindow().

1026 {
1027  EffectAutomationParameters eap;
1028 
1030  {
1031  return false;
1032  }
1033 
1034  if (!GetAutomationParameters(eap))
1035  {
1036  return false;
1037  }
1038 
1039  return eap.GetParameters(parms);
1040 }
virtual bool TransferDataFromWindow()
Definition: Effect.cpp:1884
bool GetAutomationParameters(EffectAutomationParameters &parms) override
Definition: Effect.cpp:589
wxDialog * mUIDialog
Definition: Effect.h:474
wxString Effect::GetCurrentSettingsGroup ( )
override
double Effect::GetDefaultDuration ( )
override

Definition at line 742 of file Effect.cpp.

Referenced by DoEffect().

743 {
744  return 30.0;
745 }
wxString Effect::GetDescription ( )
override

Definition at line 206 of file Effect.cpp.

References mClient.

207 {
208  if (mClient)
209  {
210  return mClient->GetDescription();
211  }
212 
213  return wxEmptyString;
214 }
EffectClientInterface * mClient
Definition: Effect.h:530
double Effect::GetDuration ( )
override
wxString Effect::GetDurationFormat ( )
override
wxString Effect::GetFactoryDefaultsGroup ( )
override

Definition at line 829 of file Effect.cpp.

Referenced by HasFactoryDefaults(), LoadFactoryDefaults(), SetAutomationParameters(), and Startup().

830 {
831  return wxT("FactoryDefaults");
832 }
wxArrayString Effect::GetFactoryPresets ( )
override

Definition at line 641 of file Effect.cpp.

References mClient.

Referenced by EffectManager::HasPresets(), and SetAutomationParameters().

642 {
643  if (mClient)
644  {
645  return mClient->GetFactoryPresets();
646  }
647 
648  return wxArrayString();
649 }
EffectClientInterface * mClient
Definition: Effect.h:530
wxString Effect::GetFamilyId ( )
override

Definition at line 216 of file Effect.cpp.

References mClient, and XO.

Referenced by Preview().

217 {
218  if (mClient)
219  {
220  return mClient->GetFamilyId();
221  }
222 
223  // PRL: In 2.2.2 we wanted to change the user-visible name to
224  // "Built-in" but we did not do it the obvious way by just changing this
225  // string, because of problems with compatibility of pluginsettings.cfg
226  // See PluginDescriptor::GetTranslatedEffectFamily and
227  // EffectUIHost::OnMenu
228  // See PluginManager::RegisterPlugin and PluginManager::GetID, where the
229  // return value is also (mis?)used for internal identification purposes,
230  // NOT as a user-visible string!
231  // Thereby affecting configuration file contents!
232  return XO("Audacity");
233 }
EffectClientInterface * mClient
Definition: Effect.h:530
#define XO(s)
Definition: Internat.h:30
wxString Effect::GetFamilyName ( )
override

Definition at line 235 of file Effect.cpp.

References mClient, and XO.

236 {
237  if (mClient)
238  {
239  return mClient->GetFamilyName();
240  }
241 
242  return XO("Built-in");
243 }
EffectClientInterface * mClient
Definition: Effect.h:530
#define XO(s)
Definition: Internat.h:30
PluginID Effect::GetID ( )
virtual
sampleCount Effect::GetLatency ( )
override

Definition at line 369 of file Effect.cpp.

References mClient.

Referenced by ProcessTrack().

370 {
371  if (mClient)
372  {
373  return mClient->GetLatency();
374  }
375 
376  return 0;
377 }
EffectClientInterface * mClient
Definition: Effect.h:530
int Effect::GetMidiInCount ( )
override

Definition at line 327 of file Effect.cpp.

References mClient.

328 {
329  if (mClient)
330  {
331  return mClient->GetMidiInCount();
332  }
333 
334  return 0;
335 }
EffectClientInterface * mClient
Definition: Effect.h:530
int Effect::GetMidiOutCount ( )
override

Definition at line 337 of file Effect.cpp.

References mClient.

338 {
339  if (mClient)
340  {
341  return mClient->GetMidiOutCount();
342  }
343 
344  return 0;
345 }
EffectClientInterface * mClient
Definition: Effect.h:530
wxString Effect::GetName ( )
override

Definition at line 176 of file Effect.cpp.

References GetSymbol(), and mClient.

177 {
178  if (mClient)
179  {
180  return mClient->GetName();
181  }
182 
183  return GetSymbol();
184 }
wxString GetSymbol() override
Definition: Effect.cpp:166
EffectClientInterface * mClient
Definition: Effect.h:530
int Effect::GetNumWaveGroups ( )
inlineprotected

Definition at line 348 of file Effect.h.

Referenced by NyquistEffect::Process().

348 { return mNumGroups; }
int mNumGroups
Definition: Effect.h:527
int Effect::GetNumWaveTracks ( )
inlineprotected
int Effect::GetPass ( )
protectedvirtual

Definition at line 1278 of file Effect.cpp.

References mPass.

1279 {
1280  return mPass;
1281 }
int mPass
Definition: Effect.h:471
wxString Effect::GetPath ( )
override

Definition at line 156 of file Effect.cpp.

References BUILTIN_EFFECT_PREFIX, GetSymbol(), and mClient.

157 {
158  if (mClient)
159  {
160  return mClient->GetPath();
161  }
162 
163  return BUILTIN_EFFECT_PREFIX + GetSymbol();
164 }
wxString GetSymbol() override
Definition: Effect.cpp:166
#define BUILTIN_EFFECT_PREFIX
Definition: Effect.h:46
EffectClientInterface * mClient
Definition: Effect.h:530
wxString Effect::GetPreset ( wxWindow *  parent,
const wxString &  parms 
)
virtual

Definition at line 1115 of file Effect.cpp.

References EffectPresetsDialog::GetSelected(), and EffectPresetsDialog::SetSelected().

Referenced by EffectManager::GetPreset().

1116 {
1117  EffectPresetsDialog dlg(parent, this);
1118  dlg.Layout();
1119  dlg.Fit();
1120  dlg.SetSize(dlg.GetMinSize());
1121  dlg.CenterOnParent();
1122  dlg.SetSelected(parms);
1123 
1124  if (dlg.ShowModal())
1125  {
1126  return dlg.GetSelected();
1127  }
1128 
1129  return wxEmptyString;
1130 }
bool Effect::GetPrivateConfig ( const wxString &  group,
const wxString &  key,
wxString &  value,
const wxString &  defval = wxEmptyString 
)
override

Definition at line 920 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::GetPrivateConfig().

Referenced by DoEffect(), LoadUserPreset(), EffectChangeSpeed::PopulateOrExchange(), Startup(), and EffectChangeSpeed::Update_Vinyl().

921 {
922  return PluginManager::Get().GetPrivateConfig(GetID(), group, key, value, defval);
923 }
virtual PluginID GetID()
Definition: Effect.cpp:982
bool GetPrivateConfig(const PluginID &ID, const wxString &group, const wxString &key, wxString &value, const wxString &defval=_T("")) override
static PluginManager & Get()
bool Effect::GetPrivateConfig ( const wxString &  group,
const wxString &  key,
int &  value,
int  defval = 0 
)
override

Definition at line 925 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::GetPrivateConfig().

926 {
927  return PluginManager::Get().GetPrivateConfig(GetID(), group, key, value, defval);
928 }
virtual PluginID GetID()
Definition: Effect.cpp:982
bool GetPrivateConfig(const PluginID &ID, const wxString &group, const wxString &key, wxString &value, const wxString &defval=_T("")) override
static PluginManager & Get()
bool Effect::GetPrivateConfig ( const wxString &  group,
const wxString &  key,
bool &  value,
bool  defval = false 
)
override

Definition at line 930 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::GetPrivateConfig().

931 {
932  return PluginManager::Get().GetPrivateConfig(GetID(), group, key, value, defval);
933 }
virtual PluginID GetID()
Definition: Effect.cpp:982
bool GetPrivateConfig(const PluginID &ID, const wxString &group, const wxString &key, wxString &value, const wxString &defval=_T("")) override
static PluginManager & Get()
bool Effect::GetPrivateConfig ( const wxString &  group,
const wxString &  key,
float &  value,
float  defval = 0.0 
)
override

Definition at line 935 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::GetPrivateConfig().

936 {
937  return PluginManager::Get().GetPrivateConfig(GetID(), group, key, value, defval);
938 }
virtual PluginID GetID()
Definition: Effect.cpp:982
bool GetPrivateConfig(const PluginID &ID, const wxString &group, const wxString &key, wxString &value, const wxString &defval=_T("")) override
static PluginManager & Get()
bool Effect::GetPrivateConfig ( const wxString &  group,
const wxString &  key,
double &  value,
double  defval = 0.0 
)
override

Definition at line 940 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::GetPrivateConfig().

941 {
942  return PluginManager::Get().GetPrivateConfig(GetID(), group, key, value, defval);
943 }
virtual PluginID GetID()
Definition: Effect.cpp:982
bool GetPrivateConfig(const PluginID &ID, const wxString &group, const wxString &key, wxString &value, const wxString &defval=_T("")) override
static PluginManager & Get()
bool Effect::GetPrivateConfigSubgroups ( const wxString &  group,
wxArrayString &  subgroups 
)
override

Definition at line 915 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::GetPrivateConfigSubgroups().

Referenced by GetUserPresets().

916 {
917  return PluginManager::Get().GetPrivateConfigSubgroups(GetID(), group, subgroups);
918 }
virtual PluginID GetID()
Definition: Effect.cpp:982
bool GetPrivateConfigSubgroups(const PluginID &ID, const wxString &group, wxArrayString &subgroups) override
static PluginManager & Get()
void Effect::GetSamples ( const WaveTrack track,
sampleCount *  start,
sampleCount *  len 
)
protected

Definition at line 2004 of file Effect.cpp.

References WaveTrack::GetEndTime(), WaveTrack::GetStartTime(), GetType(), WaveTrack::InsertSilence(), mDuration, mT0, mT1, and WaveTrack::TimeToLongSamples().

Referenced by ProcessPass().

2006 {
2007  double trackStart = track->GetStartTime();
2008  double trackEnd = track->GetEndTime();
2009  double t0 = mT0 < trackStart ? trackStart : mT0;
2010  double t1 = mT1 > trackEnd ? trackEnd : mT1;
2011 
2012 #if 0
2013  if (GetType() & INSERT_EFFECT) {
2014  t1 = t0 + mDuration;
2015  if (mT0 == mT1) {
2016  // Not really part of the calculation, but convenient to put here
2017  track->InsertSilence(t0, t1);
2018  }
2019  }
2020 #endif
2021 
2022  if (t1 > t0) {
2023  *start = track->TimeToLongSamples(t0);
2024  auto end = track->TimeToLongSamples(t1);
2025  *len = end - *start;
2026  }
2027  else {
2028  *start = 0;
2029  *len = 0;
2030  }
2031 }
double mT1
Definition: Effect.h:464
void InsertSilence(double t, double len) override
Definition: WaveTrack.cpp:1391
EffectType GetType() override
Definition: Effect.cpp:146
sampleCount TimeToLongSamples(double t0) const
Convert correctly between an (absolute) time in seconds and a number of samples.
Definition: WaveTrack.cpp:1849
double GetEndTime() const
Get the time at which the last clip in the track ends, plus recorded stuff.
Definition: WaveTrack.cpp:1879
double mDuration
Definition: Effect.h:516
double mT0
Definition: Effect.h:463
double GetStartTime() const
Get the time at which the first clip in the track starts.
Definition: WaveTrack.cpp:1859
wxString Effect::GetSavedStateGroup ( )
virtual

Definition at line 834 of file Effect.cpp.

Referenced by SetBatchProcessing().

835 {
836  return wxT("SavedState");
837 }
wxString Effect::GetSelectionFormat ( )
virtual

Definition at line 762 of file Effect.cpp.

References GetActiveProject(), and AudacityProject::GetSelectionFormat().

Referenced by EffectRepeat::DisplayNewTime().

763 {
765 }
AUDACITY_DLL_API AudacityProject * GetActiveProject()
Definition: Project.cpp:300
const wxString & GetSelectionFormat() const
Definition: Project.cpp:1652
bool Effect::GetSharedConfig ( const wxString &  group,
const wxString &  key,
wxString &  value,
const wxString &  defval = wxEmptyString 
)
override

Definition at line 850 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::GetSharedConfig().

851 {
852  return PluginManager::Get().GetSharedConfig(GetID(), group, key, value, defval);
853 }
virtual PluginID GetID()
Definition: Effect.cpp:982
bool GetSharedConfig(const PluginID &ID, const wxString &group, const wxString &key, wxString &value, const wxString &defval=_T("")) override
static PluginManager & Get()
bool Effect::GetSharedConfig ( const wxString &  group,
const wxString &  key,
int &  value,
int  defval = 0 
)
override

Definition at line 855 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::GetSharedConfig().

856 {
857  return PluginManager::Get().GetSharedConfig(GetID(), group, key, value, defval);
858 }
virtual PluginID GetID()
Definition: Effect.cpp:982
bool GetSharedConfig(const PluginID &ID, const wxString &group, const wxString &key, wxString &value, const wxString &defval=_T("")) override
static PluginManager & Get()
bool Effect::GetSharedConfig ( const wxString &  group,
const wxString &  key,
bool &  value,
bool  defval = false 
)
override

Definition at line 860 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::GetSharedConfig().

861 {
862  return PluginManager::Get().GetSharedConfig(GetID(), group, key, value, defval);
863 }
virtual PluginID GetID()
Definition: Effect.cpp:982
bool GetSharedConfig(const PluginID &ID, const wxString &group, const wxString &key, wxString &value, const wxString &defval=_T("")) override
static PluginManager & Get()
bool Effect::GetSharedConfig ( const wxString &  group,
const wxString &  key,
float &  value,
float  defval = 0.0 
)
override

Definition at line 865 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::GetSharedConfig().

866 {
867  return PluginManager::Get().GetSharedConfig(GetID(), group, key, value, defval);
868 }
virtual PluginID GetID()
Definition: Effect.cpp:982
bool GetSharedConfig(const PluginID &ID, const wxString &group, const wxString &key, wxString &value, const wxString &defval=_T("")) override
static PluginManager & Get()
bool Effect::GetSharedConfig ( const wxString &  group,
const wxString &  key,
double &  value,
double  defval = 0.0 
)
override

Definition at line 870 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::GetSharedConfig().

871 {
872  return PluginManager::Get().GetSharedConfig(GetID(), group, key, value, defval);
873 }
virtual PluginID GetID()
Definition: Effect.cpp:982
bool GetSharedConfig(const PluginID &ID, const wxString &group, const wxString &key, wxString &value, const wxString &defval=_T("")) override
static PluginManager & Get()
bool Effect::GetSharedConfigSubgroups ( const wxString &  group,
wxArrayString &  subgroups 
)
override

Definition at line 845 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::GetSharedConfigSubgroups().

846 {
847  return PluginManager::Get().GetSharedConfigSubgroups(GetID(), group, subgroups);
848 }
bool GetSharedConfigSubgroups(const PluginID &ID, const wxString &group, wxArrayString &subgroups) override
virtual PluginID GetID()
Definition: Effect.cpp:982
static PluginManager & Get()
wxString Effect::GetSymbol ( )
override

Definition at line 166 of file Effect.cpp.

References mClient.

Referenced by GetName(), and GetPath().

167 {
168  if (mClient)
169  {
170  return mClient->GetSymbol();
171  }
172 
173  return wxEmptyString;
174 }
EffectClientInterface * mClient
Definition: Effect.h:530
size_t Effect::GetTailSize ( )
override

Definition at line 379 of file Effect.cpp.

References mClient.

380 {
381  if (mClient)
382  {
383  return mClient->GetTailSize();
384  }
385 
386  return 0;
387 }
EffectClientInterface * mClient
Definition: Effect.h:530
EffectType Effect::GetType ( )
override

Definition at line 146 of file Effect.cpp.

References mClient.

Referenced by DoEffect(), GetSamples(), Preview(), ProcessPass(), ProcessTrack(), and SetDuration().

147 {
148  if (mClient)
149  {
150  return mClient->GetType();
151  }
152 
153  return EffectTypeNone;
154 }
EffectClientInterface * mClient
Definition: Effect.h:530
wxArrayString Effect::GetUserPresets ( )
virtual

Definition at line 1094 of file Effect.cpp.

References GetPrivateConfigSubgroups(), and GetUserPresetsGroup().

Referenced by EffectManager::HasPresets().

1095 {
1096  wxArrayString presets;
1097 
1098  GetPrivateConfigSubgroups(GetUserPresetsGroup(wxEmptyString), presets);
1099 
1100  presets.Sort();
1101 
1102  return presets;
1103 }
wxString GetUserPresetsGroup(const wxString &name) override
Definition: Effect.cpp:813
bool GetPrivateConfigSubgroups(const wxString &group, wxArrayString &subgroups) override
Definition: Effect.cpp:915
wxString Effect::GetUserPresetsGroup ( const wxString &  name)
override

Definition at line 813 of file Effect.cpp.

References name.

Referenced by GetUserPresets(), SetAutomationParameters(), and EffectReverb::Startup().

814 {
815  wxString group = wxT("UserPresets");
816  if (!name.IsEmpty())
817  {
818  group += wxCONFIG_PATH_SEPARATOR + name;
819  }
820 
821  return group;
822 }
const wxChar * name
Definition: Distortion.cpp:94
wxString Effect::GetVendor ( )
override

Definition at line 186 of file Effect.cpp.

References mClient, and XO.

187 {
188  if (mClient)
189  {
190  return mClient->GetVendor();
191  }
192 
193  return XO("Audacity");
194 }
EffectClientInterface * mClient
Definition: Effect.h:530
#define XO(s)
Definition: Internat.h:30
wxString Effect::GetVersion ( )
override

Definition at line 196 of file Effect.cpp.

References AUDACITY_VERSION_STRING, and mClient.

197 {
198  if (mClient)
199  {
200  return mClient->GetVersion();
201  }
202 
204 }
#define AUDACITY_VERSION_STRING
Definition: Audacity.h:81
EffectClientInterface * mClient
Definition: Effect.h:530
bool Effect::HasCurrentSettings ( )
virtual

Definition at line 1105 of file Effect.cpp.

References GetCurrentSettingsGroup(), and HasPrivateConfigGroup().

Referenced by EffectManager::GetDefaultPreset(), and EffectManager::HasPresets().

1106 {
1108 }
wxString GetCurrentSettingsGroup() override
Definition: Effect.cpp:824
bool HasPrivateConfigGroup(const wxString &group) override
Definition: Effect.cpp:910
bool Effect::HasFactoryDefaults ( )
virtual

Definition at line 1110 of file Effect.cpp.

References GetFactoryDefaultsGroup(), and HasPrivateConfigGroup().

Referenced by EffectManager::GetDefaultPreset(), and EffectManager::HasPresets().

1111 {
1113 }
bool HasPrivateConfigGroup(const wxString &group) override
Definition: Effect.cpp:910
wxString GetFactoryDefaultsGroup() override
Definition: Effect.cpp:829
bool Effect::HasOptions ( )
override

Definition at line 731 of file Effect.cpp.

732 {
733  return false;
734 }
bool Effect::HasPrivateConfigGroup ( const wxString &  group)
override

Definition at line 910 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::HasPrivateConfigGroup().

Referenced by HasCurrentSettings(), and HasFactoryDefaults().

911 {
913 }
virtual PluginID GetID()
Definition: Effect.cpp:982
bool HasPrivateConfigGroup(const PluginID &ID, const wxString &group)
static PluginManager & Get()
bool Effect::HasSharedConfigGroup ( const wxString &  group)
override

Definition at line 840 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::HasSharedConfigGroup().

841 {
842  return PluginManager::Get().HasSharedConfigGroup(GetID(), group);
843 }
virtual PluginID GetID()
Definition: Effect.cpp:982
bool HasSharedConfigGroup(const PluginID &ID, const wxString &group)
static PluginManager & Get()
wxString Effect::HelpPage ( )
virtual

Reimplemented in NyquistEffect.

Definition at line 1137 of file Effect.cpp.

1138 {
1139  return wxEmptyString;
1140 }
bool Effect::HideUI ( )
override

Definition at line 702 of file Effect.cpp.

703 {
704  return true;
705 }
void Effect::ImportPresets ( )
override

Definition at line 727 of file Effect.cpp.

728 {
729 }
void Effect::IncludeNotSelectedPreviewTracks ( bool  includeNotSelected)
protected

Definition at line 1975 of file Effect.cpp.

References mPreviewWithNotSelected.

1976 {
1977  mPreviewWithNotSelected = includeNotSelected;
1978 }
bool mPreviewWithNotSelected
Definition: Effect.h:512
bool Effect::Init ( )
protectedvirtual

Reimplemented in EffectEqualization, NyquistEffect, EffectScienFilter, EffectAmplify, EffectChangeSpeed, EffectDtmf, EffectAutoDuck, EffectNoiseReduction, and Generator.

Definition at line 1267 of file Effect.cpp.

Referenced by DoEffect(), and Preview().

1268 {
1269  return true;
1270 }
bool Effect::InitPass1 ( )
protectedvirtual

Reimplemented in EffectCompressor, and EffectTwoPassSimpleMono.

Definition at line 1283 of file Effect.cpp.

Referenced by Process().

1284 {
1285  return true;
1286 }
bool Effect::InitPass2 ( )
protectedvirtual

Reimplemented in EffectCompressor, and EffectTwoPassSimpleMono.

Definition at line 1288 of file Effect.cpp.

Referenced by Process().

1289 {
1290  return false;
1291 }
TrackList* Effect::inputTracks ( ) const
inlineprotected
bool Effect::IsBatchProcessing ( )
virtual

Definition at line 1142 of file Effect.cpp.

References mIsBatch.

Referenced by EffectAmplify::PopulateOrExchange(), and PromptUser().

1143 {
1144  return mIsBatch;
1145 }
bool mIsBatch
Definition: Effect.h:510
bool Effect::IsDefault ( )
override

Definition at line 255 of file Effect.cpp.

References mClient.

256 {
257  if (mClient)
258  {
259  return mClient->IsDefault();
260  }
261 
262  return true;
263 }
EffectClientInterface * mClient
Definition: Effect.h:530
bool Effect::IsGraphicalUI ( )
override

Definition at line 692 of file Effect.cpp.

693 {
694  return false;
695 }
bool Effect::IsHidden ( )
virtual

Reimplemented in EffectStereoToMono.

Definition at line 2475 of file Effect.cpp.

Referenced by EffectManager::IsHidden().

2476 {
2477  return false;
2478 }
bool Effect::IsInteractive ( )
override

Definition at line 245 of file Effect.cpp.

References mClient.

Referenced by DoEffect(), and ShowInterface().

246 {
247  if (mClient)
248  {
249  return mClient->IsInteractive();
250  }
251 
252  return true;
253 }
EffectClientInterface * mClient
Definition: Effect.h:530
bool Effect::IsLegacy ( )
override

Definition at line 265 of file Effect.cpp.

References mClient.

266 {
267  if (mClient)
268  {
269  return false;
270  }
271 
272  return true;
273 }
EffectClientInterface * mClient
Definition: Effect.h:530
bool Effect::IsPreviewing ( )
inlineprotected

Definition at line 364 of file Effect.h.

Referenced by NyquistEffect::Process(), and EffectPaulstretch::ProcessOne().

364 { return mIsPreview; }
bool mIsPreview
Definition: Effect.h:519
bool Effect::IsReady ( )
override

Definition at line 389 of file Effect.cpp.

References mClient.

390 {
391  if (mClient)
392  {
393  return mClient->IsReady();
394  }
395 
396  return true;
397 }
EffectClientInterface * mClient
Definition: Effect.h:530
bool Effect::IsRealtimeActive ( )

Definition at line 2470 of file Effect.cpp.

References mRealtimeSuspendCount.

2471 {
2472  return mRealtimeSuspendCount == 0;
2473 }
int mRealtimeSuspendCount
Definition: Effect.h:542
bool Effect::LoadFactoryDefaults ( )
override

Definition at line 661 of file Effect.cpp.

References GetFactoryDefaultsGroup(), LoadUserPreset(), and mClient.

Referenced by EffectChangeSpeed::LoadFactoryDefaults(), and EffectEqualization::LoadFactoryDefaults().

662 {
663  if (mClient)
664  {
665  return mClient->LoadFactoryDefaults();
666  }
667 
669 }
EffectClientInterface * mClient
Definition: Effect.h:530
bool LoadUserPreset(const wxString &name) override
Definition: Effect.cpp:609
wxString GetFactoryDefaultsGroup() override
Definition: Effect.cpp:829
bool Effect::LoadFactoryPreset ( int  id)
override

Definition at line 651 of file Effect.cpp.

References mClient.

Referenced by SetAutomationParameters().

652 {
653  if (mClient)
654  {
655  return mClient->LoadFactoryPreset(id);
656  }
657 
658  return true;
659 }
EffectClientInterface * mClient
Definition: Effect.h:530
bool Effect::LoadUserPreset ( const wxString &  name)
override

Definition at line 609 of file Effect.cpp.

References GetPrivateConfig(), mClient, and SetAutomationParameters().

Referenced by NyquistEffect::Init(), LoadFactoryDefaults(), EffectEqualization::PopulateUI(), SetAutomationParameters(), SetBatchProcessing(), and Startup().

610 {
611  if (mClient)
612  {
613  return mClient->LoadUserPreset(name);
614  }
615 
616  wxString parms;
617  if (!GetPrivateConfig(name, wxT("Parameters"), parms))
618  {
619  return false;
620  }
621 
622  return SetAutomationParameters(parms);
623 }
bool GetPrivateConfig(const wxString &group, const wxString &key, wxString &value, const wxString &defval=wxEmptyString) override
Definition: Effect.cpp:920
EffectClientInterface * mClient
Definition: Effect.h:530
const wxChar * name
Definition: Distortion.cpp:94
bool SetAutomationParameters(EffectAutomationParameters &parms) override
Definition: Effect.cpp:599
wxString Effect::ManualPage ( )
virtual
int Effect::MessageBox ( const wxString &  message,
long  style = DefaultMessageBoxStyle,
const wxString &  titleStr = wxString{} 
)

Definition at line 2665 of file Effect.cpp.

References _(), AudacityMessageBox(), and mUIParent.

Referenced by EffectAutoDuck::Init(), EffectScienFilter::Init(), NyquistEffect::Init(), EffectEqualization::Init(), EffectEqualization::LoadCurves(), NyquistEffect::OnLoad(), NyquistEffect::OnSave(), NyquistEffect::ParseProgram(), EffectRepair::Process(), EffectNoiseReduction::Process(), Generator::Process(), EffectClickRemoval::Process(), NyquistEffect::Process(), EffectTruncSilence::ProcessIndependently(), EffectEcho::ProcessInitialize(), EffectPaulstretch::ProcessOne(), EffectFindClipping::ProcessOne(), EffectClickRemoval::ProcessOne(), NyquistEffect::ProcessOne(), SetAutomationParameters(), EffectEqualization::setCurve(), and EffectEqualization::ValidateUI().

2666 {
2667  wxString title;
2668  if (titleStr.empty())
2669  title = GetTranslatedName();
2670  else
2671  title = wxString::Format(_("%s: %s"), GetTranslatedName(), titleStr);
2672  return AudacityMessageBox(message, title, style, mUIParent);
2673 }
int AudacityMessageBox(const wxString &message, const wxString &caption=AudacityMessageBoxCaptionStr(), long style=wxOK|wxCENTRE, wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord)
Definition: ErrorDialog.h:92
wxWindow * mUIParent
Definition: Effect.h:475
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom"))), OnMoveTrack) void TrackMenuTable::OnSetName(wxCommandEvent &)
auto Effect::ModifyAnalysisTrack ( const LabelTrack pOrigTrack,
const wxString &  name = wxString() 
)
protected

Definition at line 2163 of file Effect.cpp.

Referenced by EffectFindClipping::Process().

2164 {
2165  return{ this, pOrigTrack, name };
2166 }
const wxChar * name
Definition: Distortion.cpp:94
void Effect::PopulateOrExchange ( ShuttleGui S)
protectedvirtual
bool Effect::PopulateUI ( wxWindow *  parent)
override

Definition at line 677 of file Effect.cpp.

References eIsCreating, mUIParent, and PopulateOrExchange().

678 {
679  mUIParent = parent;
680  mUIParent->PushEventHandler(this);
681 
682 // LoadUserPreset(GetCurrentSettingsGroup());
683 
686 
687  mUIParent->SetMinSize(mUIParent->GetSizer()->GetMinSize());
688 
689  return true;
690 }
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:366
wxWindow * mUIParent
Definition: Effect.h:475
virtual void PopulateOrExchange(ShuttleGui &S)
Definition: Effect.cpp:1874
void Effect::Preview ( )
override

Definition at line 794 of file Effect.cpp.

Referenced by EffectAmplify::Preview().

795 {
796  Preview(false);
797 }
void Preview() override
Definition: Effect.cpp:794
void Effect::Preview ( bool  dryOnly)
protectedvirtual

Reimplemented in EffectAmplify.

Definition at line 2480 of file Effect.cpp.

References _(), TrackList::Add(), CalcPreviewInputLength(), WaveTrack::Copy(), CountWaveTracks(), TrackList::Create(), End(), TrackListCondIterator::First(), gAudioIO, GetFamilyId(), Track::GetSelected(), AudioIO::GetStreamTime(), GetType(), gPrefs, GuardedCall(), Init(), AudioIO::IsBusy(), AudioIO::IsStreamActive(), mDuration, mFactory, min(), mIsLinearEffect, mIsPreview, MixAndRender(), mNumTracks, mPreviewFullSelection, mPreviewWithNotSelected, mProgress, mProjectRate, mT0, mT1, mTracks, TrackListCondIterator::Next(), WaveTrack::NoDisplay, NYQUISTEFFECTS_FAMILY, Track::Offset(), pdlgHideCancelButton, Process(), ReplaceProcessedTracks(), ShowErrorDialog(), AudioIO::StartStream(), AudioIO::StopStream(), Success, ProgressDialog::Update(), valueRestorer(), and Track::Wave.

2481 {
2482  if (mNumTracks == 0) { // nothing to preview
2483  return;
2484  }
2485 
2486  if (gAudioIO->IsBusy()) {
2487  return;
2488  }
2489 
2490  wxWindow *FocusDialog = wxWindow::FindFocus();
2491 
2492  double previewDuration;
2493  bool isNyquist = GetFamilyId().IsSameAs(NYQUISTEFFECTS_FAMILY);
2494  bool isGenerator = GetType() == EffectTypeGenerate;
2495 
2496  // Mix a few seconds of audio from all of the tracks
2497  double previewLen;
2498  gPrefs->Read(wxT("/AudioIO/EffectsPreviewLen"), &previewLen, 6.0);
2499 
2500  const double rate = mProjectRate;
2501 
2502  if (isNyquist && isGenerator) {
2503  previewDuration = CalcPreviewInputLength(previewLen);
2504  }
2505  else {
2506  previewDuration = wxMin(mDuration, CalcPreviewInputLength(previewLen));
2507  }
2508 
2509  double t1 = mT0 + previewDuration;
2510 
2511  if ((t1 > mT1) && !(isNyquist && isGenerator)) {
2512  t1 = mT1;
2513  }
2514 
2515  if (t1 <= mT0)
2516  return;
2517 
2518  bool success = true;
2519  auto vr0 = valueRestorer( mT0 );
2520  auto vr1 = valueRestorer( mT1 );
2521  // Most effects should stop at t1.
2522  if (!mPreviewFullSelection)
2523  mT1 = t1;
2524 
2525  // Save the original track list
2526  TrackList *saveTracks = mTracks;
2527 
2528  auto cleanup = finally( [&] {
2529  mTracks = saveTracks;
2530 
2531  // Effect is already inited; we will call Process, End, and then Init
2532  // again, so the state is exactly the way it was before Preview
2533  // was called.
2534  if (!dryOnly) {
2535  End();
2536  GuardedCall( [&]{ Init(); } );
2537  }
2538 
2539  if (FocusDialog) {
2540  FocusDialog->SetFocus();
2541  }
2542 
2543  // In case of failed effect, be sure to free memory.
2544  ReplaceProcessedTracks( false );
2545  } );
2546 
2547  // Build NEW tracklist from rendering tracks
2548  auto uTracks = TrackList::Create();
2549  mTracks = uTracks.get();
2550 
2551  // Linear Effect preview optimised by pre-mixing to one track.
2552  // Generators need to generate per track.
2553  if (mIsLinearEffect && !isGenerator) {
2554  WaveTrack::Holder mixLeft, mixRight;
2555  MixAndRender(saveTracks, mFactory, rate, floatSample, mT0, t1, mixLeft, mixRight);
2556  if (!mixLeft)
2557  return;
2558 
2559  mixLeft->Offset(-mixLeft->GetStartTime());
2560  mixLeft->SetSelected(true);
2561  mixLeft->SetDisplay(WaveTrack::NoDisplay);
2562  mTracks->Add(std::move(mixLeft));
2563  if (mixRight) {
2564  mixRight->Offset(-mixRight->GetStartTime());
2565  mixRight->SetSelected(true);
2566  mTracks->Add(std::move(mixRight));
2567  }
2568  }
2569  else {
2570  TrackListOfKindIterator iter(Track::Wave, saveTracks);
2571  WaveTrack *src = (WaveTrack *) iter.First();
2572  while (src)
2573  {
2574  if (src->GetSelected() || mPreviewWithNotSelected) {
2575  auto dest = src->Copy(mT0, t1);
2576  dest->SetSelected(src->GetSelected());
2577  static_cast<WaveTrack*>(dest.get())->SetDisplay(WaveTrack::NoDisplay);
2578  mTracks->Add(std::move(dest));
2579  }
2580  src = (WaveTrack *) iter.Next();
2581  }
2582  }
2583 
2584  // NEW tracks start at time zero.
2585  // Adjust mT0 and mT1 to be the times to process, and to
2586  // play back in these tracks
2587  mT1 -= mT0;
2588  mT0 = 0.0;
2589 
2590 
2591  // Update track/group counts
2592  CountWaveTracks();
2593 
2594  // Apply effect
2595  if (!dryOnly) {
2596  ProgressDialog progress{
2597  GetTranslatedName(),
2598  _("Preparing preview"),
2600  }; // Have only "Stop" button.
2601  auto vr = valueRestorer( mProgress, &progress );
2602 
2603  auto vr2 = valueRestorer( mIsPreview, true );
2604 
2605  success = Process();
2606  }
2607 
2608  if (success)
2609  {
2610  WaveTrackConstArray playbackTracks;
2611  WaveTrackArray recordingTracks;
2612 
2614  WaveTrack *src = (WaveTrack *) iter.First();
2615  while (src) {
2616  playbackTracks.push_back(Track::Pointer<WaveTrack>(src));
2617  src = (WaveTrack *) iter.Next();
2618  }
2619  // Some effects (Paulstretch) may need to generate more
2620  // than previewLen, so take the min.
2621  t1 = std::min(mT0 + previewLen, mT1);
2622 
2623 #ifdef EXPERIMENTAL_MIDI_OUT
2624  NoteTrackArray empty;
2625 #endif
2626  // Start audio playing
2627  AudioIOStartStreamOptions options { rate };
2628  int token =
2629  gAudioIO->StartStream(playbackTracks, recordingTracks,
2630 #ifdef EXPERIMENTAL_MIDI_OUT
2631  empty,
2632 #endif
2633  mT0, t1, options);
2634 
2635  if (token) {
2636  auto previewing = ProgressResult::Success;
2637  // The progress dialog must be deleted before stopping the stream
2638  // to allow events to flow to the app during StopStream processing.
2639  // The progress dialog blocks these events.
2640  {
2641  ProgressDialog progress
2642  (GetTranslatedName(), _("Previewing"), pdlgHideCancelButton);
2643 
2644  while (gAudioIO->IsStreamActive(token) && previewing == ProgressResult::Success) {
2645  ::wxMilliSleep(100);
2646  previewing = progress.Update(gAudioIO->GetStreamTime() - mT0, t1 - mT0);
2647  }
2648  }
2649 
2650  gAudioIO->StopStream();
2651 
2652  while (gAudioIO->IsBusy()) {
2653  ::wxMilliSleep(100);
2654  }
2655  }
2656  else {
2657  ShowErrorDialog(FocusDialog, _("Error"),
2658  _("Error opening sound device.\nTry changing the audio host, playback device and the project sample rate."),
2659  wxT("Error_opening_sound_device"));
2660  }
2661  }
2662 }
double mT1
Definition: Effect.h:464
A list of TrackListNode items.
Definition: Track.h:611
void StopStream()
Stop recording, playback or input monitoring.
Definition: AudioIO.cpp:2518
void CountWaveTracks()
Definition: Effect.cpp:2259
wxString GetFamilyId() override
Definition: Effect.cpp:216
ProgressDialog Class.
ProgressDialog * mProgress
Definition: Effect.h:455
double GetStreamTime()
During playback, the (unwarped) track time most recently played.
Definition: AudioIO.cpp:2969
TrackList * mTracks
Definition: Effect.h:508
bool GetSelected() const
Definition: Track.h:268
bool IsStreamActive()
Returns true if the audio i/o is running at all, but not during cleanup.
Definition: AudioIO.cpp:2899
bool mPreviewFullSelection
Definition: Effect.h:513
virtual bool Init()
Definition: Effect.cpp:1267
bool mIsPreview
Definition: Effect.h:519
Track * Add(std::unique_ptr< TrackKind > &&t)
Add a Track, giving it a fresh id.
Definition: Track.cpp:901
void ReplaceProcessedTracks(const bool bGoodResult)
Definition: Effect.cpp:2170
void Offset(double t)
Definition: Track.h:281
Track::Holder Copy(double t0, double t1, bool forClipboard=true) const override
Definition: WaveTrack.cpp:626
virtual bool Process()
Definition: Effect.cpp:1293
bool IsBusy()
Returns true if audio i/o is busy starting, stopping, playing, or recording.
Definition: AudioIO.cpp:2891
void ShowErrorDialog(wxWindow *parent, const wxString &dlogTitle, const wxString &message, const wxString &helpPage, const bool Close)
Displays an error dialog with a button that offers help.
static std::shared_ptr< TrackList > Create()
Definition: Track.cpp:788
EffectType GetType() override
Definition: Effect.cpp:146
wxFileConfig * gPrefs
Definition: Prefs.cpp:72
std::unique_ptr< WaveTrack > Holder
Definition: WaveTrack.h:90
std::vector< std::shared_ptr< WaveTrack > > WaveTrackArray
Definition: AudioIO.h:65
struct holding stream options, including a pointer to the TimeTrack and AudioIOListener and whether t...
Definition: AudioIO.h:114
std::vector< std::shared_ptr< const WaveTrack > > WaveTrackConstArray
Definition: AudioIO.h:66
virtual void End()
Definition: Effect.cpp:1870
int mNumTracks
Definition: Effect.h:526
A Track that contains audio waveform data.
Definition: WaveTrack.h:60
virtual double CalcPreviewInputLength(double previewLength)
Definition: Effect.cpp:2282
bool mIsLinearEffect
Definition: Effect.h:511
int min(int a, int b)
R GuardedCall(const F1 &body, const F2 &handler=F2::Default(), const F3 &delayedHandler={})
bool mPreviewWithNotSelected
Definition: Effect.h:512
#define NYQUISTEFFECTS_FAMILY
Definition: Nyquist.h:31
std::vector< std::shared_ptr< NoteTrack > > NoteTrackArray
Definition: Track.h:53
int StartStream(const WaveTrackConstArray &playbackTracks, const WaveTrackArray &captureTracks, double t0, double t1, const AudioIOStartStreamOptions &options)
Start recording or playing back audio.
Definition: AudioIO.cpp:1860
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom"))), OnMoveTrack) void TrackMenuTable::OnSetName(wxCommandEvent &)
double mProjectRate
Definition: Effect.h:456
TrackFactory * mFactory
Definition: Effect.h:460
ValueRestorer< T > valueRestorer(T &var)
Definition: MemoryX.h:875
AudioIO * gAudioIO
Definition: AudioIO.cpp:481
void MixAndRender(TrackList *tracks, TrackFactory *trackFactory, double rate, sampleFormat format, double startTime, double endTime, WaveTrack::Holder &uLeft, WaveTrack::Holder &uRight)
Mixes together all input tracks, applying any envelopes, amplitude gain, panning, and real-time effec...
Definition: Mix.cpp:44
double mDuration
Definition: Effect.h:516
double mT0
Definition: Effect.h:463
bool Effect::Process ( )
protectedvirtual

Reimplemented in EffectEqualization, NyquistEffect, EffectTruncSilence, EffectChangeSpeed, EffectAutoDuck, EffectClickRemoval, Generator, EffectNormalize, EffectFindClipping, EffectRepeat, EffectNoiseReduction, EffectPaulstretch, EffectStereoToMono, EffectRepair, EffectReverse, EffectSimpleMono, and EffectTwoPassSimpleMono.

Definition at line 1293 of file Effect.cpp.

References Track::All, CopyInputTracks(), GetAudioInCount(), GetAudioOutCount(), InitPass1(), InitPass2(), mNumAudioIn, mNumAudioOut, mPass, ProcessPass(), and ReplaceProcessedTracks().

Referenced by DoEffect(), and Preview().

1294 {
1296  bool bGoodResult = true;
1297 
1298  // It's possible that the number of channels the effect expects changed based on
1299  // the parameters (the Audacity Reverb effect does when the stereo width is 0).
1302 
1303  mPass = 1;
1304  if (InitPass1())
1305  {
1306  bGoodResult = ProcessPass();
1307  mPass = 2;
1308  if (bGoodResult && InitPass2())
1309  {
1310  bGoodResult = ProcessPass();
1311  }
1312  }
1313 
1314  ReplaceProcessedTracks(bGoodResult);
1315 
1316  return bGoodResult;
1317 }
unsigned GetAudioInCount() override
Definition: Effect.cpp:307
int mPass
Definition: Effect.h:471
void CopyInputTracks()
Definition: Effect.cpp:2039
void ReplaceProcessedTracks(const bool bGoodResult)
Definition: Effect.cpp:2170
virtual bool ProcessPass()
Definition: Effect.cpp:1319
size_t mNumAudioIn
Definition: Effect.h:531
size_t mNumAudioOut
Definition: Effect.h:532
virtual bool InitPass2()
Definition: Effect.cpp:1288
virtual bool InitPass1()
Definition: Effect.cpp:1283
unsigned GetAudioOutCount() override
Definition: Effect.cpp:317
size_t Effect::ProcessBlock ( float **  inBlock,
float **  outBlock,
size_t  blockLen 
)
override

Definition at line 419 of file Effect.cpp.

References mClient.

Referenced by ProcessTrack().

420 {
421  if (mClient)
422  {
423  return mClient->ProcessBlock(inBlock, outBlock, blockLen);
424  }
425 
426  return 0;
427 }
EffectClientInterface * mClient
Definition: Effect.h:530
bool Effect::ProcessFinalize ( )
override

Definition at line 409 of file Effect.cpp.

References mClient.

Referenced by ProcessTrack().

410 {
411  if (mClient)
412  {
413  return mClient->ProcessFinalize();
414  }
415 
416  return true;
417 }
EffectClientInterface * mClient
Definition: Effect.h:530
bool Effect::ProcessInitialize ( sampleCount  totalLen,
ChannelNames  chanMap = NULL 
)
override

Definition at line 399 of file Effect.cpp.

References mClient.

Referenced by ProcessTrack().

400 {
401  if (mClient)
402  {
403  return mClient->ProcessInitialize(totalLen, chanMap);
404  }
405 
406  return true;
407 }
EffectClientInterface * mClient
Definition: Effect.h:530
bool Effect::ProcessPass ( )
protectedvirtual

Reimplemented in EffectTwoPassSimpleMono.

Definition at line 1319 of file Effect.cpp.

References WaveTrack::GetChannel(), Track::GetKind(), Track::GetLinked(), WaveTrack::GetMaxBlockSize(), WaveTrack::GetRate(), GetSamples(), Track::GetSelected(), GetType(), Track::IsSyncLockSelected(), Track::LeftChannel, mBlockSize, mBufferSize, mDuration, mNumAudioIn, mNumAudioOut, mNumChannels, mOutputTracks, mSampleCnt, mT0, mT1, ProcessTrack(), ArrayOf< X >::reinit(), ArraysOf< X >::reinit(), Track::RightChannel, SetBlockSize(), SetSampleRate(), Track::SyncLockAdjust(), WaveTrack::TimeToLongSamples(), and Track::Wave.

Referenced by Process().

1320 {
1321  bool bGoodResult = true;
1322  bool isGenerator = GetType() == EffectTypeGenerate;
1323 
1324  FloatBuffers inBuffer, outBuffer;
1325  ArrayOf<float *> inBufPos, outBufPos;
1326 
1327  ChannelName map[3];
1328 
1329  mBufferSize = 0;
1330  mBlockSize = 0;
1331 
1332  TrackListIterator iter(mOutputTracks.get());
1333  int count = 0;
1334  bool clear = false;
1335  Track* t = iter.First();
1336 
1337  for (t = iter.First(); t; t = iter.Next())
1338  {
1339  if (t->GetKind() != Track::Wave || !t->GetSelected())
1340  {
1341  if (t->IsSyncLockSelected())
1342  {
1344  }
1345  continue;
1346  }
1347 
1348  WaveTrack *left = (WaveTrack *)t;
1349  WaveTrack *right;
1350  sampleCount len;
1351  sampleCount leftStart;
1352  sampleCount rightStart;
1353 
1354  if (!isGenerator)
1355  {
1356  GetSamples(left, &leftStart, &len);
1357  mSampleCnt = len;
1358  }
1359  else
1360  {
1361  len = 0;
1362  leftStart = 0;
1364  }
1365 
1366  mNumChannels = 1;
1367 
1368  if (left->GetChannel() == Track::LeftChannel)
1369  {
1370  map[0] = ChannelNameFrontLeft;
1371  }
1372  else if (left->GetChannel() == Track::RightChannel)
1373  {
1374  map[0] = ChannelNameFrontRight;
1375  }
1376  else
1377  {
1378  map[0] = ChannelNameMono;
1379  }
1380  map[1] = ChannelNameEOL;
1381 
1382  right = NULL;
1383  rightStart = 0;
1384  if (left->GetLinked() && mNumAudioIn > 1)
1385  {
1386  // Assume linked track is wave
1387  right = static_cast<WaveTrack *>(iter.Next());
1388  if (!isGenerator)
1389  {
1390  GetSamples(right, &rightStart, &len);
1391  }
1392  clear = false;
1393  mNumChannels = 2;
1394 
1395  if (right->GetChannel() == Track::LeftChannel)
1396  {
1397  map[1] = ChannelNameFrontLeft;
1398  }
1399  else if (right->GetChannel() == Track::RightChannel)
1400  {
1401  map[1] = ChannelNameFrontRight;
1402  }
1403  else
1404  {
1405  map[1] = ChannelNameMono;
1406  }
1407  map[2] = ChannelNameEOL;
1408  }
1409 
1410  // Let the client know the sample rate
1411  SetSampleRate(left->GetRate());
1412 
1413  // Get the block size the client wants to use
1414  auto max = left->GetMaxBlockSize() * 2;
1415  mBlockSize = SetBlockSize(max);
1416 
1417  // Calculate the buffer size to be at least the max rounded up to the clients
1418  // selected block size.
1419  const auto prevBufferSize = mBufferSize;
1420  mBufferSize = ((max + (mBlockSize - 1)) / mBlockSize) * mBlockSize;
1421 
1422  // If the buffer size has changed, then (re)allocate the buffers
1423  if (prevBufferSize != mBufferSize)
1424  {
1425  // Always create the number of input buffers the client expects even if we don't have
1426  // the same number of channels.
1427  inBufPos.reinit( mNumAudioIn );
1428  inBuffer.reinit( mNumAudioIn, mBufferSize );
1429 
1430  // We won't be using more than the first 2 buffers, so clear the rest (if any)
1431  for (size_t i = 2; i < mNumAudioIn; i++)
1432  {
1433  for (size_t j = 0; j < mBufferSize; j++)
1434  {
1435  inBuffer[i][j] = 0.0;
1436  }
1437  }
1438 
1439  // Always create the number of output buffers the client expects even if we don't have
1440  // the same number of channels.
1441  // Output buffers get an extra mBlockSize worth to give extra room if
1442  // the plugin adds latency
1443  outBufPos.reinit( mNumAudioOut );
1444  outBuffer.reinit( mNumAudioOut, mBufferSize + mBlockSize );
1445  }
1446 
1447  // (Re)Set the input buffer positions
1448  for (size_t i = 0; i < mNumAudioIn; i++)
1449  {
1450  inBufPos[i] = inBuffer[i].get();
1451  }
1452 
1453  // (Re)Set the output buffer positions
1454  for (size_t i = 0; i < mNumAudioOut; i++)
1455  {
1456  outBufPos[i] = outBuffer[i].get();
1457  }
1458 
1459  // Clear unused input buffers
1460  if (!right && !clear && mNumAudioIn > 1)
1461  {
1462  for (size_t j = 0; j < mBufferSize; j++)
1463  {
1464  inBuffer[1][j] = 0.0;
1465  }
1466  clear = true;
1467  }
1468 
1469  // Go process the track(s)
1470  bGoodResult = ProcessTrack(
1471  count, map, left, right, leftStart, rightStart, len,
1472  inBuffer, outBuffer, inBufPos, outBufPos);
1473  if (!bGoodResult)
1474  {
1475  break;
1476  }
1477 
1478  count++;
1479  }
1480 
1481  if (bGoodResult && GetType() == EffectTypeGenerate)
1482  {
1483  mT1 = mT0 + mDuration;
1484  }
1485 
1486  return bGoodResult;
1487 }
double mT1
Definition: Effect.h:464
bool GetSelected() const
Definition: Track.h:268
size_t SetBlockSize(size_t maxBlockSize) override
Definition: Effect.cpp:357
void reinit(Integral count, bool initialize=false)
Definition: MemoryX.h:499
bool IsSyncLockSelected() const
Definition: Track.cpp:291
bool GetLinked() const
Definition: Track.h:271
size_t mBufferSize
Definition: Effect.h:534
void SetSampleRate(double rate) override
Definition: Effect.cpp:347
void GetSamples(const WaveTrack *track, sampleCount *start, sampleCount *len)
Definition: Effect.cpp:2004
size_t mNumAudioIn
Definition: Effect.h:531
virtual int GetKind() const
Definition: Track.h:322
size_t mNumAudioOut
Definition: Effect.h:532
EffectType GetType() override
Definition: Effect.cpp:146
size_t mBlockSize
Definition: Effect.h:535
A Track that contains audio waveform data.
Definition: WaveTrack.h:60
Fundamental data object of Audacity, placed in the TrackPanel. Classes derived form it include the Wa...
Definition: Track.h:94
size_t GetMaxBlockSize() const
Definition: WaveTrack.cpp:1631
An iterator for a TrackList.
Definition: Track.h:394
unsigned mNumChannels
Definition: Effect.h:536
bool ProcessTrack(int count, ChannelNames map, WaveTrack *left, WaveTrack *right, sampleCount leftStart, sampleCount rightStart, sampleCount len, FloatBuffers &inBuffer, FloatBuffers &outBuffer, ArrayOf< float * > &inBufPos, ArrayOf< float * > &outBufPos)
Definition: Effect.cpp:1489
void reinit(Integral count)
Definition: MemoryX.h:547
sampleCount TimeToLongSamples(double t0) const
Convert correctly between an (absolute) time in seconds and a number of samples.
Definition: WaveTrack.cpp:1849
Memory.h template class for making an array of float, bool, etc.
Definition: MemoryX.h:469
double mDuration
Definition: Effect.h:516
sampleCount mSampleCnt
Definition: Effect.h:478
double GetRate() const
Definition: WaveTrack.cpp:424
virtual void SyncLockAdjust(double oldT1, double newT1)
Definition: Track.cpp:316
std::shared_ptr< TrackList > mOutputTracks
Definition: Effect.h:462
virtual int GetChannel() const override
Definition: WaveTrack.cpp:236
double mT0
Definition: Effect.h:463
bool Effect::ProcessTrack ( int  count,
ChannelNames  map,
WaveTrack left,
WaveTrack right,
sampleCount  leftStart,
sampleCount  rightStart,
sampleCount  len,
FloatBuffers inBuffer,
FloatBuffers outBuffer,
ArrayOf< float * > &  inBufPos,
ArrayOf< float * > &  outBufPos 
)
private

Definition at line 1489 of file Effect.cpp.

References CalcPreviewInputLength(), WaveTrack::ClearAndPaste(), WaveTrack::Get(), GetActiveProject(), GetLatency(), WaveTrack::GetRate(), WaveTrack::GetSampleFormat(), AudacityProject::GetSel1(), GetType(), WaveTrack::GetWaveColorIndex(), gPrefs, mBlockSize, mBufferSize, mDuration, mFactory, mIsPreview, mNumAudioOut, mNumChannels, mT0, mT1, TrackFactory::NewWaveTrack(), ProcessBlock(), ProcessFinalize(), ProcessInitialize(), WaveTrack::Set(), TrackGroupProgress(), and TrackProgress().

Referenced by ProcessPass().

1500 {
1501  bool rc = true;
1502 
1503  // Give the plugin a chance to initialize
1504  if (!ProcessInitialize(len, map))
1505  {
1506  return false;
1507  }
1508 
1509  { // Start scope for cleanup
1510  auto cleanup = finally( [&] {
1511  // Allow the plugin to cleanup
1512  if (!ProcessFinalize())
1513  {
1514  // In case of non-exceptional flow of control, set rc
1515  rc = false;
1516  }
1517  } );
1518 
1519  // For each input block of samples, we pass it to the effect along with a
1520  // variable output location. This output location is simply a pointer into a
1521  // much larger buffer. This reduces the number of calls required to add the
1522  // samples to the output track.
1523  //
1524  // Upon return from the effect, the output samples are "moved to the left" by
1525  // the number of samples in the current latency setting, effectively removing any
1526  // delay introduced by the effect.
1527  //
1528  // At the same time the total number of delayed samples are gathered and when
1529  // there is no further input data to process, the loop continues to call the
1530  // effect with an empty input buffer until the effect has had a chance to
1531  // return all of the remaining delayed samples.
1532  auto inLeftPos = leftStart;
1533  auto inRightPos = rightStart;
1534  auto outLeftPos = leftStart;
1535  auto outRightPos = rightStart;
1536 
1537  auto inputRemaining = len;
1538  decltype(GetLatency()) curDelay = 0, delayRemaining = 0;
1539  decltype(mBlockSize) curBlockSize = 0;
1540 
1541  decltype(mBufferSize) inputBufferCnt = 0;
1542  decltype(mBufferSize) outputBufferCnt = 0;
1543  bool cleared = false;
1544 
1545  auto chans = std::min<unsigned>(mNumAudioOut, mNumChannels);
1546 
1547  std::unique_ptr<WaveTrack> genLeft, genRight;
1548 
1549  decltype(len) genLength = 0;
1550  bool isGenerator = GetType() == EffectTypeGenerate;
1551  bool isProcessor = GetType() == EffectTypeProcess;
1552  double genDur = 0;
1553  if (isGenerator)
1554  {
1555  if (mIsPreview) {
1556  gPrefs->Read(wxT("/AudioIO/EffectsPreviewLen"), &genDur, 6.0);
1557  genDur = wxMin(mDuration, CalcPreviewInputLength(genDur));
1558  }
1559  else {
1560  genDur = mDuration;
1561  }
1562 
1563  genLength = sampleCount((left->GetRate() * genDur) + 0.5); // round to nearest sample
1564  delayRemaining = genLength;
1565  cleared = true;
1566 
1567  // Create temporary tracks
1568  genLeft = mFactory->NewWaveTrack(left->GetSampleFormat(), left->GetRate());
1569  genLeft->SetWaveColorIndex( left->GetWaveColorIndex() );
1570 
1571  if (right)
1572  {
1573  genRight = mFactory->NewWaveTrack(right->GetSampleFormat(), right->GetRate());
1574  genRight->SetWaveColorIndex( right->GetWaveColorIndex() );
1575  }
1576  }
1577 
1578  // Call the effect until we run out of input or delayed samples
1579  while (inputRemaining != 0 || delayRemaining != 0)
1580  {
1581  // Still working on the input samples
1582  if (inputRemaining != 0)
1583  {
1584  // Need to refill the input buffers
1585  if (inputBufferCnt == 0)
1586  {
1587  // Calculate the number of samples to get
1588  inputBufferCnt =
1589  limitSampleBufferSize( mBufferSize, inputRemaining );
1590 
1591  // Fill the input buffers
1592  left->Get((samplePtr) inBuffer[0].get(), floatSample, inLeftPos, inputBufferCnt);
1593  if (right)
1594  {
1595  right->Get((samplePtr) inBuffer[1].get(), floatSample, inRightPos, inputBufferCnt);
1596  }
1597 
1598  // Reset the input buffer positions
1599  for (size_t i = 0; i < mNumChannels; i++)
1600  {
1601  inBufPos[i] = inBuffer[i].get();
1602  }
1603  }
1604 
1605  // Calculate the number of samples to process
1606  curBlockSize = mBlockSize;
1607  if (curBlockSize > inputRemaining)
1608  {
1609  // We've reached the last block...set current block size to what's left
1610  // inputRemaining is positive and bounded by a size_t
1611  curBlockSize = inputRemaining.as_size_t();
1612  inputRemaining = 0;
1613 
1614  // Clear the remainder of the buffers so that a full block can be passed
1615  // to the effect
1616  auto cnt = mBlockSize - curBlockSize;
1617  for (size_t i = 0; i < mNumChannels; i++)
1618  {
1619  for (decltype(cnt) j = 0 ; j < cnt; j++)
1620  {
1621  inBufPos[i][j + curBlockSize] = 0.0;
1622  }
1623  }
1624 
1625  // Might be able to use up some of the delayed samples
1626  if (delayRemaining != 0)
1627  {
1628  // Don't use more than needed
1629  cnt = limitSampleBufferSize(cnt, delayRemaining);
1630  delayRemaining -= cnt;
1631  curBlockSize += cnt;
1632  }
1633  }
1634  }
1635  // We've exhausted the input samples and are now working on the delay
1636  else if (delayRemaining != 0)
1637  {
1638  // Calculate the number of samples to process
1639  curBlockSize = limitSampleBufferSize( mBlockSize, delayRemaining );
1640  delayRemaining -= curBlockSize;
1641 
1642  // From this point on, we only want to feed zeros to the plugin
1643  if (!cleared)
1644  {
1645  // Reset the input buffer positions
1646  for (size_t i = 0; i < mNumChannels; i++)
1647  {
1648  inBufPos[i] = inBuffer[i].get();
1649 
1650  // And clear
1651  for (size_t j = 0; j < mBlockSize; j++)
1652  {
1653  inBuffer[i][j] = 0.0;
1654  }
1655  }
1656  cleared = true;
1657  }
1658  }
1659 
1660  // Finally call the plugin to process the block
1661  decltype(curBlockSize) processed;
1662  try
1663  {
1664  processed = ProcessBlock(inBufPos.get(), outBufPos.get(), curBlockSize);
1665  }
1666  catch( const AudacityException & WXUNUSED(e) )
1667  {
1668  // PRL: Bug 437:
1669  // Pass this along to our application-level handler
1670  throw;
1671  }
1672  catch(...)
1673  {
1674  // PRL:
1675  // Exceptions for other reasons, maybe in third-party code...
1676  // Continue treating them as we used to, but I wonder if these
1677  // should now be treated the same way.
1678  return false;
1679  }
1680  wxASSERT(processed == curBlockSize);
1681  wxUnusedVar(processed);
1682 
1683  // Bump to next input buffer position
1684  if (inputRemaining != 0)
1685  {
1686  for (size_t i = 0; i < mNumChannels; i++)
1687  {
1688  inBufPos[i] += curBlockSize;
1689  }
1690  inputRemaining -= curBlockSize;
1691  inputBufferCnt -= curBlockSize;
1692  }
1693 
1694  // "ls" and "rs" serve as the input sample index for the left and
1695  // right channels when processing the input samples. If we flip
1696  // over to processing delayed samples, they simply become counters
1697  // for the progress display.
1698  inLeftPos += curBlockSize;
1699  inRightPos += curBlockSize;
1700 
1701  // Get the current number of delayed samples and accumulate
1702  if (isProcessor)
1703  {
1704  auto delay = GetLatency();
1705  curDelay += delay;
1706  delayRemaining += delay;
1707 
1708  // If the plugin has delayed the output by more samples than our current
1709  // block size, then we leave the output pointers alone. This effectively
1710  // removes those delayed samples from the output buffer.
1711  if (curDelay >= curBlockSize)
1712  {
1713  curDelay -= curBlockSize;
1714  curBlockSize = 0;
1715  }
1716  // We have some delayed samples, at the beginning of the output samples,
1717  // so overlay them by shifting the remaining output samples.
1718  else if (curDelay > 0)
1719  {
1720  // curDelay is bounded by curBlockSize:
1721  auto delay = curDelay.as_size_t();
1722  curBlockSize -= delay;
1723  for (size_t i = 0; i < chans; i++)
1724  {
1725  memmove(outBufPos[i], outBufPos[i] + delay, sizeof(float) * curBlockSize);
1726  }
1727  curDelay = 0;
1728  }
1729  }
1730 
1731  // Adjust the number of samples in the output buffers
1732  outputBufferCnt += curBlockSize;
1733 
1734  // Still have room in the output buffers
1735  if (outputBufferCnt < mBufferSize)
1736  {
1737  // Bump to next output buffer position
1738  for (size_t i = 0; i < chans; i++)
1739  {
1740  outBufPos[i] += curBlockSize;
1741  }
1742  }
1743  // Output buffers have filled
1744  else
1745  {
1746  if (isProcessor)
1747  {
1748  // Write them out
1749  left->Set((samplePtr) outBuffer[0].get(), floatSample, outLeftPos, outputBufferCnt);
1750  if (right)
1751  {
1752  if (chans >= 2)
1753  {
1754  right->Set((samplePtr) outBuffer[1].get(), floatSample, outRightPos, outputBufferCnt);
1755  }
1756  else
1757  {
1758  right->Set((samplePtr) outBuffer[0].get(), floatSample, outRightPos, outputBufferCnt);
1759  }
1760  }
1761  }
1762  else if (isGenerator)
1763  {
1764  genLeft->Append((samplePtr) outBuffer[0].get(), floatSample, outputBufferCnt);
1765  if (genRight)
1766  {
1767  genRight->Append((samplePtr) outBuffer[1].get(), floatSample, outputBufferCnt);
1768  }
1769  }
1770 
1771  // Reset the output buffer positions
1772  for (size_t i = 0; i < chans; i++)
1773  {
1774  outBufPos[i] = outBuffer[i].get();
1775  }
1776 
1777  // Bump to the next track position
1778  outLeftPos += outputBufferCnt;
1779  outRightPos += outputBufferCnt;
1780  outputBufferCnt = 0;
1781  }
1782 
1783  if (mNumChannels > 1)
1784  {
1785  if (TrackGroupProgress(count,
1786  (inLeftPos - leftStart).as_double() /
1787  (isGenerator ? genLength : len).as_double()))
1788  {
1789  rc = false;
1790  break;
1791  }
1792  }
1793  else
1794  {
1795  if (TrackProgress(count,
1796  (inLeftPos - leftStart).as_double() /
1797  (isGenerator ? genLength : len).as_double()))
1798  {
1799  rc = false;
1800  break;
1801  }
1802  }
1803  }
1804 
1805  // Put any remaining output
1806  if (rc && outputBufferCnt)
1807  {
1808  if (isProcessor)
1809  {
1810  left->Set((samplePtr) outBuffer[0].get(), floatSample, outLeftPos, outputBufferCnt);
1811  if (right)
1812  {
1813  if (chans >= 2)
1814  {
1815  right->Set((samplePtr) outBuffer[1].get(), floatSample, outRightPos, outputBufferCnt);
1816  }
1817  else
1818  {
1819  right->Set((samplePtr) outBuffer[0].get(), floatSample, outRightPos, outputBufferCnt);
1820  }
1821  }
1822  }
1823  else if (isGenerator)
1824  {
1825  genLeft->Append((samplePtr) outBuffer[0].get(), floatSample, outputBufferCnt);
1826  if (genRight)
1827  {
1828  genRight->Append((samplePtr) outBuffer[1].get(), floatSample, outputBufferCnt);
1829  }
1830  }
1831  }
1832 
1833  if (rc && isGenerator)
1834  {
1836 
1837  // PRL: this code was here and could not have been the right
1838  // intent, mixing time and sampleCount values:
1839  // StepTimeWarper warper(mT0 + genLength, genLength - (mT1 - mT0));
1840 
1841  // This looks like what it should have been:
1842  // StepTimeWarper warper(mT0 + genDur, genDur - (mT1 - mT0));
1843  // But rather than fix it, I will just disable the use of it for now.
1844  // The purpose was to remap split lines inside the selected region when
1845  // a generator replaces it with sound of different duration. But
1846  // the "correct" version might have the effect of mapping some splits too
1847  // far left, to before the selection.
1848  // In practice the wrong version probably did nothing most of the time,
1849  // because the cutoff time for the step time warper was 44100 times too
1850  // far from mT0.
1851 
1852  // Transfer the data from the temporary tracks to the actual ones
1853  genLeft->Flush();
1854  // mT1 gives us the NEW selection. We want to replace up to GetSel1().
1855  left->ClearAndPaste(mT0, p->GetSel1(), genLeft.get(), true, true,
1856  nullptr /* &warper */);
1857 
1858  if (genRight)
1859  {
1860  genRight->Flush();
1861  right->ClearAndPaste(mT0, mT1, genRight.get(), true, true,
1862  nullptr /* &warper */);
1863  }
1864  }
1865 
1866  } // End scope for cleanup
1867  return rc;
1868 }
double mT1
Definition: Effect.h:464
bool TrackProgress(int whichTrack, double frac, const wxString &=wxEmptyString)
Definition: Effect.cpp:1988
root of a hierarchy of classes that are thrown and caught by Audacity.
bool Get(samplePtr buffer, sampleFormat format, sampleCount start, size_t len, fillFormat fill=fillZero, bool mayThrow=true) const
Definition: WaveTrack.cpp:1977
bool mIsPreview
Definition: Effect.h:519
void ClearAndPaste(double t0, double t1, const Track *src, bool preserve=true, bool merge=true, const TimeWarper *effectWarper=NULL)
Definition: WaveTrack.cpp:786
size_t mBufferSize
Definition: Effect.h:534
int GetWaveColorIndex() const
Definition: WaveTrack.h:143
size_t mNumAudioOut
Definition: Effect.h:532
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:158
EffectType GetType() override
Definition: Effect.cpp:146
wxFileConfig * gPrefs
Definition: Prefs.cpp:72
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap=NULL) override
Definition: Effect.cpp:399
void Set(samplePtr buffer, sampleFormat format, sampleCount start, size_t len)
Definition: WaveTrack.cpp:2054
size_t mBlockSize
Definition: Effect.h:535
A Track that contains audio waveform data.
Definition: WaveTrack.h:60
bool ProcessFinalize() override
Definition: Effect.cpp:409
virtual double CalcPreviewInputLength(double previewLength)
Definition: Effect.cpp:2282
if(pTrack &&pTrack->GetDisplay()!=WaveTrack::Spectrum)
int min(int a, int b)
std::unique_ptr< WaveTrack > NewWaveTrack(sampleFormat format=(sampleFormat) 0, double rate=0)
Definition: WaveTrack.cpp:78
unsigned mNumChannels
Definition: Effect.h:536
TrackFactory * mFactory
Definition: Effect.h:460
sampleCount GetLatency() override
Definition: Effect.cpp:369
AUDACITY_DLL_API AudacityProject * GetActiveProject()
Definition: Project.cpp:300
sampleFormat GetSampleFormat() const
Definition: WaveTrack.h:146
bool TrackGroupProgress(int whichGroup, double frac, const wxString &=wxEmptyString)
Definition: Effect.cpp:1996
double mDuration
Definition: Effect.h:516
double GetRate() const
Definition: WaveTrack.cpp:424
double GetSel1() const
Definition: Project.h:187
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override
Definition: Effect.cpp:419
double mT0
Definition: Effect.h:463
bool Effect::PromptUser ( wxWindow *  parent)
protectedvirtual

Reimplemented in EffectNoiseReduction.

Definition at line 1273 of file Effect.cpp.

References IsBatchProcessing(), and ShowInterface().

Referenced by DoEffect(), and EffectManager::PromptUser().

1274 {
1275  return ShowInterface(parent, IsBatchProcessing());
1276 }
bool ShowInterface(wxWindow *parent, bool forceModal=false) override
Definition: Effect.cpp:539
virtual bool IsBatchProcessing()
Definition: Effect.cpp:1142
bool Effect::RealtimeAddProcessor ( unsigned  numChannels,
float  sampleRate 
)
override

Definition at line 442 of file Effect.cpp.

References mClient.

Referenced by EffectManager::RealtimeAddEffect(), and RealtimeAddProcessor().

443 {
444  if (mClient)
445  {
446  return mClient->RealtimeAddProcessor(numChannels, sampleRate);
447  }
448 
449  return true;
450 }
EffectClientInterface * mClient
Definition: Effect.h:530
bool Effect::RealtimeAddProcessor ( int  group,
unsigned  chans,
float  rate 
)

Definition at line 2290 of file Effect.cpp.

References mCurrentProcessor, mGroupProcessor, mNumAudioIn, mNumAudioOut, and RealtimeAddProcessor().

2291 {
2292  auto ichans = chans;
2293  auto ochans = chans;
2294  auto gchans = chans;
2295 
2296  // Reset processor index
2297  if (group == 0)
2298  {
2299  mCurrentProcessor = 0;
2300  mGroupProcessor.clear();
2301  }
2302 
2303  // Remember the processor starting index
2305 
2306  // Call the client until we run out of input or output channels
2307  while (ichans > 0 && ochans > 0)
2308  {
2309  // If we don't have enough input channels to accomodate the client's
2310  // requirements, then we replicate the input channels until the
2311  // client's needs are met.
2312  if (ichans < mNumAudioIn)
2313  {
2314  // All input channels have been consumed
2315  ichans = 0;
2316  }
2317  // Otherwise fullfil the client's needs with as many input channels as possible.
2318  // After calling the client with this set, we will loop back up to process more
2319  // of the input/output channels.
2320  else if (ichans >= mNumAudioIn)
2321  {
2322  gchans = mNumAudioIn;
2323  ichans -= gchans;
2324  }
2325 
2326  // If we don't have enough output channels to accomodate the client's
2327  // requirements, then we provide all of the output channels and fulfill
2328  // the client's needs with dummy buffers. These will just get tossed.
2329  if (ochans < mNumAudioOut)
2330  {
2331  // All output channels have been consumed
2332  ochans = 0;
2333  }
2334  // Otherwise fullfil the client's needs with as many output channels as possible.
2335  // After calling the client with this set, we will loop back up to process more
2336  // of the input/output channels.
2337  else if (ochans >= mNumAudioOut)
2338  {
2339  ochans -= mNumAudioOut;
2340  }
2341 
2342  // Add a NEW processor
2343  RealtimeAddProcessor(gchans, rate);
2344 
2345  // Bump to next processor
2347  }
2348 
2349  return true;
2350 }
std::vector< int > mGroupProcessor
Definition: Effect.h:538
size_t mNumAudioIn
Definition: Effect.h:531
size_t mNumAudioOut
Definition: Effect.h:532
bool RealtimeAddProcessor(unsigned numChannels, float sampleRate) override
Definition: Effect.cpp:442
int mCurrentProcessor
Definition: Effect.h:539
bool Effect::RealtimeFinalize ( )
override

Definition at line 452 of file Effect.cpp.

References mClient.

Referenced by EffectManager::RealtimeRemoveEffect().

453 {
454  if (mClient)
455  {
456  return mClient->RealtimeFinalize();
457  }
458 
459  return false;
460 }
EffectClientInterface * mClient
Definition: Effect.h:530
bool Effect::RealtimeInitialize ( )
override

Definition at line 429 of file Effect.cpp.

References mBlockSize, and mClient.

Referenced by EffectManager::RealtimeAddEffect().

430 {
431  if (mClient)
432  {
433  mBlockSize = mClient->SetBlockSize(512);
434  return mClient->RealtimeInitialize();
435  }
436 
437  mBlockSize = 512;
438 
439  return false;
440 }
EffectClientInterface * mClient
Definition: Effect.h:530
size_t mBlockSize
Definition: Effect.h:535
size_t Effect::RealtimeProcess ( int  group,
float **  inbuf,
float **  outbuf,
size_t  numSamples 
)
override

Definition at line 516 of file Effect.cpp.

References mClient.

Referenced by RealtimeProcess().

520 {
521  if (mClient)
522  {
523  return mClient->RealtimeProcess(group, inbuf, outbuf, numSamples);
524  }
525 
526  return 0;
527 }
EffectClientInterface * mClient
Definition: Effect.h:530
size_t Effect::RealtimeProcess ( int  group,
unsigned  chans,
float **  inbuf,
float **  outbuf,
size_t  numSamples 
)

Definition at line 2355 of file Effect.cpp.

References mBlockSize, mGroupProcessor, min(), mNumAudioIn, mNumAudioOut, and RealtimeProcess().

2360 {
2361  //
2362  // The caller passes the number of channels to process and specifies
2363  // the number of input and output buffers. There will always be the
2364  // same number of output buffers as there are input buffers.
2365  //
2366  // Effects always require a certain number of input and output buffers,
2367  // so if the number of channels we're curently processing are different
2368  // than what the effect expects, then we use a few methods of satisfying
2369  // the effects requirements.
2370  float **clientIn = (float **) alloca(mNumAudioIn * sizeof(float *));
2371  float **clientOut = (float **) alloca(mNumAudioOut * sizeof(float *));
2372  float *dummybuf = (float *) alloca(numSamples * sizeof(float));
2373  decltype(numSamples) len = 0;
2374  auto ichans = chans;
2375  auto ochans = chans;
2376  auto gchans = chans;
2377  unsigned indx = 0;
2378  unsigned ondx = 0;
2379 
2380  int processor = mGroupProcessor[group];
2381 
2382  // Call the client until we run out of input or output channels
2383  while (ichans > 0 && ochans > 0)
2384  {
2385  // If we don't have enough input channels to accomodate the client's
2386  // requirements, then we replicate the input channels until the
2387  // client's needs are met.
2388  if (ichans < mNumAudioIn)
2389  {
2390  for (size_t i = 0; i < mNumAudioIn; i++)
2391  {
2392  if (indx == ichans)
2393  {
2394  indx = 0;
2395  }
2396  clientIn[i] = inbuf[indx++];
2397  }
2398 
2399  // All input channels have been consumed
2400  ichans = 0;
2401  }
2402  // Otherwise fullfil the client's needs with as many input channels as possible.
2403  // After calling the client with this set, we will loop back up to process more
2404  // of the input/output channels.
2405  else if (ichans >= mNumAudioIn)
2406  {
2407  gchans = 0;
2408  for (size_t i = 0; i < mNumAudioIn; i++, ichans--, gchans++)
2409  {
2410  clientIn[i] = inbuf[indx++];
2411  }
2412  }
2413 
2414  // If we don't have enough output channels to accomodate the client's
2415  // requirements, then we provide all of the output channels and fulfill
2416  // the client's needs with dummy buffers. These will just get tossed.
2417  if (ochans < mNumAudioOut)
2418  {
2419  for (size_t i = 0; i < mNumAudioOut; i++)
2420  {
2421  if (i < ochans)
2422  {
2423  clientOut[i] = outbuf[i];
2424  }
2425  else
2426  {
2427  clientOut[i] = dummybuf;
2428  }
2429  }
2430 
2431  // All output channels have been consumed
2432  ochans = 0;
2433  }
2434  // Otherwise fullfil the client's needs with as many output channels as possible.
2435  // After calling the client with this set, we will loop back up to process more
2436  // of the input/output channels.
2437  else if (ochans >= mNumAudioOut)
2438  {
2439  for (size_t i = 0; i < mNumAudioOut; i++, ochans--)
2440  {
2441  clientOut[i] = outbuf[ondx++];
2442  }
2443  }
2444 
2445  // Finally call the plugin to process the block
2446  len = 0;
2447  for (decltype(numSamples) block = 0; block < numSamples; block += mBlockSize)
2448  {
2449  auto cnt = std::min(numSamples - block, mBlockSize);
2450  len += RealtimeProcess(processor, clientIn, clientOut, cnt);
2451 
2452  for (size_t i = 0 ; i < mNumAudioIn; i++)
2453  {
2454  clientIn[i] += cnt;
2455  }
2456 
2457  for (size_t i = 0 ; i < mNumAudioOut; i++)
2458  {
2459  clientOut[i] += cnt;
2460  }
2461  }
2462 
2463  // Bump to next processor
2464  processor++;
2465  }
2466 
2467  return len;
2468 }
std::vector< int > mGroupProcessor
Definition: Effect.h:538
size_t RealtimeProcess(int group, float **inbuf, float **outbuf, size_t numSamples) override
Definition: Effect.cpp:516
size_t mNumAudioIn
Definition: Effect.h:531
size_t mNumAudioOut
Definition: Effect.h:532
size_t mBlockSize
Definition: Effect.h:535
int min(int a, int b)
bool Effect::RealtimeProcessEnd ( )
override

Definition at line 529 of file Effect.cpp.

References mClient.

530 {
531  if (mClient)
532  {
533  return mClient->RealtimeProcessEnd();
534  }
535 
536  return true;
537 }
EffectClientInterface * mClient
Definition: Effect.h:530
bool Effect::RealtimeProcessStart ( )
override

Definition at line 506 of file Effect.cpp.

References mClient.

507 {
508  if (mClient)
509  {
510  return mClient->RealtimeProcessStart();
511  }
512 
513  return true;
514 }
EffectClientInterface * mClient
Definition: Effect.h:530
bool Effect::RealtimeResume ( )
override

Definition at line 484 of file Effect.cpp.

References mClient, mRealtimeSuspendCount, and mRealtimeSuspendLock.

485 {
486  if (mClient)
487  {
488  if (mClient->RealtimeResume())
489  {
490  mRealtimeSuspendLock.Enter();
492  mRealtimeSuspendLock.Leave();
493  return true;
494  }
495 
496  return false;
497  }
498 
499  mRealtimeSuspendLock.Enter();
501  mRealtimeSuspendLock.Leave();
502 
503  return true;
504 }
EffectClientInterface * mClient
Definition: Effect.h:530
wxCriticalSection mRealtimeSuspendLock
Definition: Effect.h:541
int mRealtimeSuspendCount
Definition: Effect.h:542
bool Effect::RealtimeSuspend ( )
override

Definition at line 462 of file Effect.cpp.

References mClient, mRealtimeSuspendCount, and mRealtimeSuspendLock.

463 {
464  if (mClient)
465  {
466  if (mClient->RealtimeSuspend())
467  {
468  mRealtimeSuspendLock.Enter();
470  mRealtimeSuspendLock.Leave();
471  return true;
472  }
473 
474  return false;
475  }
476 
477  mRealtimeSuspendLock.Enter();
479  mRealtimeSuspendLock.Leave();
480 
481  return true;
482 }
EffectClientInterface * mClient
Definition: Effect.h:530
wxCriticalSection mRealtimeSuspendLock
Definition: Effect.h:541
int mRealtimeSuspendCount
Definition: Effect.h:542
bool Effect::RemovePrivateConfig ( const wxString &  group,
const wxString &  key 
)
override

Definition at line 975 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::RemovePrivateConfig().

976 {
977  return PluginManager::Get().RemovePrivateConfig(GetID(), group, key);
978 }
virtual PluginID GetID()
Definition: Effect.cpp:982
bool RemovePrivateConfig(const PluginID &ID, const wxString &group, const wxString &key) override
static PluginManager & Get()
bool Effect::RemovePrivateConfigSubgroup ( const wxString &  group)
override

Definition at line 970 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::RemovePrivateConfigSubgroup().

971 {
973 }
virtual PluginID GetID()
Definition: Effect.cpp:982
bool RemovePrivateConfigSubgroup(const PluginID &ID, const wxString &group) override
static PluginManager & Get()
bool Effect::RemoveSharedConfig ( const wxString &  group,
const wxString &  key 
)
override

Definition at line 905 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::RemoveSharedConfig().

906 {
907  return PluginManager::Get().RemoveSharedConfig(GetID(), group, key);
908 }
bool RemoveSharedConfig(const PluginID &ID, const wxString &group, const wxString &key) override
virtual PluginID GetID()
Definition: Effect.cpp:982
static PluginManager & Get()
bool Effect::RemoveSharedConfigSubgroup ( const wxString &  group)
override

Definition at line 900 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::RemoveSharedConfigSubgroup().

901 {
903 }
virtual PluginID GetID()
Definition: Effect.cpp:982
bool RemoveSharedConfigSubgroup(const PluginID &ID, const wxString &group) override
static PluginManager & Get()
void Effect::ReplaceProcessedTracks ( const bool  bGoodResult)
protected

Definition at line 2170 of file Effect.cpp.

References TrackList::Add(), ODManager::Instance, ODManager::IsInstanceCreated(), mIMap, mOMap, mOutputTracks, mOutputTracksType, mTracks, Track::None, TrackList::Remove(), TrackList::Replace(), and ODManager::ReplaceWaveTrack().

Referenced by DoEffect(), Preview(), EffectTwoPassSimpleMono::Process(), EffectSimpleMono::Process(), EffectRepair::Process(), EffectReverse::Process(), EffectStereoToMono::Process(), EffectPaulstretch::Process(), EffectNoiseReduction::Process(), EffectRepeat::Process(), EffectNormalize::Process(), Generator::Process(), EffectClickRemoval::Process(), EffectAutoDuck::Process(), EffectChangeSpeed::Process(), EffectTruncSilence::Process(), NyquistEffect::Process(), EffectEqualization::Process(), and Process().

2171 {
2172  if (!bGoodResult) {
2173  // Free resources, unless already freed.
2174 
2175  // Processing failed or was cancelled so throw away the processed tracks.
2176  if ( mOutputTracks )
2177  mOutputTracks->Clear();
2178 
2179  // Reset map
2180  mIMap.clear();
2181  mOMap.clear();
2182 
2184 
2185  //TODO:undo the non-gui ODTask transfer
2186  return;
2187  }
2188 
2189  // Assume resources need to be freed.
2190  wxASSERT(mOutputTracks); // Make sure we at least did the CopyInputTracks().
2191 
2192  auto iterOut = mOutputTracks->ListOfTracks::begin(),
2193  iterEnd = mOutputTracks->ListOfTracks::end();
2194 
2195  size_t cnt = mOMap.size();
2196  size_t i = 0;
2197 
2198  for (; iterOut != iterEnd; ++i) {
2199  ListOfTracks::value_type o = std::move(*iterOut);
2200  // If tracks were removed from mOutputTracks, then there will be
2201  // tracks in the map that must be removed from mTracks.
2202  while (i < cnt && mOMap[i] != o.get()) {
2203  const auto t = mIMap[i];
2204  if (t) {
2205  mTracks->Remove(t);
2206  }
2207  i++;
2208  }
2209 
2210  // This should never happen
2211  wxASSERT(i < cnt);
2212 
2213  // Remove the track from the output list...don't DELETE it
2214  iterOut = mOutputTracks->erase(iterOut);
2215 
2216  const auto t = mIMap[i];
2217  if (t == NULL)
2218  {
2219  // This track is a NEW addition to output tracks; add it to mTracks
2220  mTracks->Add(std::move(o));
2221  }
2222  else
2223  {
2224  // Replace mTracks entry with the NEW track
2225  WaveTrack *newTrack = static_cast<WaveTrack*>(o.get());
2226  mTracks->Replace(t, std::move(o));
2227 
2228  // Swap the wavecache track the ondemand task uses, since now the NEW
2229  // one will be kept in the project
2232  newTrack);
2233  }
2234  }
2235  }
2236 
2237  // If tracks were removed from mOutputTracks, then there may be tracks
2238  // left at the end of the map that must be removed from mTracks.
2239  while (i < cnt) {
2240  const auto t = mIMap[i];
2241  if (t) {
2242  mTracks->Remove(t);
2243  }
2244  i++;
2245  }
2246 
2247  // Reset map
2248  mIMap.clear();
2249  mOMap.clear();
2250 
2251  // Make sure we processed everything
2252  wxASSERT(mOutputTracks->empty());
2253 
2254  // The output list is no longer needed
2255  mOutputTracks.reset();
2257 }
static bool IsInstanceCreated()
returns whether or not the singleton instance was created yet
Definition: ODManager.cpp:205
static ODManager *(* Instance)()
Definition: ODManager.h:49
TrackList * mTracks
Definition: Effect.h:508
int mOutputTracksType
Definition: Effect.h:481
void ReplaceWaveTrack(WaveTrack *oldTrack, WaveTrack *newTrack)
replace the wavetrack whose wavecache the gui watches for updates
Definition: ODManager.cpp:384
Track * Add(std::unique_ptr< TrackKind > &&t)
Add a Track, giving it a fresh id.
Definition: Track.cpp:901
std::vector< Track * > mOMap
Definition: Effect.h:524
ListOfTracks::value_type Replace(Track *t, ListOfTracks::value_type &&with)
Definition: Track.cpp:958
A Track that contains audio waveform data.
Definition: WaveTrack.h:60
std::vector< Track * > mIMap
Definition: Effect.h:523
TrackNodePointer Remove(Track *t)
Definition: Track.cpp:980
std::shared_ptr< TrackList > mOutputTracks
Definition: Effect.h:462
bool Effect::SaveUserPreset ( const wxString &  name)
override

Definition at line 625 of file Effect.cpp.

References GetAutomationParameters(), mClient, and SetPrivateConfig().

Referenced by NyquistEffect::Init(), SetBatchProcessing(), EffectNoise::Startup(), EffectNormalize::Startup(), EffectAutoDuck::Startup(), EffectClickRemoval::Startup(), EffectChangeSpeed::Startup(), EffectCompressor::Startup(), EffectDtmf::Startup(), EffectTruncSilence::Startup(), EffectScienFilter::Startup(), EffectReverb::Startup(), EffectEqualization::Startup(), and Startup().

626 {
627  if (mClient)
628  {
629  return mClient->SaveUserPreset(name);
630  }
631 
632  wxString parms;
633  if (!GetAutomationParameters(parms))
634  {
635  return false;
636  }
637 
638  return SetPrivateConfig(name, wxT("Parameters"), parms);
639 }
bool GetAutomationParameters(EffectAutomationParameters &parms) override
Definition: Effect.cpp:589
EffectClientInterface * mClient
Definition: Effect.h:530
bool SetPrivateConfig(const wxString &group, const wxString &key, const wxString &value) override
Definition: Effect.cpp:945
const wxChar * name
Definition: Distortion.cpp:94
bool Effect::SetAutomationParameters ( EffectAutomationParameters &  parms)
override

Definition at line 599 of file Effect.cpp.

References mClient.

Referenced by LoadUserPreset(), SetAutomationParameters(), and EffectManager::SetEffectParameters().

600 {
601  if (mClient)
602  {
603  return mClient->SetAutomationParameters(parms);
604  }
605 
606  return true;
607 }
EffectClientInterface * mClient
Definition: Effect.h:530
bool Effect::SetAutomationParameters ( const wxString &  parms)
virtual

Definition at line 1042 of file Effect.cpp.

References _(), GetCurrentSettingsGroup(), GetFactoryDefaultsGroup(), GetFactoryPresets(), GetUserPresetsGroup(), kCurrentSettingsIdent, kFactoryDefaultsIdent, kFactoryPresetIdent, kUserPresetIdent, LoadFactoryPreset(), LoadUserPreset(), MessageBox(), mUIDialog, SetAutomationParameters(), and TransferDataToWindow().

1043 {
1044  wxString preset = parms;
1045  bool success = false;
1046  if (preset.StartsWith(kUserPresetIdent))
1047  {
1048  preset.Replace(kUserPresetIdent, wxEmptyString, false);
1049  success = LoadUserPreset(GetUserPresetsGroup(preset));
1050  }
1051  else if (preset.StartsWith(kFactoryPresetIdent))
1052  {
1053  preset.Replace(kFactoryPresetIdent, wxEmptyString, false);
1054  wxArrayString presets = GetFactoryPresets();
1055  success = LoadFactoryPreset(presets.Index(preset));
1056  }
1057  else if (preset.StartsWith(kCurrentSettingsIdent))
1058  {
1059  preset.Replace(kCurrentSettingsIdent, wxEmptyString, false);
1061  }
1062  else if (preset.StartsWith(kFactoryDefaultsIdent))
1063  {
1064  preset.Replace(kFactoryDefaultsIdent, wxEmptyString, false);
1066  }
1067  else
1068  {
1069  EffectAutomationParameters eap(parms);
1070  success = SetAutomationParameters(eap);
1071  }
1072 
1073  if (!success)
1074  {
1076  wxString::Format(
1077  _("%s: Could not load settings below. Default settings will be used.\n\n%s"),
1078  GetTranslatedName(),
1079  preset
1080  )
1081  );
1082 
1083  return false;
1084  }
1085 
1086  if (!mUIDialog)
1087  {
1088  return true;
1089  }
1090 
1091  return TransferDataToWindow();
1092 }
wxString GetUserPresetsGroup(const wxString &name) override
Definition: Effect.cpp:813
int MessageBox(const wxString &message, long style=DefaultMessageBoxStyle, const wxString &titleStr=wxString{})
Definition: Effect.cpp:2665
wxString GetCurrentSettingsGroup() override
Definition: Effect.cpp:824
virtual bool TransferDataToWindow()
Definition: Effect.cpp:1879
bool LoadUserPreset(const wxString &name) override
Definition: Effect.cpp:609
wxArrayString GetFactoryPresets() override
Definition: Effect.cpp:641
static const wxString kUserPresetIdent
Definition: Effect.h:544
bool LoadFactoryPreset(int id) override
Definition: Effect.cpp:651
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom"))), OnMoveTrack) void TrackMenuTable::OnSetName(wxCommandEvent &)
wxDialog * mUIDialog
Definition: Effect.h:474
bool SetAutomationParameters(EffectAutomationParameters &parms) override
Definition: Effect.cpp:599
static const wxString kFactoryPresetIdent
Definition: Effect.h:545
static const wxString kCurrentSettingsIdent
Definition: Effect.h:546
wxString GetFactoryDefaultsGroup() override
Definition: Effect.cpp:829
static const wxString kFactoryDefaultsIdent
Definition: Effect.h:547
void Effect::SetBatchProcessing ( bool  start)
virtual

Definition at line 1147 of file Effect.cpp.

References GetSavedStateGroup(), LoadUserPreset(), mIsBatch, and SaveUserPreset().

Referenced by EffectManager::SetBatchProcessing().

1148 {
1149  mIsBatch = start;
1150 
1151  if (start)
1152  {
1154  }
1155  else
1156  {
1158  }
1159 }
bool SaveUserPreset(const wxString &name) override
Definition: Effect.cpp:625
bool LoadUserPreset(const wxString &name) override
Definition: Effect.cpp:609
bool mIsBatch
Definition: Effect.h:510
virtual wxString GetSavedStateGroup()
Definition: Effect.cpp:834
size_t Effect::SetBlockSize ( size_t  maxBlockSize)
override

Definition at line 357 of file Effect.cpp.

References mBlockSize, and mClient.

Referenced by ProcessPass(), EffectBassTreble::RealtimeInitialize(), EffectWahwah::RealtimeInitialize(), EffectPhaser::RealtimeInitialize(), and EffectDistortion::RealtimeInitialize().

358 {
359  if (mClient)
360  {
361  return mClient->SetBlockSize(maxBlockSize);
362  }
363 
364  mBlockSize = maxBlockSize;
365 
366  return mBlockSize;
367 }
EffectClientInterface * mClient
Definition: Effect.h:530
size_t mBlockSize
Definition: Effect.h:535
void Effect::SetDuration ( double  duration)
override

Definition at line 767 of file Effect.cpp.

References GetCurrentSettingsGroup(), GetType(), mDuration, mIsSelection, and SetPrivateConfig().

Referenced by EffectDtmf::OnDuration(), EffectDtmf::Recalculate(), EffectSilence::TransferDataFromWindow(), EffectNoise::TransferDataFromWindow(), EffectToneGen::TransferDataFromWindow(), and EffectDtmf::TransferDataFromWindow().

768 {
769  if (seconds < 0.0)
770  {
771  seconds = 0.0;
772  }
773 
774  if (GetType() == EffectTypeGenerate)
775  {
776  SetPrivateConfig(GetCurrentSettingsGroup(), wxT("LastUsedDuration"), seconds);
777  }
778 
779  mDuration = seconds;
780 
781  mIsSelection = false;
782 
783  return;
784 }
wxString GetCurrentSettingsGroup() override
Definition: Effect.cpp:824
bool SetPrivateConfig(const wxString &group, const wxString &key, const wxString &value) override
Definition: Effect.cpp:945
bool mIsSelection
Definition: Effect.h:515
EffectType GetType() override
Definition: Effect.cpp:146
double mDuration
Definition: Effect.h:516
bool Effect::SetHost ( EffectHostInterface *  host)
override

Definition at line 297 of file Effect.cpp.

References mClient.

Referenced by Startup().

298 {
299  if (mClient)
300  {
301  return mClient->SetHost(host);
302  }
303 
304  return true;
305 }
EffectClientInterface * mClient
Definition: Effect.h:530
void Effect::SetHostUI ( EffectUIHostInterface *  host)
override

Definition at line 673 of file Effect.cpp.

674 {
675 }
void Effect::SetLinearEffectFlag ( bool  linearEffectFlag)
protected

Definition at line 1964 of file Effect.cpp.

References mIsLinearEffect.

Referenced by EffectEcho::EffectEcho(), EffectNoise::EffectNoise(), EffectSilence::EffectSilence(), and NyquistEffect::Parse().

1965 {
1966  mIsLinearEffect = linearEffectFlag;
1967 }
bool mIsLinearEffect
Definition: Effect.h:511
void Effect::SetPresetParameters ( const wxArrayString *  Names,
const wxArrayString *  Values 
)
inline

Definition at line 243 of file Effect.h.

Referenced by DoEffect().

243  {
244  if( Names ) mPresetNames = *Names;
245  if( Values ) mPresetValues = *Values;
246  }
wxArrayString mPresetNames
Definition: Effect.h:469
wxArrayString mPresetValues
Definition: Effect.h:470
void Effect::SetPreviewFullSelectionFlag ( bool  previewDurationFlag)
protected

Definition at line 1969 of file Effect.cpp.

References mPreviewFullSelection.

Referenced by NyquistEffect::Parse().

1970 {
1971  mPreviewFullSelection = previewDurationFlag;
1972 }
bool mPreviewFullSelection
Definition: Effect.h:513
bool Effect::SetPrivateConfig ( const wxString &  group,
const wxString &  key,
const wxString &  value 
)
override

Definition at line 945 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::SetPrivateConfig().

Referenced by EffectChangeSpeed::OnChoice_Vinyl(), SaveUserPreset(), SetDuration(), EffectChangeSpeed::Startup(), EffectEqualization::Startup(), Startup(), EffectChangeSpeed::TransferDataFromWindow(), and EffectEqualization::ValidateUI().

946 {
947  return PluginManager::Get().SetPrivateConfig(GetID(), group, key, value);
948 }
virtual PluginID GetID()
Definition: Effect.cpp:982
bool SetPrivateConfig(const PluginID &ID, const wxString &group, const wxString &key, const wxString &value) override
static PluginManager & Get()
bool Effect::SetPrivateConfig ( const wxString &  group,
const wxString &  key,
const int &  value 
)
override

Definition at line 950 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::SetPrivateConfig().

951 {
952  return PluginManager::Get().SetPrivateConfig(GetID(), group, key, value);
953 }
virtual PluginID GetID()
Definition: Effect.cpp:982
bool SetPrivateConfig(const PluginID &ID, const wxString &group, const wxString &key, const wxString &value) override
static PluginManager & Get()
bool Effect::SetPrivateConfig ( const wxString &  group,
const wxString &  key,
const bool &  value 
)
override

Definition at line 955 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::SetPrivateConfig().

956 {
957  return PluginManager::Get().SetPrivateConfig(GetID(), group, key, value);
958 }
virtual PluginID GetID()
Definition: Effect.cpp:982
bool SetPrivateConfig(const PluginID &ID, const wxString &group, const wxString &key, const wxString &value) override
static PluginManager & Get()
bool Effect::SetPrivateConfig ( const wxString &  group,
const wxString &  key,
const float &  value 
)
override

Definition at line 960 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::SetPrivateConfig().

961 {
962  return PluginManager::Get().SetPrivateConfig(GetID(), group, key, value);
963 }
virtual PluginID GetID()
Definition: Effect.cpp:982
bool SetPrivateConfig(const PluginID &ID, const wxString &group, const wxString &key, const wxString &value) override
static PluginManager & Get()
bool Effect::SetPrivateConfig ( const wxString &  group,
const wxString &  key,
const double &  value 
)
override

Definition at line 965 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::SetPrivateConfig().

966 {
967  return PluginManager::Get().SetPrivateConfig(GetID(), group, key, value);
968 }
virtual PluginID GetID()
Definition: Effect.cpp:982
bool SetPrivateConfig(const PluginID &ID, const wxString &group, const wxString &key, const wxString &value) override
static PluginManager & Get()
void Effect::SetSampleRate ( double  rate)
override

Definition at line 347 of file Effect.cpp.

References mClient, and mSampleRate.

Referenced by ProcessPass().

348 {
349  if (mClient)
350  {
351  mClient->SetSampleRate(rate);
352  }
353 
354  mSampleRate = rate;
355 }
EffectClientInterface * mClient
Definition: Effect.h:530
double mSampleRate
Definition: Effect.h:458
bool Effect::SetSharedConfig ( const wxString &  group,
const wxString &  key,
const wxString &  value 
)
override

Definition at line 875 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::SetSharedConfig().

876 {
877  return PluginManager::Get().SetSharedConfig(GetID(), group, key, value);
878 }
virtual PluginID GetID()
Definition: Effect.cpp:982
bool SetSharedConfig(const PluginID &ID, const wxString &group, const wxString &key, const wxString &value) override
static PluginManager & Get()
bool Effect::SetSharedConfig ( const wxString &  group,
const wxString &  key,
const int &  value 
)
override

Definition at line 880 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::SetSharedConfig().

881 {
882  return PluginManager::Get().SetSharedConfig(GetID(), group, key, value);
883 }
virtual PluginID GetID()
Definition: Effect.cpp:982
bool SetSharedConfig(const PluginID &ID, const wxString &group, const wxString &key, const wxString &value) override
static PluginManager & Get()
bool Effect::SetSharedConfig ( const wxString &  group,
const wxString &  key,
const bool &  value 
)
override

Definition at line 885 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::SetSharedConfig().

886 {
887  return PluginManager::Get().SetSharedConfig(GetID(), group, key, value);
888 }
virtual PluginID GetID()
Definition: Effect.cpp:982
bool SetSharedConfig(const PluginID &ID, const wxString &group, const wxString &key, const wxString &value) override
static PluginManager & Get()
bool Effect::SetSharedConfig ( const wxString &  group,
const wxString &  key,
const float &  value 
)
override

Definition at line 890 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::SetSharedConfig().

891 {
892  return PluginManager::Get().SetSharedConfig(GetID(), group, key, value);
893 }
virtual PluginID GetID()
Definition: Effect.cpp:982
bool SetSharedConfig(const PluginID &ID, const wxString &group, const wxString &key, const wxString &value) override
static PluginManager & Get()
bool Effect::SetSharedConfig ( const wxString &  group,
const wxString &  key,
const double &  value 
)
override

Definition at line 895 of file Effect.cpp.

References PluginManager::Get(), GetID(), and PluginManager::SetSharedConfig().

896 {
897  return PluginManager::Get().SetSharedConfig(GetID(), group, key, value);
898 }
virtual PluginID GetID()
Definition: Effect.cpp:982
bool SetSharedConfig(const PluginID &ID, const wxString &group, const wxString &key, const wxString &value) override
static PluginManager & Get()
bool Effect::ShowInterface ( wxWindow *  parent,
bool  forceModal = false 
)
override

Definition at line 539 of file Effect.cpp.

References CreateUI(), IsInteractive(), ScreenshotCommand::MayCapture(), mClient, mUIDialog, SupportsRealtime(), and valueRestorer().

Referenced by PromptUser(), and NyquistEffect::ShowInterface().

540 {
541  if (!IsInteractive())
542  {
543  return true;
544  }
545 
546  if (mUIDialog)
547  {
548  if ( mUIDialog->Close(true) )
549  mUIDialog = nullptr;
550  return false;
551  }
552 
553  if (mClient)
554  {
555  return mClient->ShowInterface(parent, forceModal);
556  }
557 
558  // mUIDialog is null
559  auto cleanup = valueRestorer( mUIDialog );
560 
561  mUIDialog = CreateUI(parent, this);
562  if (!mUIDialog)
563  {
564  return false;
565  }
566 
567 
568  mUIDialog->Layout();
569  mUIDialog->Fit();
570  mUIDialog->SetMinSize(mUIDialog->GetSize());
571 
573  return false;
574 
575  if( SupportsRealtime() && !forceModal )
576  {
577  mUIDialog->Show();
578  cleanup.release();
579 
580  // Return false to bypass effect processing
581  return false;
582  }
583 
584  bool res = mUIDialog->ShowModal() != 0;
585 
586  return res;
587 }
EffectClientInterface * mClient
Definition: Effect.h:530
bool IsInteractive() override
Definition: Effect.cpp:245
ValueRestorer< T > valueRestorer(T &var)
Definition: MemoryX.h:875
wxDialog * mUIDialog
Definition: Effect.h:474
wxDialog * CreateUI(wxWindow *parent, EffectUIClientInterface *client) override
Definition: Effect.cpp:799
bool SupportsRealtime() override
Definition: Effect.cpp:275
static bool MayCapture(wxDialog *pDlg)
void Effect::ShowOptions ( )
override

Definition at line 736 of file Effect.cpp.

737 {
738 }
bool Effect::Startup ( EffectClientInterface *  client)
virtual

Definition at line 992 of file Effect.cpp.

References GetAudioInCount(), GetAudioOutCount(), GetCurrentSettingsGroup(), GetFactoryDefaultsGroup(), GetPrivateConfig(), LoadUserPreset(), mClient, mNumAudioIn, mNumAudioOut, SaveUserPreset(), SetHost(), SetPrivateConfig(), and Startup().

993 {
994  // Let destructor know we need to be shutdown
995  mClient = client;
996 
997  // Set host so client startup can use our services
998  if (!SetHost(this))
999  {
1000  // Bail if the client startup fails
1001  mClient = NULL;
1002  return false;
1003  }
1004 
1007 
1008  bool haveDefaults;
1009  GetPrivateConfig(GetFactoryDefaultsGroup(), wxT("Initialized"), haveDefaults, false);
1010  if (!haveDefaults)
1011  {
1013  SetPrivateConfig(GetFactoryDefaultsGroup(), wxT("Initialized"), true);
1014  }
1016 
1017  return Startup();
1018 }
unsigned GetAudioInCount() override
Definition: Effect.cpp:307
bool SaveUserPreset(const wxString &name) override
Definition: Effect.cpp:625
bool GetPrivateConfig(const wxString &group, const wxString &key, wxString &value, const wxString &defval=wxEmptyString) override
Definition: Effect.cpp:920
wxString GetCurrentSettingsGroup() override
Definition: Effect.cpp:824
EffectClientInterface * mClient
Definition: Effect.h:530
bool SetPrivateConfig(const wxString &group, const wxString &key, const wxString &value) override
Definition: Effect.cpp:945
bool LoadUserPreset(const wxString &name) override
Definition: Effect.cpp:609
size_t mNumAudioIn
Definition: Effect.h:531
size_t mNumAudioOut
Definition: Effect.h:532
bool SetHost(EffectHostInterface *host) override
Definition: Effect.cpp:297
unsigned GetAudioOutCount() override
Definition: Effect.cpp:317
wxString GetFactoryDefaultsGroup() override
Definition: Effect.cpp:829
virtual bool Startup()
Definition: Effect.cpp:1020
bool Effect::Startup ( )
virtual

Reimplemented in EffectEqualization, EffectReverb, EffectScienFilter, EffectTruncSilence, EffectChangeSpeed, EffectCompressor, EffectDtmf, EffectClickRemoval, EffectAutoDuck, EffectNoise, and EffectNormalize.

Definition at line 1020 of file Effect.cpp.

Referenced by Startup().

1021 {
1022  return true;
1023 }
bool Effect::SupportsAutomation ( )
override

Definition at line 285 of file Effect.cpp.

References mClient.

286 {
287  if (mClient)
288  {
289  return mClient->SupportsAutomation();
290  }
291 
292  return true;
293 }
EffectClientInterface * mClient
Definition: Effect.h:530
bool Effect::SupportsRealtime ( )
override

Definition at line 275 of file Effect.cpp.

References mClient.

Referenced by EffectManager::DoEffect(), EnablePreview(), and ShowInterface().

276 {
277  if (mClient)
278  {
279  return mClient->SupportsRealtime();
280  }
281 
282  return false;
283 }
EffectClientInterface * mClient
Definition: Effect.h:530
bool Effect::TotalProgress ( double  frac)
protected

Definition at line 1980 of file Effect.cpp.

References mProgress, Success, and ProgressDialog::Update().

Referenced by EffectTruncSilence::Analyze(), EffectAutoDuck::ApplyDuckFade(), NyquistEffect::GetCallback(), EffectAutoDuck::Process(), EffectTwoPassSimpleMono::ProcessOne(), and NyquistEffect::PutCallback().

1981 {
1982  auto updateResult = (mProgress ?
1983  mProgress->Update(frac) :
1985  return (updateResult != ProgressResult::Success);
1986 }
ProgressDialog * mProgress
Definition: Effect.h:455
ProgressResult Update(int value, const wxString &message=wxEmptyString)
bool Effect::TrackGroupProgress ( int  whichGroup,
double  frac,
const wxString &  msg = wxEmptyString 
)
protected

Definition at line 1996 of file Effect.cpp.

References mNumGroups, mProgress, Success, and ProgressDialog::Update().

Referenced by NyquistEffect::ProcessOne(), and ProcessTrack().

1997 {
1998  auto updateResult = (mProgress ?
1999  mProgress->Update(whichGroup + frac, (double) mNumGroups, msg) :
2001  return (updateResult != ProgressResult::Success);
2002 }
ProgressDialog * mProgress
Definition: Effect.h:455
ProgressResult Update(int value, const wxString &message=wxEmptyString)
int mNumGroups
Definition: Effect.h:527
bool Effect::TrackProgress ( int  whichTrack,
double  frac,
const wxString &  msg = wxEmptyString 
)
protected
bool Effect::TransferDataFromWindow ( )
protectedvirtual
bool Effect::TransferDataToWindow ( )
protectedvirtual
bool Effect::ValidateUI ( )
override

Definition at line 697 of file Effect.cpp.

References mUIParent.

698 {
699  return mUIParent->Validate();
700 }
wxWindow * mUIParent
Definition: Effect.h:475

Friends And Related Function Documentation

friend class EffectManager
friend

Definition at line 549 of file Effect.h.

friend class EffectPresetsDialog
friend

Definition at line 552 of file Effect.h.

friend class EffectRack
friend

Definition at line 550 of file Effect.h.

friend class EffectUIHost
friend

Definition at line 551 of file Effect.h.

Member Data Documentation

const wxString Effect::kCurrentSettingsIdent = wxT("<Current Settings>")
staticprivate
const wxString Effect::kFactoryDefaultsIdent = wxT("<Factory Defaults>")
staticprivate
const wxString Effect::kFactoryPresetIdent = wxT("Factory Preset:")
staticprivate
const wxString Effect::kUserPresetIdent = wxT("User Preset:")
staticprivate
size_t Effect::mBlockSize
private
size_t Effect::mBufferSize
private

Definition at line 534 of file Effect.h.

Referenced by Effect(), ProcessPass(), and ProcessTrack().

EffectClientInterface* Effect::mClient
private
int Effect::mCurrentProcessor
private

Definition at line 539 of file Effect.h.

Referenced by RealtimeAddProcessor().

double Effect::mDuration
private
wxString Effect::mDurationFormat
private

Definition at line 517 of file Effect.h.

Referenced by DoEffect(), and GetDurationFormat().

double Effect::mF0
protected
double Effect::mF1
protected
TrackFactory* Effect::mFactory
protected
std::vector<int> Effect::mGroupProcessor
private

Definition at line 538 of file Effect.h.

Referenced by RealtimeAddProcessor(), and RealtimeProcess().

std::vector<Track*> Effect::mIMap
private

Definition at line 523 of file Effect.h.

Referenced by AddToOutputTracks(), CopyInputTracks(), and ReplaceProcessedTracks().

bool Effect::mIsBatch
private
bool Effect::mIsLinearEffect
private

Definition at line 511 of file Effect.h.

Referenced by Effect(), Preview(), and SetLinearEffectFlag().

bool Effect::mIsPreview
private

Definition at line 519 of file Effect.h.

Referenced by Effect(), Preview(), and ProcessTrack().

bool Effect::mIsSelection
private

Definition at line 515 of file Effect.h.

Referenced by SetDuration().

size_t Effect::mNumAudioIn
private

Definition at line 531 of file Effect.h.

Referenced by Effect(), Process(), ProcessPass(), RealtimeAddProcessor(), RealtimeProcess(), and Startup().

size_t Effect::mNumAudioOut
private
unsigned Effect::mNumChannels
private

Definition at line 536 of file Effect.h.

Referenced by Effect(), ProcessPass(), and ProcessTrack().

int Effect::mNumGroups
private

Definition at line 527 of file Effect.h.

Referenced by CountWaveTracks(), Effect(), and TrackGroupProgress().

int Effect::mNumTracks
private

Definition at line 526 of file Effect.h.

Referenced by CountWaveTracks(), Effect(), Preview(), and TrackProgress().

std::vector<Track*> Effect::mOMap
private

Definition at line 524 of file Effect.h.

Referenced by AddToOutputTracks(), CopyInputTracks(), and ReplaceProcessedTracks().

std::shared_ptr<TrackList> Effect::mOutputTracks
protected
int Effect::mOutputTracksType
protected

Definition at line 481 of file Effect.h.

Referenced by CopyInputTracks(), Effect(), and ReplaceProcessedTracks().

int Effect::mPass
protected

Definition at line 471 of file Effect.h.

Referenced by GetPass(), and Process().

wxArrayString Effect::mPresetNames
protected

Definition at line 469 of file Effect.h.

Referenced by NyquistEffect::Parse().

wxArrayString Effect::mPresetValues
protected

Definition at line 470 of file Effect.h.

bool Effect::mPreviewFullSelection
private

Definition at line 513 of file Effect.h.

Referenced by Effect(), Preview(), and SetPreviewFullSelectionFlag().

bool Effect::mPreviewWithNotSelected
private

Definition at line 512 of file Effect.h.

Referenced by Effect(), IncludeNotSelectedPreviewTracks(), and Preview().

ProgressDialog* Effect::mProgress
protected
double Effect::mProjectRate
protected
SelectedRegion* Effect::mpSelectedRegion {}
protected

Definition at line 459 of file Effect.h.

Referenced by Delegate(), and DoEffect().

int Effect::mRealtimeSuspendCount
private

Definition at line 542 of file Effect.h.

Referenced by Effect(), IsRealtimeActive(), RealtimeResume(), and RealtimeSuspend().

wxCriticalSection Effect::mRealtimeSuspendLock
private

Definition at line 541 of file Effect.h.

Referenced by Effect(), RealtimeResume(), and RealtimeSuspend().

sampleCount Effect::mSampleCnt
protected

Definition at line 478 of file Effect.h.

Referenced by EffectFade::ProcessBlock(), EffectToneGen::ProcessBlock(), and ProcessPass().

double Effect::mSampleRate
protected
double Effect::mT0
protected
double Effect::mT1
protected
TrackList* Effect::mTracks
private
bool Effect::mUIDebug
private

Definition at line 521 of file Effect.h.

Referenced by Effect(), and EnableDebug().

wxDialog* Effect::mUIDialog
protected
wxWindow* Effect::mUIParent
protected

Definition at line 475 of file Effect.h.

Referenced by CloseUI(), Effect(), EnableApply(), EnablePreview(), MessageBox(), EffectBassTreble::OnBassSlider(), EffectBassTreble::OnBassText(), EffectTruncSilence::OnControlChange(), EffectToneGen::OnControlUpdate(), EffectScienFilter::OnCutoff(), EffectWahwah::OnDepthSlider(), EffectPhaser::OnDepthSlider(), EffectWahwah::OnDepthText(), EffectPhaser::OnDepthText(), EffectPhaser::OnDryWetSlider(), EffectPhaser::OnDryWetText(), EffectPhaser::OnFeedbackSlider(), EffectPhaser::OnFeedbackText(), EffectWahwah::OnFreqOffSlider(), EffectWahwah::OnFreqOffText(), EffectWahwah::OnFreqSlider(), EffectPhaser::OnFreqSlider(), EffectWahwah::OnFreqText(), EffectPhaser::OnFreqText(), EffectWahwah::OnGainSlider(), EffectPhaser::OnGainSlider(), EffectBassTreble::OnGainSlider(), EffectBassTreble::OnGainText(), EffectWahwah::OnGainText(), EffectPhaser::OnGainText(), NyquistEffect::OnLoad(), EffectEqualization::OnManage(), EditCurvesDialog::OnOK(), EffectWahwah::OnPhaseSlider(), EffectPhaser::OnPhaseSlider(), EffectWahwah::OnPhaseText(), EffectPhaser::OnPhaseText(), EffectWahwah::OnResonanceSlider(), EffectWahwah::OnResonanceText(), EffectScienFilter::OnRipple(), NyquistEffect::OnSave(), EffectScienFilter::OnSize(), EffectEqualization::OnSize(), NyquistEffect::OnSlider(), EffectPhaser::OnStagesSlider(), EffectPhaser::OnStagesText(), EffectScienFilter::OnStopbandRipple(), EffectPaulstretch::OnText(), NyquistEffect::OnText(), EffectBassTreble::OnTrebleSlider(), EffectBassTreble::OnTrebleText(), EffectEqualization::PopulateOrExchange(), EffectEqualization::PopulateUI(), PopulateUI(), NyquistEffect::Process(), EffectPaulstretch::TransferDataFromWindow(), EffectRepeat::TransferDataFromWindow(), EffectFindClipping::TransferDataFromWindow(), EffectNoise::TransferDataFromWindow(), EffectNormalize::TransferDataFromWindow(), EffectToneGen::TransferDataFromWindow(), EffectEcho::TransferDataFromWindow(), EffectCompressor::TransferDataFromWindow(), EffectDtmf::TransferDataFromWindow(), EffectClickRemoval::TransferDataFromWindow(), EffectChangeSpeed::TransferDataFromWindow(), EffectAutoDuck::TransferDataFromWindow(), EffectAmplify::TransferDataFromWindow(), EffectScienFilter::TransferDataFromWindow(), EffectReverb::TransferDataFromWindow(), EffectTruncSilence::TransferDataFromWindow(), EffectBassTreble::TransferDataFromWindow(), EffectWahwah::TransferDataFromWindow(), EffectPhaser::TransferDataFromWindow(), EffectDistortion::TransferDataFromWindow(), NyquistEffect::TransferDataFromWindow(), NyquistEffect::TransferDataToEffectWindow(), EffectPaulstretch::TransferDataToWindow(), EffectFindClipping::TransferDataToWindow(), EffectNoise::TransferDataToWindow(), EffectEcho::TransferDataToWindow(), EffectNormalize::TransferDataToWindow(), EffectToneGen::TransferDataToWindow(), EffectClickRemoval::TransferDataToWindow(), EffectAutoDuck::TransferDataToWindow(), EffectDtmf::TransferDataToWindow(), EffectChangeSpeed::TransferDataToWindow(), EffectScienFilter::TransferDataToWindow(), EffectTruncSilence::TransferDataToWindow(), EffectBassTreble::TransferDataToWindow(), EffectWahwah::TransferDataToWindow(), EffectPhaser::TransferDataToWindow(), EffectDistortion::TransferDataToWindow(), NyquistEffect::TransferDataToWindow(), EffectEqualization::TransferDataToWindow(), EffectScienFilter::TransferGraphLimitsFromWindow(), EffectEqualization::UpdateDraw(), EffectEqualization::UpdateGraphic(), EffectNormalize::UpdateUI(), and ValidateUI().

int Effect::mUIResultID
protected

Definition at line 476 of file Effect.h.

Referenced by NyquistEffect::ShowInterface().


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