Audacity  2.2.0
Effect.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  Effect.h
6 
7  Dominic Mazzoni
8  Vaughan Johnson
9 
10 **********************************************************************/
11 
12 #ifndef __AUDACITY_EFFECT__
13 #define __AUDACITY_EFFECT__
14 
15 #include "../Audacity.h"
16 #include "../MemoryX.h"
17 #include <set>
18 
19 #include "../MemoryX.h"
20 #include <wx/bmpbuttn.h>
21 #include <wx/defs.h>
22 #include <wx/dynarray.h>
23 #include <wx/intl.h>
24 #include <wx/string.h>
25 #include <wx/tglbtn.h>
26 #include <wx/event.h> // for idle event.
27 
28 class wxCheckBox;
29 class wxChoice;
30 class wxListBox;
31 class wxWindow;
32 
33 #include "audacity/ConfigInterface.h"
34 #include "audacity/EffectInterface.h"
35 
36 #include "../Experimental.h"
37 #include "../SampleFormat.h"
38 #include "../SelectedRegion.h"
39 #include "../Shuttle.h"
40 #include "../Internat.h"
41 #include "../widgets/ProgressDialog.h"
42 
43 #include "../Track.h"
44 
45 class ShuttleGui;
46 
47 #define BUILTIN_EFFECT_PREFIX wxT("Built-in Effect: ")
48 
49 class AudacityProject;
50 class LabelTrack;
51 class SelectedRegion;
52 class EffectUIHost;
53 class Track;
54 class TrackList;
55 class TrackFactory;
56 class WaveTrack;
57 
58 // TODO: Apr-06-2015
59 // TODO: Much more cleanup of old methods and variables is needed, but
60 // TODO: can't be done until after all effects are using the NEW API.
61 
62 class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler,
63  public EffectClientInterface,
64  public EffectUIClientInterface,
65  public EffectHostInterface
66 {
67  //
68  // public methods
69  //
70  // Used by the outside program to determine properties of an effect and
71  // apply the effect to one or more tracks.
72  //
73  public:
74  // The constructor is called once by each subclass at the beginning of the program.
75  // Avoid allocating memory or doing time-consuming processing here.
76  Effect();
77  virtual ~Effect();
78 
79  // IdentInterface implementation
80 
81  wxString GetPath() override;
82  wxString GetSymbol() override;
83  wxString GetName() override;
84  wxString GetVendor() override;
85  wxString GetVersion() override;
86  wxString GetDescription() override;
87 
88  // EffectIdentInterface implementation
89 
90  EffectType GetType() override;
91  wxString GetFamily() override;
92  bool IsInteractive() override;
93  bool IsDefault() override;
94  bool IsLegacy() override;
95  bool SupportsRealtime() override;
96  bool SupportsAutomation() override;
97 
98  // EffectClientInterface implementation
99 
100  bool SetHost(EffectHostInterface *host) override;
101 
102  unsigned GetAudioInCount() override;
103  unsigned GetAudioOutCount() override;
104 
105  int GetMidiInCount() override;
106  int GetMidiOutCount() override;
107 
108  sampleCount GetLatency() override;
109  size_t GetTailSize() override;
110 
111  void SetSampleRate(double rate) override;
112  size_t SetBlockSize(size_t maxBlockSize) override;
113 
114  bool IsReady() override;
115  bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
116  bool ProcessFinalize() override;
117  size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
118 
119  bool RealtimeInitialize() override;
120  bool RealtimeAddProcessor(unsigned numChannels, float sampleRate) override;
121  bool RealtimeFinalize() override;
122  bool RealtimeSuspend() override;
123  bool RealtimeResume() override;
124  bool RealtimeProcessStart() override;
125  size_t RealtimeProcess(int group,
126  float **inbuf,
127  float **outbuf,
128  size_t numSamples) override;
129  bool RealtimeProcessEnd() override;
130 
131  bool ShowInterface(wxWindow *parent, bool forceModal = false) override;
132 
133  bool GetAutomationParameters(EffectAutomationParameters & parms) override;
134  bool SetAutomationParameters(EffectAutomationParameters & parms) override;
135 
136  bool LoadUserPreset(const wxString & name) override;
137  bool SaveUserPreset(const wxString & name) override;
138 
139  wxArrayString GetFactoryPresets() override;
140  bool LoadFactoryPreset(int id) override;
141  bool LoadFactoryDefaults() override;
142 
143  // EffectUIClientInterface implementation
144 
145  void SetHostUI(EffectUIHostInterface *host) override;
146  bool PopulateUI(wxWindow *parent) override;
147  bool IsGraphicalUI() override;
148  bool ValidateUI() override;
149  bool HideUI() override;
150  bool CloseUI() override;
151 
152  bool CanExportPresets() override;
153  void ExportPresets() override;
154  void ImportPresets() override;
155 
156  bool HasOptions() override;
157  void ShowOptions() override;
158 
159  // EffectHostInterface implementation
160 
161  double GetDefaultDuration() override;
162  double GetDuration() override;
163  wxString GetDurationFormat() override;
164  virtual wxString GetSelectionFormat() /* not override? */; // time format in Selection toolbar
165  void SetDuration(double duration) override;
166 
167  bool Apply() override;
168  void Preview() override;
169 
170  wxDialog *CreateUI(wxWindow *parent, EffectUIClientInterface *client) override;
171 
172  wxString GetUserPresetsGroup(const wxString & name) override;
173  wxString GetCurrentSettingsGroup() override;
174  wxString GetFactoryDefaultsGroup() override;
175  virtual wxString GetSavedStateGroup() /* not override? */;
176 
177  // ConfigClientInterface implementation
178 
179  bool HasSharedConfigGroup(const wxString & group) override;
180  bool GetSharedConfigSubgroups(const wxString & group, wxArrayString & subgroups) override;
181 
182  bool GetSharedConfig(const wxString & group, const wxString & key, wxString & value, const wxString & defval = wxEmptyString) override;
183  bool GetSharedConfig(const wxString & group, const wxString & key, int & value, int defval = 0) override;
184  bool GetSharedConfig(const wxString & group, const wxString & key, bool & value, bool defval = false) override;
185  bool GetSharedConfig(const wxString & group, const wxString & key, float & value, float defval = 0.0) override;
186  bool GetSharedConfig(const wxString & group, const wxString & key, double & value, double defval = 0.0) override;
187 
188  bool SetSharedConfig(const wxString & group, const wxString & key, const wxString & value) override;
189  bool SetSharedConfig(const wxString & group, const wxString & key, const int & value) override;
190  bool SetSharedConfig(const wxString & group, const wxString & key, const bool & value) override;
191  bool SetSharedConfig(const wxString & group, const wxString & key, const float & value) override;
192  bool SetSharedConfig(const wxString & group, const wxString & key, const double & value) override;
193 
194  bool RemoveSharedConfigSubgroup(const wxString & group) override;
195  bool RemoveSharedConfig(const wxString & group, const wxString & key) override;
196 
197  bool HasPrivateConfigGroup(const wxString & group) override;
198  bool GetPrivateConfigSubgroups(const wxString & group, wxArrayString & subgroups) override;
199 
200  bool GetPrivateConfig(const wxString & group, const wxString & key, wxString & value, const wxString & defval = wxEmptyString) override;
201  bool GetPrivateConfig(const wxString & group, const wxString & key, int & value, int defval = 0) override;
202  bool GetPrivateConfig(const wxString & group, const wxString & key, bool & value, bool defval = false) override;
203  bool GetPrivateConfig(const wxString & group, const wxString & key, float & value, float defval = 0.0) override;
204  bool GetPrivateConfig(const wxString & group, const wxString & key, double & value, double defval = 0.0) override;
205 
206  bool SetPrivateConfig(const wxString & group, const wxString & key, const wxString & value) override;
207  bool SetPrivateConfig(const wxString & group, const wxString & key, const int & value) override;
208  bool SetPrivateConfig(const wxString & group, const wxString & key, const bool & value) override;
209  bool SetPrivateConfig(const wxString & group, const wxString & key, const float & value) override;
210  bool SetPrivateConfig(const wxString & group, const wxString & key, const double & value) override;
211 
212  bool RemovePrivateConfigSubgroup(const wxString & group) override;
213  bool RemovePrivateConfig(const wxString & group, const wxString & key) override;
214 
215  // Effect implementation
216 
217  // NEW virtuals
218  virtual PluginID GetID();
219 
220  virtual bool Startup(EffectClientInterface *client);
221  virtual bool Startup();
222 
223  virtual bool GetAutomationParameters(wxString & parms);
224  virtual bool SetAutomationParameters(const wxString & parms);
225 
226  virtual wxArrayString GetUserPresets();
227  virtual bool HasCurrentSettings();
228  virtual bool HasFactoryDefaults();
229  virtual wxString GetPreset(wxWindow * parent, const wxString & parms);
230 
231  // Name of page in the Audacity alpha manual
232  virtual wxString ManualPage();
233  // Fully qualified local help file name
234  virtual wxString HelpPage();
235 
236  virtual bool IsBatchProcessing();
237  virtual void SetBatchProcessing(bool start);
238 
239  /* not virtual */ void SetPresetParameters( const wxArrayString * Names, const wxArrayString * Values ) {
240  if( Names ) mPresetNames = *Names;
241  if( Values ) mPresetValues = *Values;
242  }
243 
244  // Returns true on success. Will only operate on tracks that
245  // have the "selected" flag set to true, which is consistent with
246  // Audacity's standard UI.
247  /* not virtual */ bool DoEffect(wxWindow *parent, double projectRate, TrackList *list,
248  TrackFactory *factory, SelectedRegion *selectedRegion,
249  bool shouldPrompt = true);
250 
251  bool Delegate( Effect &delegate,
252  wxWindow *parent, SelectedRegion *selectedRegion, bool shouldPrompt);
253 
254  // Realtime Effect Processing
255  /* not virtual */ bool RealtimeAddProcessor(int group, unsigned chans, float rate);
256  /* not virtual */ size_t RealtimeProcess(int group,
257  unsigned chans,
258  float **inbuf,
259  float **outbuf,
260  size_t numSamples);
261  /* not virtual */ bool IsRealtimeActive();
262 
263  virtual bool IsHidden();
264 //
265 // protected virtual methods
266 //
267 // Each subclass of Effect overrides one or more of these methods to
268 // do its processing.
269 //
270 protected:
271  // Called once each time an effect is called. Perform any initialization;
272  // make sure that the effect can be performed on the selected tracks and
273  // return false otherwise
274  virtual bool Init();
275 
276  // If necessary, open a dialog to get parameters from the user.
277  // This method will not always be called (for example if a user
278  // repeats an effect) but if it is called, it will be called
279  // after Init.
280  virtual bool PromptUser(wxWindow *parent);
281 
282  // Check whether effect should be skipped
283  // Typically this is only useful in automation, for example
284  // detecting that zero noise reduction is to be done,
285  // or that normalisation is being done without Dc bias shift
286  // or amplitude modification
287  virtual bool CheckWhetherSkipEffect() { return false; }
288 
289  // Actually do the effect here.
290  virtual bool Process();
291  virtual bool ProcessPass();
292  virtual bool InitPass1();
293  virtual bool InitPass2();
294  virtual int GetPass();
295 
296  // clean up any temporary memory, needed only per invocation of the
297  // effect, after either successful or failed or exception-aborted processing.
298  // Invoked inside a "finally" block so it must be no-throw.
299  virtual void End();
300 
301  // Most effects just use the previewLength, but time-stretching/compressing
302  // effects need to use a different input length, so override this method.
303  virtual double CalcPreviewInputLength(double previewLength);
304 
305  // The Effect class fully implements the Preview method for you.
306  // Only override it if you need to do preprocessing or cleanup.
307  virtual void Preview(bool dryOnly);
308 
309  virtual void PopulateOrExchange(ShuttleGui & S);
310  virtual bool TransferDataToWindow();
311  virtual bool TransferDataFromWindow();
312  virtual bool EnableApply(bool enable = true);
313  virtual bool EnablePreview(bool enable = true);
314  virtual void EnableDebug(bool enable = true);
315 
316  // No more virtuals!
317 
318  // The Progress methods all return true if the user has cancelled;
319  // you should exit immediately if this happens (cleaning up memory
320  // is okay, but don't try to undo).
321 
322  // Pass a fraction between 0.0 and 1.0
323  bool TotalProgress(double frac);
324 
325  // Pass a fraction between 0.0 and 1.0, for the current track
326  // (when doing one track at a time)
327  bool TrackProgress(int whichTrack, double frac, const wxString & = wxEmptyString);
328 
329  // Pass a fraction between 0.0 and 1.0, for the current track group
330  // (when doing stereo groups at a time)
331  bool TrackGroupProgress(int whichGroup, double frac, const wxString & = wxEmptyString);
332 
333  int GetNumWaveTracks() { return mNumTracks; }
334 
335  int GetNumWaveGroups() { return mNumGroups; }
336 
337  // Calculates the start time and selection length in samples
338  void GetSamples(
339  const WaveTrack *track, sampleCount *start, sampleCount *len);
340 
341  // Previewing linear effect can be optimised by pre-mixing. However this
342  // should not be used for non-linear effects such as dynamic processors
343  // To allow pre-mixing before Preview, set linearEffectFlag to true.
344  void SetLinearEffectFlag(bool linearEffectFlag);
345 
346  // Most effects only need to preview a short selection. However some
347  // (such as fade effects) need to know the full selection length.
348  void SetPreviewFullSelectionFlag(bool previewDurationFlag);
349 
350  // Use this if the effect needs to know if it is previewing
351  bool IsPreviewing() { return mIsPreview; }
352 
353  // Most effects only require selected tracks to be copied for Preview.
354  // If IncludeNotSelectedPreviewTracks(true), then non-linear effects have
355  // preview copies of all wave tracks.
356  void IncludeNotSelectedPreviewTracks(bool includeNotSelected);
357 
358  // Use these two methods to copy the input tracks to mOutputTracks, if
359  // doing the processing on them, and replacing the originals only on success (and not cancel).
360  void CopyInputTracks(); // trackType = Track::Wave
361  void CopyInputTracks(int trackType);
362 
363  // For the use of analyzers, which don't need to make output wave tracks,
364  // but may need to add label tracks.
366  friend Effect;
367  AddedAnalysisTrack(Effect *pEffect, const wxString &name);
369 
370  public:
371 
373 
374  // So you can have a vector of them
376 
377  LabelTrack *get() const { return mpTrack; }
378 
379  // Call this to indicate successful completion of the analyzer.
380  void Commit();
381 
382  // Destructor undoes the addition of the analysis track if not committed.
384 
385  private:
386  Effect *mpEffect{};
387  LabelTrack *mpTrack{};
388  };
389 
390  // Set name to given value if that is not empty, else use default name
391  std::shared_ptr<AddedAnalysisTrack> AddAnalysisTrack(const wxString &name = wxString());
392 
393  // For the use of analyzers, which don't need to make output wave tracks,
394  // but may need to modify label tracks.
396  friend Effect;
398  (Effect *pEffect, const LabelTrack *pOrigTrack, const wxString &name);
400 
401  public:
402 
404 
405  // So you can have a vector of them
406  ModifiedAnalysisTrack(ModifiedAnalysisTrack &&that);
407 
408  LabelTrack *get() const { return mpTrack; }
409 
410  // Call this to indicate successful completion of the analyzer.
411  void Commit();
412 
413  // Destructor undoes the modification of the analysis track if not committed.
415 
416  private:
417  Effect *mpEffect{};
418  LabelTrack *mpTrack{};
419  std::shared_ptr<Track> mpOrigTrack{};
420  };
421 
422  // Set name to given value if that is not empty, else use default name
423  ModifiedAnalysisTrack ModifyAnalysisTrack
424  (const LabelTrack *pOrigTrack, const wxString &name = wxString());
425 
426  // If bGoodResult, replace mWaveTracks tracks in mTracks with successfully processed
427  // mOutputTracks copies, get rid of old mWaveTracks, and set mWaveTracks to mOutputTracks.
428  // Else clear and DELETE mOutputTracks copies.
429  void ReplaceProcessedTracks(const bool bGoodResult);
430 
431  // Use this to append a NEW output track.
432  Track *AddToOutputTracks(std::unique_ptr<Track> &&t);
433 
434 //
435 // protected data
436 //
437 // The Effect base class will set these variables, some or all of which
438 // may be needed by any particular subclass of Effect.
439 //
440 protected:
441 
442  ProgressDialog *mProgress; // Temporary pointer, NOT deleted in destructor.
443  double mProjectRate; // Sample rate of the project - NEW tracks should
444  // be created with this rate...
445  double mSampleRate;
447  TrackList *inputTracks() const { return mTracks; }
448  std::shared_ptr<TrackList> mOutputTracks; // used only if CopyInputTracks() is called.
449  double mT0;
450  double mT1;
451 #ifdef EXPERIMENTAL_SPECTRAL_EDITING
452  double mF0;
453  double mF1;
454 #endif
455  wxArrayString mPresetNames;
456  wxArrayString mPresetValues;
457  int mPass;
458 
459  // UI
460  wxDialog *mUIDialog;
461  wxWindow *mUIParent;
463 
464  sampleCount mSampleCnt;
465 
466  // type of the tracks on mOutputTracks
468 
469  // Used only by the base Effect class
470  //
471  private:
472  void CommonInit();
473  void CountWaveTracks();
474 
475  // Driver for client effects
476  bool ProcessTrack(int count,
477  ChannelNames map,
478  WaveTrack *left,
479  WaveTrack *right,
480  sampleCount leftStart,
481  sampleCount rightStart,
482  sampleCount len,
483  FloatBuffers &inBuffer,
484  FloatBuffers &outBuffer,
485  ArrayOf< float * > &inBufPos,
486  ArrayOf< float *> &outBufPos);
487 
488  //
489  // private data
490  //
491  // Used only by the base Effect class
492  //
493 private:
494  TrackList *mTracks; // the complete list of all tracks
495 
496  bool mIsBatch;
500 
502  double mDuration;
503  wxString mDurationFormat;
504 
506 
507  bool mUIDebug;
508 
509  std::vector<Track*> mIMap;
510  std::vector<Track*> mOMap;
511 
512  int mNumTracks; //v This is really mNumWaveTracks, per CountWaveTracks() and GetNumWaveTracks().
514 
515  // For client driver
516  EffectClientInterface *mClient;
517  size_t mNumAudioIn;
518  size_t mNumAudioOut;
519 
520  size_t mBufferSize;
521  size_t mBlockSize;
522  unsigned mNumChannels;
523 
524  wxArrayInt mGroupProcessor;
526 
527  wxCriticalSection mRealtimeSuspendLock;
529 
530  const static wxString kUserPresetIdent;
531  const static wxString kFactoryPresetIdent;
532  const static wxString kCurrentSettingsIdent;
533  const static wxString kFactoryDefaultsIdent;
534 
535  friend class EffectManager;// so it can call PromptUser in support of batch commands.
536  friend class EffectRack;
537  friend class EffectUIHost;
538  friend class EffectPresetsDialog;
539 };
540 
541 
542 // FIXME:
543 // FIXME: Remove this once all effects are using the NEW dialog
544 // FIXME:
545 
546 #define ID_EFFECT_PREVIEW ePreviewID
547 
548 // Base dialog for regular effect
549 class AUDACITY_DLL_API EffectDialog /* not final */ : public wxDialogWrapper
550 {
551 public:
552  // constructors and destructors
553  EffectDialog(wxWindow * parent,
554  const wxString & title,
555  int type = 0,
556  int flags = wxDEFAULT_DIALOG_STYLE,
557  int additionalButtons = 0);
558 
559  void Init();
560 
561  bool TransferDataToWindow() override;
562  bool TransferDataFromWindow() override;
563  bool Validate() override;
564 
565  // NEW virtuals:
566  virtual void PopulateOrExchange(ShuttleGui & S);
567  virtual void OnPreview(wxCommandEvent & evt);
568  virtual void OnOk(wxCommandEvent & evt);
569 
570 private:
571  int mType;
573 
574  DECLARE_EVENT_TABLE()
575  wxDECLARE_NO_COPY_CLASS(EffectDialog);
576 };
577 
578 //
579 class EffectUIHost final : public wxDialogWrapper,
580  public EffectUIHostInterface
581 {
582 public:
583  // constructors and destructors
584  EffectUIHost(wxWindow *parent,
585  Effect *effect,
586  EffectUIClientInterface *client);
587  virtual ~EffectUIHost();
588 
589  bool TransferDataToWindow() override;
590  bool TransferDataFromWindow() override;
591 
592  int ShowModal() override;
593 
594  bool Initialize();
595 
596 private:
597  void OnInitDialog(wxInitDialogEvent & evt);
598  void OnErase(wxEraseEvent & evt);
599  void OnPaint(wxPaintEvent & evt);
600  void OnClose(wxCloseEvent & evt);
601  void OnApply(wxCommandEvent & evt);
602  void DoCancel();
603  void OnCancel(wxCommandEvent & evt);
604  void OnHelp(wxCommandEvent & evt);
605  void OnDebug(wxCommandEvent & evt);
606  void OnMenu(wxCommandEvent & evt);
607  void OnEnable(wxCommandEvent & evt);
608  void OnPlay(wxCommandEvent & evt);
609  void OnRewind(wxCommandEvent & evt);
610  void OnFFwd(wxCommandEvent & evt);
611  void OnPlayback(wxCommandEvent & evt);
612  void OnCapture(wxCommandEvent & evt);
613  void OnUserPreset(wxCommandEvent & evt);
614  void OnFactoryPreset(wxCommandEvent & evt);
615  void OnDeletePreset(wxCommandEvent & evt);
616  void OnSaveAs(wxCommandEvent & evt);
617  void OnImport(wxCommandEvent & evt);
618  void OnExport(wxCommandEvent & evt);
619  void OnOptions(wxCommandEvent & evt);
620  void OnDefaults(wxCommandEvent & evt);
621 
622  void UpdateControls();
623  wxBitmap CreateBitmap(const char *xpm[], bool up, bool pusher);
624  void LoadUserPresets();
625 
626  void InitializeRealtime();
627  void CleanupRealtime();
628  void Resume();
629 
630 private:
632  wxWindow *mParent;
634  EffectUIClientInterface *mClient;
635 
636  wxArrayString mUserPresets;
639  bool mIsGUI;
640  bool mIsBatch;
641 
642  wxButton *mApplyBtn;
643  wxButton *mCloseBtn;
644  wxButton *mMenuBtn;
645  wxButton *mPlayBtn;
646  wxButton *mRewindBtn;
647  wxButton *mFFwdBtn;
648  wxCheckBox *mEnableCb;
649 
650  wxButton *mEnableToggleBtn;
651  wxButton *mPlayToggleBtn;
652 
653  wxBitmap mPlayBM;
654  wxBitmap mPlayDisabledBM;
655  wxBitmap mStopBM;
656  wxBitmap mStopDisabledBM;
657 
658  bool mEnabled;
659 
661  bool mPlaying;
663 
665  double mPlayPos;
666 
667  bool mDismissed{};
668  bool mNeedsResume{};
669 
670  DECLARE_EVENT_TABLE()
671 };
672 
674 {
675 public:
676  EffectPresetsDialog(wxWindow *parent, Effect *effect);
677  virtual ~EffectPresetsDialog();
678 
679  wxString GetSelected() const;
680  void SetSelected(const wxString & parms);
681 
682 private:
683  void SetPrefix(const wxString & type, const wxString & prefix);
684  void UpdateUI();
685 
686  void OnType(wxCommandEvent & evt);
687  void OnOk(wxCommandEvent & evt);
688  void OnCancel(wxCommandEvent & evt);
689 
690 private:
691  wxChoice *mType;
692  wxListBox *mPresets;
693 
694  wxArrayString mFactoryPresets;
695  wxArrayString mUserPresets;
696  wxString mSelection;
697 
698  DECLARE_EVENT_TABLE()
699 };
700 
701 // Utility functions
702 
703 inline float TrapFloat(float x, float min, float max)
704 {
705  if (x <= min)
706  return min;
707 
708  if (x >= max)
709  return max;
710 
711  return x;
712 }
713 
714 inline double TrapDouble(double x, double min, double max)
715 {
716  if (x <= min)
717  return min;
718 
719  if (x >= max)
720  return max;
721 
722  return x;
723 }
724 
725 inline long TrapLong(long x, long min, long max)
726 {
727  if (x <= min)
728  return min;
729 
730  if (x >= max)
731  return max;
732 
733  return x;
734 }
735 
736 // Helper macros for defining, reading and verifying effect parameters
737 
738 #define Param(name, type, key, def, min, max, scale) \
739  static const wxChar * KEY_ ## name = (key); \
740  static const type DEF_ ## name = (def); \
741  static const type MIN_ ## name = (min); \
742  static const type MAX_ ## name = (max); \
743  static const type SCL_ ## name = (scale);
744 
745 #define PBasic(name, type, key, def) \
746  static const wxChar * KEY_ ## name = (key); \
747  static const type DEF_ ## name = (def);
748 
749 #define PRange(name, type, key, def, min, max) \
750  PBasic(name, type, key, def); \
751  static const type MIN_ ## name = (min); \
752  static const type MAX_ ## name = (max);
753 
754 #define PScale(name, type, key, def, min, max, scale) \
755  PRange(name, type, key, def, min, max); \
756  static const type SCL_ ## name = (scale);
757 
758 #define ReadParam(type, name) \
759  type name; \
760  if (!parms.ReadAndVerify(KEY_ ## name, &name, DEF_ ## name, MIN_ ## name, MAX_ ## name)) \
761  return false;
762 
763 #define ReadBasic(type, name) \
764  type name; \
765  wxUnusedVar(MIN_ ##name); \
766  wxUnusedVar(MAX_ ##name); \
767  wxUnusedVar(SCL_ ##name); \
768  if (!parms.ReadAndVerify(KEY_ ## name, &name, DEF_ ## name)) \
769  return false;
770 
771 #define ReadAndVerifyEnum(name, list) \
772  int name; \
773  if (!parms.ReadAndVerify(KEY_ ## name, &name, DEF_ ## name, list)) \
774  return false;
775 
776 #define ReadAndVerifyInt(name) ReadParam(int, name)
777 #define ReadAndVerifyDouble(name) ReadParam(double, name)
778 #define ReadAndVerifyFloat(name) ReadParam(float, name)
779 #define ReadAndVerifyBool(name) ReadBasic(bool, name)
780 #define ReadAndVerifyString(name) ReadBasic(wxString, name)
781 
782 #endif
wxArrayInt mGroupProcessor
Definition: Effect.h:524
void OnExport(const wxString &Format)
wxArrayString mUserPresets
Definition: Effect.h:636
double mT1
Definition: Effect.h:450
A list of TrackListNode items.
Definition: Track.h:532
Definition: Effect.h:673
friend Effect
Definition: Effect.h:366
#define PROHIBITED
Definition: Audacity.h:224
int mAdditionalButtons
Definition: Effect.h:572
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:369
ProgressDialog Class.
Definition: ProgressDialog.h:56
ProgressDialog * mProgress
Definition: Effect.h:442
bool IsPreviewing()
Definition: Effect.h:351
TrackList * mTracks
Definition: Effect.h:494
int mPass
Definition: Effect.h:457
wxButton * mPlayToggleBtn
Definition: Effect.h:651
wxButton * mCloseBtn
Definition: Effect.h:643
wxString PluginID
Definition: CommandFunctors.h:16
double mPlayPos
Definition: Effect.h:665
int mOutputTracksType
Definition: Effect.h:467
EffectUIClientInterface * mClient
Definition: Effect.h:634
bool mPreviewFullSelection
Definition: Effect.h:499
wxBitmap mPlayDisabledBM
Definition: Effect.h:654
bool mIsPreview
Definition: Effect.h:505
bool mPlaying
Definition: Effect.h:661
EffectClientInterface * mClient
Definition: Effect.h:516
wxWindow * mParent
Definition: Effect.h:632
wxButton * mRewindBtn
Definition: Effect.h:646
void SetPresetParameters(const wxArrayString *Names, const wxArrayString *Values)
Definition: Effect.h:239
int mType
Definition: Effect.h:571
SelectedRegion mRegion
Definition: Effect.h:664
wxString mDurationFormat
Definition: Effect.h:503
Base class for many of the effects in Audacity.
Definition: Effect.h:62
wxListBox * mPresets
Definition: Effect.h:692
Definition: Effect.h:395
wxButton * mApplyBtn
Definition: Effect.h:642
New (Jun-2006) base class for effects dialogs. Likely to get greater use in future.
Definition: Effect.h:549
AudacityProject * mProject
Definition: Effect.h:631
bool mSupportsRealtime
Definition: Effect.h:638
Definition: wxPanelWrapper.h:19
size_t mBufferSize
Definition: Effect.h:520
double mSampleRate
Definition: Effect.h:445
bool mIsSelection
Definition: Effect.h:501
wxArrayString mPresetNames
Definition: Effect.h:455
TrackList * inputTracks() const
Definition: Effect.h:447
size_t mNumAudioIn
Definition: Effect.h:517
wxCriticalSection mRealtimeSuspendLock
Definition: Effect.h:527
Used to create a WaveTrack, or a LabelTrack.. Implementation of the functions of this class are dispe...
Definition: Track.h:676
double mF0
Definition: Effect.h:452
bool mIsBatch
Definition: Effect.h:640
size_t mNumAudioOut
Definition: Effect.h:518
wxBitmap mStopBM
Definition: Effect.h:655
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:114
wxArrayString mFactoryPresets
Definition: Effect.h:694
Definition: Effect.h:579
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:161
std::vector< Track * > mOMap
Definition: Effect.h:510
Defines a selected portion of a project.
Definition: SelectedRegion.h:37
wxButton * mMenuBtn
Definition: Effect.h:644
friend Effect
Definition: Effect.h:396
static const wxString kUserPresetIdent
Definition: Effect.h:530
size_t mBlockSize
Definition: Effect.h:521
int mNumTracks
Definition: Effect.h:512
A Track that contains audio waveform data.
Definition: WaveTrack.h:76
Fundamental data object of Audacity, placed in the TrackPanel. Classes derived form it include the Wa...
Definition: Track.h:85
wxChoice * mType
Definition: Effect.h:691
bool mIsLinearEffect
Definition: Effect.h:497
wxString mSelection
Definition: Effect.h:696
int mRealtimeSuspendCount
Definition: Effect.h:528
std::vector< Track * > mIMap
Definition: Effect.h:509
EffectManager is the class that handles effects and effect categories.
Definition: EffectManager.h:45
bool mCapturing
Definition: Effect.h:662
int min(int a, int b)
Definition: CompareAudioCommand.cpp:80
void OnImport()
bool mPreviewWithNotSelected
Definition: Effect.h:498
Definition: Effect.h:365
void OnSaveAs()
long TrapLong(long x, long min, long max)
Definition: Effect.h:725
wxWindow * mUIParent
Definition: Effect.h:461
double TrapDouble(double x, double min, double max)
Definition: Effect.h:714
void OnClose()
double mProjectRate
Definition: Effect.h:443
unsigned mNumChannels
Definition: Effect.h:522
TrackFactory * mFactory
Definition: Effect.h:446
wxDialog * mUIDialog
Definition: Effect.h:460
bool mUIDebug
Definition: Effect.h:507
int mCurrentProcessor
Definition: Effect.h:525
bool mInitialized
Definition: Effect.h:637
const wxChar * name
Definition: Distortion.cpp:93
wxButton * mFFwdBtn
Definition: Effect.h:647
int GetNumWaveTracks()
Definition: Effect.h:333
wxButton * mEnableToggleBtn
Definition: Effect.h:650
bool mDisableTransport
Definition: Effect.h:660
wxArrayString mUserPresets
Definition: Effect.h:695
Definition: MemoryX.h:439
float TrapFloat(float x, float min, float max)
Definition: Effect.h:703
static const wxString kFactoryPresetIdent
Definition: Effect.h:531
int GetNumWaveGroups()
Definition: Effect.h:335
wxButton * mPlayBtn
Definition: Effect.h:645
bool mIsGUI
Definition: Effect.h:639
static const wxString kCurrentSettingsIdent
Definition: Effect.h:532
wxBitmap mPlayBM
Definition: Effect.h:653
double mDuration
Definition: Effect.h:502
sampleCount mSampleCnt
Definition: Effect.h:464
wxArrayString mPresetValues
Definition: Effect.h:456
double mF1
Definition: Effect.h:453
bool mIsBatch
Definition: Effect.h:496
Effect * mEffect
Definition: Effect.h:633
wxBitmap mStopDisabledBM
Definition: Effect.h:656
bool mEnabled
Definition: Effect.h:658
int mUIResultID
Definition: Effect.h:462
std::shared_ptr< TrackList > mOutputTracks
Definition: Effect.h:448
virtual bool CheckWhetherSkipEffect()
Definition: Effect.h:287
wxCheckBox * mEnableCb
Definition: Effect.h:648
double mT0
Definition: Effect.h:449
int mNumGroups
Definition: Effect.h:513
static const wxString kFactoryDefaultsIdent
Definition: Effect.h:533