Audacity  3.0.3
NoiseReduction.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  NoiseReduction.cpp
6 
7  Dominic Mazzoni
8 
9  detailed rewriting by
10  Paul Licameli
11 
12 *******************************************************************//****************************************************************/
40 #include "NoiseReduction.h"
41 
42 #include "LoadEffects.h"
43 #include "EffectManager.h"
44 #include "EffectUI.h"
45 
46 #include "../ShuttleGui.h"
47 #include "../widgets/HelpSystem.h"
48 #include "../Prefs.h"
49 #include "../RealFFTf.h"
50 
51 #include "../WaveTrack.h"
52 #include "../widgets/AudacityMessageBox.h"
53 #include "../widgets/valnum.h"
54 
55 #include <algorithm>
56 #include <vector>
57 #include <math.h>
58 
59 #if defined(__WXMSW__) && !defined(__CYGWIN__)
60 #include <float.h>
61 #define finite(x) _finite(x)
62 #endif
63 
64 #include <wx/button.h>
65 #include <wx/choice.h>
66 #include <wx/dialog.h>
67 #include <wx/radiobut.h>
68 #include <wx/slider.h>
69 #include <wx/valtext.h>
70 #include <wx/textctrl.h>
71 #include <wx/sizer.h>
72 
73 // SPECTRAL_SELECTION not to affect this effect for now, as there might be no indication that it does.
74 // [Discussed and agreed for v2.1 by Steve, Paul, Bill].
75 #undef EXPERIMENTAL_SPECTRAL_EDITING
76 
77 typedef std::vector<float> FloatVector;
78 
79 // Define both of these to make the radio button three-way
80 #define RESIDUE_CHOICE
81 //#define ISOLATE_CHOICE
82 
83 // Define for Attack and release controls.
84 // #define ATTACK_AND_RELEASE
85 
86 // Define to expose other advanced, experimental dialog controls
87 //#define ADVANCED_SETTINGS
88 
89 // Define to make the old statistical methods an available choice
90 //#define OLD_METHOD_AVAILABLE
91 
92 namespace {
93 
98 
101 };
102 
106  // Experimental only, don't need translations
107  { XO("Median") },
108  { XO("Second greatest") },
109  { XO("Old") },
110 };
111 
112 // magic number used only in the old statistics
113 // and the old discrimination
114 const float minSignalTime = 0.05f;
115 
117  WT_RECTANGULAR_HANN = 0, // 2.0.6 behavior, requires 1/2 step
118  WT_HANN_RECTANGULAR, // requires 1/2 step
119  WT_HANN_HANN, // requires 1/4 step
120  WT_BLACKMAN_HANN, // requires 1/4 step
121  WT_HAMMING_RECTANGULAR, // requires 1/2 step
122  WT_HAMMING_HANN, // requires 1/4 step
123  WT_HAMMING_INV_HAMMING, // requires 1/2 step
124 
127 };
128 
129 const struct WindowTypesInfo {
131  unsigned minSteps;
132  double inCoefficients[3];
133  double outCoefficients[3];
136  // In all of these cases (but the last), the constant term of the product of windows
137  // is the product of the windows' two constant terms,
138  // plus one half the product of the first cosine coefficients.
139 
140  // Experimental only, don't need translations
141  { XO("none, Hann (2.0.6 behavior)"), 2, { 1, 0, 0 }, { 0.5, -0.5, 0 }, 0.5 },
142  { XO("Hann, none"), 2, { 0.5, -0.5, 0 }, { 1, 0, 0 }, 0.5 },
143  { XO("Hann, Hann (default)"), 4, { 0.5, -0.5, 0 }, { 0.5, -0.5, 0 }, 0.375 },
144  { XO("Blackman, Hann"), 4, { 0.42, -0.5, 0.08 }, { 0.5, -0.5, 0 }, 0.335 },
145  { XO("Hamming, none"), 2, { 0.54, -0.46, 0.0 }, { 1, 0, 0 }, 0.54 },
146  { XO("Hamming, Hann"), 4, { 0.54, -0.46, 0.0 }, { 0.5, -0.5, 0 }, 0.385 },
147  { XO("Hamming, Reciprocal Hamming"), 2, { 0.54, -0.46, 0.0 }, { 1, 0, 0 }, 1.0 }, // output window is special
148 };
149 
150 enum {
151  DEFAULT_WINDOW_SIZE_CHOICE = 8, // corresponds to 2048
152  DEFAULT_STEPS_PER_WINDOW_CHOICE = 1 // corresponds to 4, minimum for WT_HANN_HANN
153 };
154 
159 };
160 
161 } // namespace
162 
163 //----------------------------------------------------------------------------
164 // EffectNoiseReduction::Statistics
165 //----------------------------------------------------------------------------
166 
168 {
169 public:
170  Statistics(size_t spectrumSize, double rate, int windowTypes)
171  : mRate(rate)
172  , mWindowSize((spectrumSize - 1) * 2)
173  , mWindowTypes(windowTypes)
174  , mTotalWindows(0)
175  , mTrackWindows(0)
176  , mSums(spectrumSize)
177  , mMeans(spectrumSize)
178 #ifdef OLD_METHOD_AVAILABLE
179  , mNoiseThreshold(spectrumSize)
180 #endif
181  {}
182 
183  // Noise profile statistics follow
184 
185  double mRate; // Rate of profile track(s) -- processed tracks must match
186  size_t mWindowSize;
188 
193 
194 #ifdef OLD_METHOD_AVAILABLE
195  // Old statistics:
196  FloatVector mNoiseThreshold;
197 #endif
198 };
199 
200 //----------------------------------------------------------------------------
201 // EffectNoiseReduction::Settings
202 //----------------------------------------------------------------------------
203 
204 // This object is the memory of the effect between uses
205 // (other than noise profile statistics)
207 {
208 public:
209  Settings();
211 
212  bool PromptUser(EffectNoiseReduction *effect,
213  wxWindow &parent, bool bHasProfile, bool bAllowTwiddleSettings);
214  bool PrefsIO(bool read);
215  bool Validate(EffectNoiseReduction *effect) const;
216 
217  size_t WindowSize() const { return 1u << (3 + mWindowSizeChoice); }
218  unsigned StepsPerWindow() const { return 1u << (1 + mStepsPerWindowChoice); }
219 
221 
222  // Stored in preferences:
223 
224  // Basic:
225  double mNewSensitivity; // - log10 of a probability... yeah.
226  double mFreqSmoothingBands; // really an integer
227  double mNoiseGain; // in dB, positive
228  double mAttackTime; // in secs
229  double mReleaseTime; // in secs
230 
231  // Advanced:
232  double mOldSensitivity; // in dB, plus or minus
233 
234  // Basic:
236 
237  // Advanced:
241  int mMethod;
242 };
243 
245  : mDoProfile(true)
246 {
247  PrefsIO(true);
248 }
249 
250 //----------------------------------------------------------------------------
251 // EffectNoiseReduction::Worker
252 //----------------------------------------------------------------------------
253 
254 // This object holds information needed only during effect calculation
256 {
257 public:
260 
261  Worker(const Settings &settings, double sampleRate
262 #ifdef EXPERIMENTAL_SPECTRAL_EDITING
263  , double f0, double f1
264 #endif
265  );
266  ~Worker();
267 
268  bool Process(EffectNoiseReduction &effect,
269  Statistics &statistics, WaveTrackFactory &factory,
270  TrackList &tracks, double mT0, double mT1);
271 
272 private:
273  bool ProcessOne(EffectNoiseReduction &effect,
274  Statistics &statistics,
276  int count, WaveTrack *track,
277  sampleCount start, sampleCount len);
278 
279  void StartNewTrack();
280  void ProcessSamples(Statistics &statistics,
281  WaveTrack *outputTrack, size_t len, float *buffer);
282  void FillFirstHistoryWindow();
283  void ApplyFreqSmoothing(FloatVector &gains);
284  void GatherStatistics(Statistics &statistics);
285  inline bool Classify(const Statistics &statistics, int band);
286  void ReduceNoise(const Statistics &statistics, WaveTrack *outputTrack);
287  void RotateHistoryWindows();
288  void FinishTrackStatistics(Statistics &statistics);
289  void FinishTrack(Statistics &statistics, WaveTrack *outputTrack);
290 
291 private:
292 
293  const bool mDoProfile;
294 
295  const double mSampleRate;
296 
297  const size_t mWindowSize;
298  // These have that size:
303  // These have that size, or 0:
306 
307  const size_t mSpectrumSize;
309  const size_t mFreqSmoothingBins;
310  // When spectral selection limits the affected band:
311  int mBinLow; // inclusive lower bound
312  int mBinHigh; // exclusive upper bound
313 
315  const unsigned mStepsPerWindow;
316  const size_t mStepSize;
317  const int mMethod;
318  const double mNewSensitivity;
319 
320 
324 
329 
331  unsigned mCenter;
332  unsigned mHistoryLen;
333 
334  struct Record
335  {
336  Record(size_t spectrumSize)
337  : mSpectrums(spectrumSize)
338  , mGains(spectrumSize)
339  , mRealFFTs(spectrumSize - 1)
340  , mImagFFTs(spectrumSize - 1)
341  {
342  }
343 
348  };
349  std::vector<std::unique_ptr<Record>> mQueue;
350 };
351 
352 /****************************************************************//*****************************************************************/
358 
359 //----------------------------------------------------------------------------
360 // EffectNoiseReduction::Dialog
361 //----------------------------------------------------------------------------
362 
364 {
365 public:
366  // constructors and destructors
367  Dialog
368  (EffectNoiseReduction *effect,
370  wxWindow *parent, bool bHasProfile,
371  bool bAllowTwiddleSettings);
372 
373  void PopulateOrExchange(ShuttleGui & S) override;
374  bool TransferDataToWindow() override;
375  bool TransferDataFromWindow() override;
376 
377  const Settings &GetTempSettings() const
378  { return mTempSettings; }
379 
380 private:
382 
383 #ifdef ADVANCED_SETTINGS
384  void EnableDisableSensitivityControls();
385 #endif
386 
387  // handlers
388  void OnGetProfile( wxCommandEvent &event );
389  void OnNoiseReductionChoice( wxCommandEvent &event );
390 #ifdef ADVANCED_SETTINGS
391  void OnMethodChoice(wxCommandEvent &);
392 #endif
393  void OnPreview(wxCommandEvent &event) override;
394  void OnReduceNoise( wxCommandEvent &event );
395  void OnCancel( wxCommandEvent &event );
396  void OnHelp( wxCommandEvent &event );
397 
398  void OnText(wxCommandEvent &event);
399  void OnSlider(wxCommandEvent &event);
400 
401  // data members
402 
406 
409 
410 
411  wxRadioButton *mKeepSignal;
412 #ifdef ISOLATE_CHOICE
413  wxRadioButton *mKeepNoise;
414 #endif
415 #ifdef RESIDUE_CHOICE
416  wxRadioButton *mResidue;
417 #endif
418 
419 private:
420  DECLARE_EVENT_TABLE()
421 };
422 
424 { XO("Noise Reduction") };
425 
427 
429 : mSettings(std::make_unique<EffectNoiseReduction::Settings>())
430 {
431  Init();
432 }
433 
435 {
436 }
437 
438 // ComponentInterface implementation
439 
441 {
442  return Symbol;
443 }
444 
446 {
447  return XO("Removes background noise such as fans, tape noise, or hums");
448 }
449 
450 // EffectDefinitionInterface implementation
451 
453 {
454  return EffectTypeProcess;
455 }
456 
458 {
459  return true;
460 }
461 
463 {
464  return false;
465 }
466 
468  wxWindow &parent, const EffectDialogFactory &, bool forceModal)
469 {
470  // to do: use forceModal correctly
471 
472  // Doesn't use the factory but substitutes its own dialog
473 
474  // We may want to twiddle the levels if we are setting
475  // from an automation dialog
476  return mSettings->PromptUser(this, parent,
477  bool(mStatistics), forceModal);
478 }
479 
481 (EffectNoiseReduction *effect, wxWindow &parent,
482  bool bHasProfile, bool bAllowTwiddleSettings)
483 {
485  (effect, this, &parent, bHasProfile, bAllowTwiddleSettings);
486 
487  dlog.CentreOnParent();
488  dlog.ShowModal();
489 
490  if (dlog.GetReturnCode() == 0)
491  return false;
492 
493  *this = dlog.GetTempSettings();
494  mDoProfile = (dlog.GetReturnCode() == 1);
495 
496  return PrefsIO(false);
497 }
498 
499 namespace {
500  template <typename StructureType, typename FieldType>
502  typedef FieldType (StructureType::*MemberPointer);
503 
505  const wxChar *name;
506  FieldType defaultValue;
507  };
508 
509  template <typename StructureType, typename FieldType>
510  void readPrefs(
511  StructureType *structure, const wxString &prefix,
512  const PrefsTableEntry<StructureType, FieldType> *fields, int numFields)
513  {
514  for (int ii = 0; ii < numFields; ++ii) {
515  const PrefsTableEntry<StructureType, FieldType> &entry = fields[ii];
516  gPrefs->Read(prefix + entry.name, &(structure->*(entry.field)),
517  entry.defaultValue);
518  }
519  }
520 
521  template <typename StructureType, typename FieldType>
523  StructureType *structure, const wxString &prefix,
524  const PrefsTableEntry<StructureType, FieldType> *fields, int numFields)
525  {
526  for (int ii = 0; ii < numFields; ++ii) {
527  const PrefsTableEntry<StructureType, FieldType> &entry = fields[ii];
528  gPrefs->Write(prefix + entry.name, structure->*(entry.field));
529  }
530  }
531 }
532 
534 {
535  static const double DEFAULT_OLD_SENSITIVITY = 0.0;
536 
537  static const PrefsTableEntry<Settings, double> doubleTable[] = {
538  { &Settings::mNewSensitivity, wxT("Sensitivity"), 6.0 },
539  { &Settings::mNoiseGain, wxT("Gain"), 12.0 },
540  { &Settings::mAttackTime, wxT("AttackTime"), 0.02 },
541  { &Settings::mReleaseTime, wxT("ReleaseTime"), 0.10 },
542  { &Settings::mFreqSmoothingBands, wxT("FreqSmoothing"), 3.0 },
543 
544  // Advanced settings
545  { &Settings::mOldSensitivity, wxT("OldSensitivity"), DEFAULT_OLD_SENSITIVITY },
546  };
547  static int doubleTableSize = sizeof(doubleTable) / sizeof(doubleTable[0]);
548 
549  static const PrefsTableEntry<Settings, int> intTable[] = {
550  { &Settings::mNoiseReductionChoice, wxT("ReductionChoice"), NRC_REDUCE_NOISE },
551 
552  // Advanced settings
553  { &Settings::mWindowTypes, wxT("WindowTypes"), WT_DEFAULT_WINDOW_TYPES },
556  { &Settings::mMethod, wxT("Method"), DM_DEFAULT_METHOD },
557  };
558  static int intTableSize = sizeof(intTable) / sizeof(intTable[0]);
559 
560  static const wxString prefix(wxT("/Effects/NoiseReduction/"));
561 
562  if (read) {
563  readPrefs(this, prefix, doubleTable, doubleTableSize);
564  readPrefs(this, prefix, intTable, intTableSize);
565 
566  // Ignore preferences for unavailable options.
567 #ifndef RESIDUE_CHOICE
568  if (mNoiseReductionChoice == NRC_LEAVE_RESIDUE)
569  mNoiseReductionChoice = NRC_ISOLATE_NOISE;
570 #endif
571 
572 #ifndef ADVANCED_SETTINGS
573  // Initialize all hidden advanced settings to defaults.
574  mWindowTypes = WT_DEFAULT_WINDOW_TYPES;
575  mWindowSizeChoice = DEFAULT_WINDOW_SIZE_CHOICE;
576  mStepsPerWindowChoice = DEFAULT_STEPS_PER_WINDOW_CHOICE;
577  mMethod = DM_DEFAULT_METHOD;
578  mOldSensitivity = DEFAULT_OLD_SENSITIVITY;
579 #endif
580 
581 #ifndef OLD_METHOD_AVAILABLE
582  if (mMethod == DM_OLD_METHOD)
583  mMethod = DM_DEFAULT_METHOD;
584 #endif
585 
586  return true;
587  }
588  else {
589  writePrefs(this, prefix, doubleTable, doubleTableSize);
590  writePrefs(this, prefix, intTable, intTableSize);
591  return gPrefs->Flush();
592  }
593 }
594 
596 {
597  if (StepsPerWindow() < windowTypesInfo[mWindowTypes].minSteps) {
598  effect->Effect::MessageBox(
599  XO("Steps per block are too few for the window types.") );
600  return false;
601  }
602 
603  if (StepsPerWindow() > WindowSize()) {
604  effect->Effect::MessageBox(
605  XO("Steps per block cannot exceed the window size.") );
606  return false;
607  }
608 
609  if (mMethod == DM_MEDIAN && StepsPerWindow() > 4) {
610  effect->Effect::MessageBox(
611  XO(
612 "Median method is not implemented for more than four steps per window.") );
613  return false;
614  }
615 
616  return true;
617 }
618 
620 {
621  // This same code will either reduce noise or profile it
622 
623  this->CopyInputTracks(); // Set up mOutputTracks.
624 
625  auto track = * (mOutputTracks->Selected< const WaveTrack >()).begin();
626  if (!track)
627  return false;
628 
629  // Initialize statistics if gathering them, or check for mismatched (advanced)
630  // settings if reducing noise.
631  if (mSettings->mDoProfile) {
632  size_t spectrumSize = 1 + mSettings->WindowSize() / 2;
633  mStatistics = std::make_unique<Statistics>
634  (spectrumSize, track->GetRate(), mSettings->mWindowTypes);
635  }
636  else if (mStatistics->mWindowSize != mSettings->WindowSize()) {
637  // possible only with advanced settings
639  XO("You must specify the same window size for steps 1 and 2.") );
640  return false;
641  }
642  else if (mStatistics->mWindowTypes != mSettings->mWindowTypes) {
643  // A warning only
645  XO("Warning: window types are not the same as for profiling.") );
646  }
647 
648  Worker worker(*mSettings, mStatistics->mRate
649 #ifdef EXPERIMENTAL_SPECTRAL_EDITING
650  , mF0, mF1
651 #endif
652  );
653  bool bGoodResult = worker.Process
654  (*this, *mStatistics, *mFactory, *mOutputTracks, mT0, mT1);
655  if (mSettings->mDoProfile) {
656  if (bGoodResult)
657  mSettings->mDoProfile = false; // So that "repeat last effect" will reduce noise
658  else
659  mStatistics.reset(); // So that profiling must be done again before noise reduction
660  }
661  this->ReplaceProcessedTracks(bGoodResult);
662  return bGoodResult;
663 }
664 
666 {
667 }
668 
671  TrackList &tracks, double inT0, double inT1)
672 {
673  int count = 0;
674  for ( auto track : tracks.Selected< WaveTrack >() ) {
675  if (track->GetRate() != mSampleRate) {
676  if (mDoProfile)
677  effect.Effect::MessageBox(
678  XO("All noise profile data must have the same sample rate.") );
679  else
680  effect.Effect::MessageBox(
681  XO(
682 "The sample rate of the noise profile must match that of the sound to be processed.") );
683  return false;
684  }
685 
686  double trackStart = track->GetStartTime();
687  double trackEnd = track->GetEndTime();
688  double t0 = std::max(trackStart, inT0);
689  double t1 = std::min(trackEnd, inT1);
690 
691  if (t1 > t0) {
692  auto start = track->TimeToLongSamples(t0);
693  auto end = track->TimeToLongSamples(t1);
694  auto len = end - start;
695 
696  if (!ProcessOne(effect, statistics, factory,
697  count, track, start, len))
698  return false;
699  }
700  ++count;
701  }
702 
703  if (mDoProfile) {
704  if (statistics.mTotalWindows == 0) {
705  effect.Effect::MessageBox(
706  XO("Selected noise profile is too short.") );
707  return false;
708  }
709  }
710 
711  return true;
712 }
713 
715 {
716  // Given an array of gain mutipliers, average them
717  // GEOMETRICALLY. Don't multiply and take nth root --
718  // that may quickly cause underflows. Instead, average the logs.
719 
720  if (mFreqSmoothingBins == 0)
721  return;
722 
723  {
724  float *pScratch = &mFreqSmoothingScratch[0];
725  std::fill(pScratch, pScratch + mSpectrumSize, 0.0f);
726  }
727 
728  for (size_t ii = 0; ii < mSpectrumSize; ++ii)
729  gains[ii] = log(gains[ii]);
730 
731  // ii must be signed
732  for (int ii = 0; ii < (int)mSpectrumSize; ++ii) {
733  const int j0 = std::max(0, ii - (int)mFreqSmoothingBins);
734  const int j1 = std::min(mSpectrumSize - 1, ii + mFreqSmoothingBins);
735  for(int jj = j0; jj <= j1; ++jj) {
736  mFreqSmoothingScratch[ii] += gains[jj];
737  }
738  mFreqSmoothingScratch[ii] /= (j1 - j0 + 1);
739  }
740 
741  for (size_t ii = 0; ii < mSpectrumSize; ++ii)
742  gains[ii] = exp(mFreqSmoothingScratch[ii]);
743 }
744 
746 (const Settings &settings, double sampleRate
747 #ifdef EXPERIMENTAL_SPECTRAL_EDITING
748 , double f0, double f1
749 #endif
750 )
751 : mDoProfile(settings.mDoProfile)
752 
753 , mSampleRate(sampleRate)
754 
755 , mWindowSize(settings.WindowSize())
756 , hFFT(GetFFT(mWindowSize))
757 , mFFTBuffer(mWindowSize)
758 , mInWaveBuffer(mWindowSize)
759 , mOutOverlapBuffer(mWindowSize)
760 , mInWindow()
761 , mOutWindow()
762 
763 , mSpectrumSize(1 + mWindowSize / 2)
764 , mFreqSmoothingScratch(mSpectrumSize)
765 , mFreqSmoothingBins((int)(settings.mFreqSmoothingBands))
766 , mBinLow(0)
767 , mBinHigh(mSpectrumSize)
768 
769 , mNoiseReductionChoice(settings.mNoiseReductionChoice)
770 , mStepsPerWindow(settings.StepsPerWindow())
771 , mStepSize(mWindowSize / mStepsPerWindow)
772 , mMethod(settings.mMethod)
773 
774 // Sensitivity setting is a base 10 log, turn it into a natural log
775 , mNewSensitivity(settings.mNewSensitivity * log(10.0))
776 
777 , mInSampleCount(0)
778 , mOutStepCount(0)
779 , mInWavePos(0)
780 {
781 #ifdef EXPERIMENTAL_SPECTRAL_EDITING
782  {
783  const double bin = mSampleRate / mWindowSize;
784  if (f0 >= 0.0 )
785  mBinLow = floor(f0 / bin);
786  if (f1 >= 0.0)
787  mBinHigh = ceil(f1 / bin);
788  }
789 #endif
790 
791  const double noiseGain = -settings.mNoiseGain;
792  const unsigned nAttackBlocks = 1 + (int)(settings.mAttackTime * sampleRate / mStepSize);
793  const unsigned nReleaseBlocks = 1 + (int)(settings.mReleaseTime * sampleRate / mStepSize);
794  // Applies to amplitudes, divide by 20:
795  mNoiseAttenFactor = DB_TO_LINEAR(noiseGain);
796  // Apply to gain factors which apply to amplitudes, divide by 20:
797  mOneBlockAttack = DB_TO_LINEAR(noiseGain / nAttackBlocks);
798  mOneBlockRelease = DB_TO_LINEAR(noiseGain / nReleaseBlocks);
799  // Applies to power, divide by 10:
800  mOldSensitivityFactor = pow(10.0, settings.mOldSensitivity / 10.0);
801 
803  ? std::max(2, (int)(minSignalTime * sampleRate / mStepSize))
804  : 1 + mStepsPerWindow;
805 
807  wxASSERT(mCenter >= 1); // release depends on this assumption
808 
809  if (mDoProfile)
810 #ifdef OLD_METHOD_AVAILABLE
812 #else
813  mHistoryLen = 1;
814 #endif
815  else {
816  // Allow long enough queue for sufficient inspection of the middle
817  // and for attack processing
818  // See ReduceNoise()
819  mHistoryLen = std::max(mNWindowsToExamine, mCenter + nAttackBlocks);
820  }
821 
822  mQueue.resize(mHistoryLen);
823  for (unsigned ii = 0; ii < mHistoryLen; ++ii)
824  mQueue[ii] = std::make_unique<Record>(mSpectrumSize);
825 
826  // Create windows
827 
828  const double constantTerm =
830 
831  // One or the other window must by multiplied by this to correct for
832  // overlap. Must scale down as steps get smaller, and overlaps larger.
833  const double multiplier = 1.0 / (constantTerm * mStepsPerWindow);
834 
835  // Create the analysis window
836  switch (settings.mWindowTypes) {
837  case WT_RECTANGULAR_HANN:
838  break;
839  default:
840  {
841  const bool rectangularOut =
844  const double m =
845  rectangularOut ? multiplier : 1;
846  const double *const coefficients =
848  const double c0 = coefficients[0];
849  const double c1 = coefficients[1];
850  const double c2 = coefficients[2];
851  mInWindow.resize(mWindowSize);
852  for (size_t ii = 0; ii < mWindowSize; ++ii)
853  mInWindow[ii] = m *
854  (c0 + c1 * cos((2.0*M_PI*ii) / mWindowSize)
855  + c2 * cos((4.0*M_PI*ii) / mWindowSize));
856  }
857  break;
858  }
859 
860  if (!mDoProfile) {
861  // Create the synthesis window
862  switch (settings.mWindowTypes) {
863  case WT_HANN_RECTANGULAR:
865  break;
867  {
868  mOutWindow.resize(mWindowSize);
869  for (size_t ii = 0; ii < mWindowSize; ++ii)
870  mOutWindow[ii] = multiplier / mInWindow[ii];
871  }
872  break;
873  default:
874  {
875  const double *const coefficients =
877  const double c0 = coefficients[0];
878  const double c1 = coefficients[1];
879  const double c2 = coefficients[2];
880  mOutWindow.resize(mWindowSize);
881  for (size_t ii = 0; ii < mWindowSize; ++ii)
882  mOutWindow[ii] = multiplier *
883  (c0 + c1 * cos((2.0 * M_PI * ii) / mWindowSize)
884  + c2 * cos((4.0 * M_PI * ii) / mWindowSize));
885  }
886  break;
887  }
888  }
889 }
890 
892 {
893  float *pFill;
894  for(unsigned ii = 0; ii < mHistoryLen; ++ii) {
895  Record &record = *mQueue[ii];
896 
897  pFill = &record.mSpectrums[0];
898  std::fill(pFill, pFill + mSpectrumSize, 0.0f);
899 
900  pFill = &record.mRealFFTs[0];
901  std::fill(pFill, pFill + mSpectrumSize - 1, 0.0f);
902 
903  pFill = &record.mImagFFTs[0];
904  std::fill(pFill, pFill + mSpectrumSize - 1, 0.0f);
905 
906  pFill = &record.mGains[0];
907  std::fill(pFill, pFill + mSpectrumSize, mNoiseAttenFactor);
908  }
909 
910  pFill = &mOutOverlapBuffer[0];
911  std::fill(pFill, pFill + mWindowSize, 0.0f);
912 
913  pFill = &mInWaveBuffer[0];
914  std::fill(pFill, pFill + mWindowSize, 0.0f);
915 
916  if (mDoProfile)
917  {
918  // We do not want leading zero padded windows
919  mInWavePos = 0;
920  mOutStepCount = -(int)(mHistoryLen - 1);
921  }
922  else
923  {
924  // So that the queue gets primed with some windows,
925  // zero-padded in front, the first having mStepSize
926  // samples of wave data:
927  mInWavePos = mWindowSize - mStepSize;
928  // This starts negative, to count up until the queue fills:
929  mOutStepCount = -(int)(mHistoryLen - 1)
930  // ... and then must pass over the padded windows,
931  // before the first full window:
932  - (int)(mStepsPerWindow - 1);
933  }
934 
935  mInSampleCount = 0;
936 }
937 
939 (Statistics &statistics, WaveTrack *outputTrack,
940  size_t len, float *buffer)
941 {
942  while (len && mOutStepCount * mStepSize < mInSampleCount) {
943  auto avail = std::min(len, mWindowSize - mInWavePos);
944  memmove(&mInWaveBuffer[mInWavePos], buffer, avail * sizeof(float));
945  buffer += avail;
946  len -= avail;
947  mInWavePos += avail;
948 
949  if (mInWavePos == (int)mWindowSize) {
950  FillFirstHistoryWindow();
951  if (mDoProfile)
952  GatherStatistics(statistics);
953  else
954  ReduceNoise(statistics, outputTrack);
955  ++mOutStepCount;
956  RotateHistoryWindows();
957 
958  // Rotate for overlap-add
959  memmove(&mInWaveBuffer[0], &mInWaveBuffer[mStepSize],
960  (mWindowSize - mStepSize) * sizeof(float));
961  mInWavePos -= mStepSize;
962  }
963  }
964 }
965 
967 {
968  // Transform samples to frequency domain, windowed as needed
969  if (mInWindow.size() > 0)
970  for (size_t ii = 0; ii < mWindowSize; ++ii)
971  mFFTBuffer[ii] = mInWaveBuffer[ii] * mInWindow[ii];
972  else
973  memmove(&mFFTBuffer[0], &mInWaveBuffer[0], mWindowSize * sizeof(float));
974  RealFFTf(&mFFTBuffer[0], hFFT.get());
975 
976  Record &record = *mQueue[0];
977 
978  // Store real and imaginary parts for later inverse FFT, and compute
979  // power
980  {
981  float *pReal = &record.mRealFFTs[1];
982  float *pImag = &record.mImagFFTs[1];
983  float *pPower = &record.mSpectrums[1];
984  int *pBitReversed = &hFFT->BitReversed[1];
985  const auto last = mSpectrumSize - 1;
986  for (unsigned int ii = 1; ii < last; ++ii) {
987  const int kk = *pBitReversed++;
988  const float realPart = *pReal++ = mFFTBuffer[kk];
989  const float imagPart = *pImag++ = mFFTBuffer[kk + 1];
990  *pPower++ = realPart * realPart + imagPart * imagPart;
991  }
992  // DC and Fs/2 bins need to be handled specially
993  const float dc = mFFTBuffer[0];
994  record.mRealFFTs[0] = dc;
995  record.mSpectrums[0] = dc*dc;
996 
997  const float nyquist = mFFTBuffer[1];
998  record.mImagFFTs[0] = nyquist; // For Fs/2, not really imaginary
999  record.mSpectrums[last] = nyquist * nyquist;
1000  }
1001 
1002  if (mNoiseReductionChoice != NRC_ISOLATE_NOISE)
1003  {
1004  // Default all gains to the reduction factor,
1005  // until we decide to raise some of them later
1006  float *pGain = &record.mGains[0];
1007  std::fill(pGain, pGain + mSpectrumSize, mNoiseAttenFactor);
1008  }
1009 }
1010 
1012 {
1013  std::rotate(mQueue.begin(), mQueue.end() - 1, mQueue.end());
1014 }
1015 
1017 {
1018  const int windows = statistics.mTrackWindows;
1019  const int multiplier = statistics.mTotalWindows;
1020  const int denom = windows + multiplier;
1021 
1022  // Combine averages in case of multiple profile tracks.
1023  if (windows)
1024  for (int ii = 0, nn = statistics.mMeans.size(); ii < nn; ++ii) {
1025  float &mean = statistics.mMeans[ii];
1026  float &sum = statistics.mSums[ii];
1027  mean = (mean * multiplier + sum) / denom;
1028  // Reset for next track
1029  sum = 0;
1030  }
1031 
1032  // Reset for next track
1033  statistics.mTrackWindows = 0;
1034  statistics.mTotalWindows = denom;
1035 }
1036 
1038 (Statistics &statistics, WaveTrack *outputTrack)
1039 {
1040  // Keep flushing empty input buffers through the history
1041  // windows until we've output exactly as many samples as
1042  // were input.
1043  // Well, not exactly, but not more than one step-size of extra samples
1044  // at the end.
1045  // We'll DELETE them later in ProcessOne.
1046 
1047  FloatVector empty(mStepSize);
1048 
1049  while (mOutStepCount * mStepSize < mInSampleCount) {
1050  ProcessSamples(statistics, outputTrack, mStepSize, &empty[0]);
1051  }
1052 }
1053 
1055 {
1056  ++statistics.mTrackWindows;
1057 
1058  {
1059  // NEW statistics
1060  const float *pPower = &mQueue[0]->mSpectrums[0];
1061  float *pSum = &statistics.mSums[0];
1062  for (size_t jj = 0; jj < mSpectrumSize; ++jj) {
1063  *pSum++ += *pPower++;
1064  }
1065  }
1066 
1067 #ifdef OLD_METHOD_AVAILABLE
1068  // The noise threshold for each frequency is the maximum
1069  // level achieved at that frequency for a minimum of
1070  // mMinSignalBlocks blocks in a row - the max of a min.
1071 
1072  auto finish = mHistoryLen;
1073 
1074  {
1075  // old statistics
1076  const float *pPower = &mQueue[0]->mSpectrums[0];
1077  float *pThreshold = &statistics.mNoiseThreshold[0];
1078  for (int jj = 0; jj < mSpectrumSize; ++jj) {
1079  float min = *pPower++;
1080  for (unsigned ii = 1; ii < finish; ++ii)
1081  min = std::min(min, mQueue[ii]->mSpectrums[jj]);
1082  *pThreshold = std::max(*pThreshold, min);
1083  ++pThreshold;
1084  }
1085  }
1086 #endif
1087 }
1088 
1089 // Return true iff the given band of the "center" window looks like noise.
1090 // Examine the band in a few neighboring windows to decide.
1091 inline
1092 bool EffectNoiseReduction::Worker::Classify(const Statistics &statistics, int band)
1093 {
1094  switch (mMethod) {
1095 #ifdef OLD_METHOD_AVAILABLE
1096  case DM_OLD_METHOD:
1097  {
1098  float min = mQueue[0]->mSpectrums[band];
1099  for (unsigned ii = 1; ii < mNWindowsToExamine; ++ii)
1100  min = std::min(min, mQueue[ii]->mSpectrums[band]);
1101  return min <= mOldSensitivityFactor * statistics.mNoiseThreshold[band];
1102  }
1103 #endif
1104  // New methods suppose an exponential distribution of power values
1105  // in the noise; NEW sensitivity is meant to be log of probability
1106  // that noise strays above the threshold. Call that probability
1107  // 1 - F. The quantile function of an exponential distribution is
1108  // log (1 - F) * mean. Thus simply multiply mean by sensitivity
1109  // to get the threshold.
1110  case DM_MEDIAN:
1111  // This method examines the window and all windows
1112  // that partly overlap it, and takes a median, to
1113  // avoid being fooled by up and down excursions into
1114  // either the mistake of classifying noise as not noise
1115  // (leaving a musical noise chime), or the opposite
1116  // (distorting the signal with a drop out).
1117  if (mNWindowsToExamine == 3)
1118  // No different from second greatest.
1119  goto secondGreatest;
1120  else if (mNWindowsToExamine == 5)
1121  {
1122  float greatest = 0.0, second = 0.0, third = 0.0;
1123  for (unsigned ii = 0; ii < mNWindowsToExamine; ++ii) {
1124  const float power = mQueue[ii]->mSpectrums[band];
1125  if (power >= greatest)
1126  third = second, second = greatest, greatest = power;
1127  else if (power >= second)
1128  third = second, second = power;
1129  else if (power >= third)
1130  third = power;
1131  }
1132  return third <= mNewSensitivity * statistics.mMeans[band];
1133  }
1134  else {
1135  wxASSERT(false);
1136  return true;
1137  }
1138  secondGreatest:
1139  case DM_SECOND_GREATEST:
1140  {
1141  // This method just throws out the high outlier. It
1142  // should be less prone to distortions and more prone to
1143  // chimes.
1144  float greatest = 0.0, second = 0.0;
1145  for (unsigned ii = 0; ii < mNWindowsToExamine; ++ii) {
1146  const float power = mQueue[ii]->mSpectrums[band];
1147  if (power >= greatest)
1148  second = greatest, greatest = power;
1149  else if (power >= second)
1150  second = power;
1151  }
1152  return second <= mNewSensitivity * statistics.mMeans[band];
1153  }
1154  default:
1155  wxASSERT(false);
1156  return true;
1157  }
1158 }
1159 
1161 (const Statistics &statistics, WaveTrack *outputTrack)
1162 {
1163  // Raise the gain for elements in the center of the sliding history
1164  // or, if isolating noise, zero out the non-noise
1165  {
1166  float *pGain = &mQueue[mCenter]->mGains[0];
1167  if (mNoiseReductionChoice == NRC_ISOLATE_NOISE) {
1168  // All above or below the selected frequency range is non-noise
1169  std::fill(pGain, pGain + mBinLow, 0.0f);
1170  std::fill(pGain + mBinHigh, pGain + mSpectrumSize, 0.0f);
1171  pGain += mBinLow;
1172  for (int jj = mBinLow; jj < mBinHigh; ++jj) {
1173  const bool isNoise = Classify(statistics, jj);
1174  *pGain++ = isNoise ? 1.0 : 0.0;
1175  }
1176  }
1177  else {
1178  // All above or below the selected frequency range is non-noise
1179  std::fill(pGain, pGain + mBinLow, 1.0f);
1180  std::fill(pGain + mBinHigh, pGain + mSpectrumSize, 1.0f);
1181  pGain += mBinLow;
1182  for (int jj = mBinLow; jj < mBinHigh; ++jj) {
1183  const bool isNoise = Classify(statistics, jj);
1184  if (!isNoise)
1185  *pGain = 1.0;
1186  ++pGain;
1187  }
1188  }
1189  }
1190 
1191  if (mNoiseReductionChoice != NRC_ISOLATE_NOISE)
1192  {
1193  // In each direction, define an exponential decay of gain from the
1194  // center; make actual gains the maximum of mNoiseAttenFactor, and
1195  // the decay curve, and their prior values.
1196 
1197  // First, the attack, which goes backward in time, which is,
1198  // toward higher indices in the queue.
1199  for (size_t jj = 0; jj < mSpectrumSize; ++jj) {
1200  for (unsigned ii = mCenter + 1; ii < mHistoryLen; ++ii) {
1201  const float minimum =
1202  std::max(mNoiseAttenFactor,
1203  mQueue[ii - 1]->mGains[jj] * mOneBlockAttack);
1204  float &gain = mQueue[ii]->mGains[jj];
1205  if (gain < minimum)
1206  gain = minimum;
1207  else
1208  // We can stop now, our attack curve is intersecting
1209  // the decay curve of some window previously processed.
1210  break;
1211  }
1212  }
1213 
1214  // Now, release. We need only look one window ahead. This part will
1215  // be visited again when we examine the next window, and
1216  // carry the decay further.
1217  {
1218  float *pNextGain = &mQueue[mCenter - 1]->mGains[0];
1219  const float *pThisGain = &mQueue[mCenter]->mGains[0];
1220  for (int nn = mSpectrumSize; nn--;) {
1221  *pNextGain =
1222  std::max(*pNextGain,
1223  std::max(mNoiseAttenFactor,
1224  *pThisGain++ * mOneBlockRelease));
1225  ++pNextGain;
1226  }
1227  }
1228  }
1229 
1230 
1231  if (mOutStepCount >= -(int)(mStepsPerWindow - 1)) {
1232  Record &record = *mQueue[mHistoryLen - 1]; // end of the queue
1233  const auto last = mSpectrumSize - 1;
1234 
1235  if (mNoiseReductionChoice != NRC_ISOLATE_NOISE)
1236  // Apply frequency smoothing to output gain
1237  // Gains are not less than mNoiseAttenFactor
1238  ApplyFreqSmoothing(record.mGains);
1239 
1240  // Apply gain to FFT
1241  {
1242  const float *pGain = &record.mGains[1];
1243  const float *pReal = &record.mRealFFTs[1];
1244  const float *pImag = &record.mImagFFTs[1];
1245  float *pBuffer = &mFFTBuffer[2];
1246  auto nn = mSpectrumSize - 2;
1247  if (mNoiseReductionChoice == NRC_LEAVE_RESIDUE) {
1248  for (; nn--;) {
1249  // Subtract the gain we would otherwise apply from 1, and
1250  // negate that to flip the phase.
1251  const double gain = *pGain++ - 1.0;
1252  *pBuffer++ = *pReal++ * gain;
1253  *pBuffer++ = *pImag++ * gain;
1254  }
1255  mFFTBuffer[0] = record.mRealFFTs[0] * (record.mGains[0] - 1.0);
1256  // The Fs/2 component is stored as the imaginary part of the DC component
1257  mFFTBuffer[1] = record.mImagFFTs[0] * (record.mGains[last] - 1.0);
1258  }
1259  else {
1260  for (; nn--;) {
1261  const double gain = *pGain++;
1262  *pBuffer++ = *pReal++ * gain;
1263  *pBuffer++ = *pImag++ * gain;
1264  }
1265  mFFTBuffer[0] = record.mRealFFTs[0] * record.mGains[0];
1266  // The Fs/2 component is stored as the imaginary part of the DC component
1267  mFFTBuffer[1] = record.mImagFFTs[0] * record.mGains[last];
1268  }
1269  }
1270 
1271  // Invert the FFT into the output buffer
1272  InverseRealFFTf(&mFFTBuffer[0], hFFT.get());
1273 
1274  // Overlap-add
1275  if (mOutWindow.size() > 0) {
1276  float *pOut = &mOutOverlapBuffer[0];
1277  float *pWindow = &mOutWindow[0];
1278  int *pBitReversed = &hFFT->BitReversed[0];
1279  for (unsigned int jj = 0; jj < last; ++jj) {
1280  int kk = *pBitReversed++;
1281  *pOut++ += mFFTBuffer[kk] * (*pWindow++);
1282  *pOut++ += mFFTBuffer[kk + 1] * (*pWindow++);
1283  }
1284  }
1285  else {
1286  float *pOut = &mOutOverlapBuffer[0];
1287  int *pBitReversed = &hFFT->BitReversed[0];
1288  for (unsigned int jj = 0; jj < last; ++jj) {
1289  int kk = *pBitReversed++;
1290  *pOut++ += mFFTBuffer[kk];
1291  *pOut++ += mFFTBuffer[kk + 1];
1292  }
1293  }
1294 
1295  float *buffer = &mOutOverlapBuffer[0];
1296  if (mOutStepCount >= 0) {
1297  // Output the first portion of the overlap buffer, they're done
1298  outputTrack->Append((samplePtr)buffer, floatSample, mStepSize);
1299  }
1300 
1301  // Shift the remainder over.
1302  memmove(buffer, buffer + mStepSize, sizeof(float) * (mWindowSize - mStepSize));
1303  std::fill(buffer + mWindowSize - mStepSize, buffer + mWindowSize, 0.0f);
1304  }
1305 }
1306 
1309  int count, WaveTrack * track, sampleCount start, sampleCount len)
1310 {
1311  if (track == NULL)
1312  return false;
1313 
1314  StartNewTrack();
1315 
1316  WaveTrack::Holder outputTrack;
1317  if(!mDoProfile)
1318  outputTrack = track->EmptyCopy();
1319 
1320  auto bufferSize = track->GetMaxBlockSize();
1321  FloatVector buffer(bufferSize);
1322 
1323  bool bLoopSuccess = true;
1324  auto samplePos = start;
1325  while (bLoopSuccess && samplePos < start + len) {
1326  //Get a blockSize of samples (smaller than the size of the buffer)
1327  const auto blockSize = limitSampleBufferSize(
1328  track->GetBestBlockSize(samplePos),
1329  start + len - samplePos
1330  );
1331 
1332  //Get the samples from the track and put them in the buffer
1333  track->Get((samplePtr)&buffer[0], floatSample, samplePos, blockSize);
1334  samplePos += blockSize;
1335 
1336  mInSampleCount += blockSize;
1337  ProcessSamples(statistics, outputTrack.get(), blockSize, &buffer[0]);
1338 
1339  // Update the Progress meter, let user cancel
1340  bLoopSuccess =
1341  !effect.TrackProgress(count,
1342  ( samplePos - start ).as_double() /
1343  len.as_double() );
1344  }
1345 
1346  if (bLoopSuccess) {
1347  if (mDoProfile)
1348  FinishTrackStatistics(statistics);
1349  else
1350  FinishTrack(statistics, &*outputTrack);
1351  }
1352 
1353  if (bLoopSuccess && !mDoProfile) {
1354  // Flush the output WaveTrack (since it's buffered)
1355  outputTrack->Flush();
1356 
1357  // Take the output track and insert it in place of the original
1358  // sample data (as operated on -- this may not match mT0/mT1)
1359  double t0 = outputTrack->LongSamplesToTime(start);
1360  double tLen = outputTrack->LongSamplesToTime(len);
1361  // Filtering effects always end up with more data than they started with. Delete this 'tail'.
1362  outputTrack->HandleClear(tLen, outputTrack->GetEndTime(), false, false);
1363  track->ClearAndPaste(t0, t0 + tLen, &*outputTrack, true, false);
1364  }
1365 
1366  return bLoopSuccess;
1367 }
1368 
1369 //----------------------------------------------------------------------------
1370 // EffectNoiseReduction::Dialog
1371 //----------------------------------------------------------------------------
1372 
1373 enum {
1376 #ifdef ISOLATE_CHOICE
1378 #endif
1379 #ifdef RESIDUE_CHOICE
1381 #endif
1382 
1383 #ifdef ADVANCED_SETTINGS
1384  ID_CHOICE_METHOD,
1385 #endif
1386 
1387  // Slider/text pairs
1390 
1393 
1394 #ifdef ATTACK_AND_RELEASE
1395  ID_ATTACK_TIME_SLIDER,
1396  ID_ATTACK_TIME_TEXT,
1397 
1398  ID_RELEASE_TIME_SLIDER,
1399  ID_RELEASE_TIME_TEXT,
1400 #endif
1401 
1404 
1406 
1407 #ifdef ADVANCED_SETTINGS
1408  ID_OLD_SENSITIVITY_SLIDER = END_OF_BASIC_SLIDERS,
1409  ID_OLD_SENSITIVITY_TEXT,
1410 
1411  END_OF_ADVANCED_SLIDERS,
1412  END_OF_SLIDERS = END_OF_ADVANCED_SLIDERS,
1413 #else
1415 #endif
1416 
1418 };
1419 
1420 namespace {
1421 
1422 struct ControlInfo {
1424 
1425  double Value(long sliderSetting) const
1426  {
1427  return
1428  valueMin +
1429  (double(sliderSetting) / sliderMax) * (valueMax - valueMin);
1430  }
1431 
1432  long SliderSetting(double value) const
1433  {
1434  return TrapLong(
1435  0.5 + sliderMax * (value - valueMin) / (valueMax - valueMin),
1436  0, sliderMax);
1437  }
1438 
1439  wxString Text(double value) const
1440  {
1441  if (formatAsInt)
1442  return wxString::Format(format, (int)(value));
1443  else
1444  return wxString::Format(format, value);
1445  }
1446 
1447  void CreateControls(int id, ShuttleGui &S) const
1448  {
1449  wxTextCtrl *const text = S.Id(id + 1)
1450  .Validator<FloatingPointValidator<double>>(
1451  formatAsInt ? 0 : 2,
1452  nullptr,
1453  NumValidatorStyle::DEFAULT,
1454  valueMin, valueMax
1455  )
1456  .AddTextBox(textBoxCaption, wxT(""), 0);
1457 
1458  wxSlider *const slider =
1459  S.Id(id)
1460  .Name( sliderName )
1461  .Style(wxSL_HORIZONTAL)
1462  .MinSize( { 150, -1 } )
1463  .AddSlider( {}, 0, sliderMax);
1464  }
1465 
1467  double valueMin;
1468  double valueMax;
1470  // (valueMin - valueMax) / sliderMax is the value increment of the slider
1471  const wxChar* format;
1475 
1476  ControlInfo(MemberPointer f, double vMin, double vMax, long sMax, const wxChar* fmt, bool fAsInt,
1477  const TranslatableString &caption, const TranslatableString &name)
1478  : field(f), valueMin(vMin), valueMax(vMax), sliderMax(sMax), format(fmt), formatAsInt(fAsInt)
1479  , textBoxCaption(caption), sliderName(name)
1480  {
1481  }
1482 };
1483 
1485  static const ControlInfo table[] = {
1487  0.0, 48.0, 48, wxT("%d"), true,
1488  XXO("&Noise reduction (dB):"), XO("Noise reduction")),
1490  0.0, 24.0, 48, wxT("%.2f"), false,
1491  XXO("&Sensitivity:"), XO("Sensitivity")),
1492 #ifdef ATTACK_AND_RELEASE
1494  0, 1.0, 100, wxT("%.2f"), false,
1495  XXO("Attac&k time (secs):"), XO("Attack time")),
1497  0, 1.0, 100, wxT("%.2f"), false,
1498  XXO("R&elease time (secs):"), XO("Release time")),
1499 #endif
1501  0, 12, 12, wxT("%d"), true,
1502  XXO("&Frequency smoothing (bands):"), XO("Frequency smoothing")),
1503 
1504 #ifdef ADVANCED_SETTINGS
1506  -20.0, 20.0, 4000, wxT("%.2f"), false,
1507  XXO("Sensiti&vity (dB):"), XO("Old Sensitivity")),
1508  // add here
1509 #endif
1510  };
1511 
1512 return table;
1513 }
1514 
1515 } // namespace
1516 
1517 
1524 
1526 #ifdef ISOLATE_CHOICE
1528 #endif
1529 #ifdef RESIDUE_CHOICE
1531 #endif
1532 
1533 #ifdef ADVANCED_SETTINGS
1534  EVT_CHOICE(ID_CHOICE_METHOD, EffectNoiseReduction::Dialog::OnMethodChoice)
1535 #endif
1536 
1539 
1542 
1545 
1546 #ifdef ATTACK_AND_RELEASE
1547  EVT_SLIDER(ID_ATTACK_TIME_SLIDER, EffectNoiseReduction::Dialog::OnSlider)
1548  EVT_TEXT(ID_ATTACK_TIME_TEXT, EffectNoiseReduction::Dialog::OnText)
1549 
1550  EVT_SLIDER(ID_RELEASE_TIME_SLIDER, EffectNoiseReduction::Dialog::OnSlider)
1551  EVT_TEXT(ID_RELEASE_TIME_TEXT, EffectNoiseReduction::Dialog::OnText)
1552 #endif
1553 
1554 
1555 #ifdef ADVANCED_SETTINGS
1556  EVT_SLIDER(ID_OLD_SENSITIVITY_SLIDER, EffectNoiseReduction::Dialog::OnSlider)
1557  EVT_TEXT(ID_OLD_SENSITIVITY_TEXT, EffectNoiseReduction::Dialog::OnText)
1558 #endif
1560 
1562 (EffectNoiseReduction *effect,
1564  wxWindow *parent, bool bHasProfile, bool bAllowTwiddleSettings)
1565  : EffectDialog( parent, XO("Noise Reduction"), EffectTypeProcess,wxDEFAULT_DIALOG_STYLE, eHelpButton )
1566  , m_pEffect(effect)
1567  , m_pSettings(settings) // point to
1568  , mTempSettings(*settings) // copy
1569  , mbHasProfile(bHasProfile)
1570  , mbAllowTwiddleSettings(bAllowTwiddleSettings)
1571  // NULL out the control members until the controls are created.
1572  , mKeepSignal(NULL)
1573 #ifdef ISOLATE_CHOICE
1574  , mKeepNoise(NULL)
1575 #endif
1576 #ifdef RESIDUE_CHOICE
1577  , mResidue(NULL)
1578 #endif
1579 {
1581 
1582  wxButton *const pButtonPreview =
1583  (wxButton *)wxWindow::FindWindowById(ID_EFFECT_PREVIEW, this);
1584  wxButton *const pButtonReduceNoise =
1585  (wxButton *)wxWindow::FindWindowById(wxID_OK, this);
1586 
1587  if (mbHasProfile || mbAllowTwiddleSettings) {
1588  pButtonPreview->Enable(!mbAllowTwiddleSettings);
1589  pButtonReduceNoise->SetFocus();
1590  }
1591  else {
1592  pButtonPreview->Enable(false);
1593  pButtonReduceNoise->Enable(false);
1594  }
1595 }
1596 
1598 {
1599  // If Isolate is chosen, disable controls that define
1600  // "what to do with noise" rather than "what is noise."
1601  // Else, enable them.
1602  // This does NOT include sensitivity, NEW or old, nor
1603  // the choice of window functions, size, or step.
1604  // The method choice is not included, because it affects
1605  // which sensitivity slider is operative, and that is part
1606  // of what defines noise.
1607 
1608  static const int toDisable[] = {
1610  ID_GAIN_TEXT,
1611 
1613  ID_FREQ_TEXT,
1614 
1615 #ifdef ATTACK_AND_RELEASE
1616  ID_ATTACK_TIME_SLIDER,
1617  ID_ATTACK_TIME_TEXT,
1618 
1619  ID_RELEASE_TIME_SLIDER,
1620  ID_RELEASE_TIME_TEXT,
1621 #endif
1622  };
1623  static const int nToDisable = sizeof(toDisable) / sizeof(toDisable[0]);
1624 
1625  bool bIsolating =
1626 #ifdef ISOLATE_CHOICE
1627  mKeepNoise->GetValue();
1628 #else
1629  false;
1630 #endif
1631  for (int ii = nToDisable; ii--;)
1632  wxWindow::FindWindowById(toDisable[ii], this)->Enable(!bIsolating);
1633 }
1634 
1635 #ifdef ADVANCED_SETTINGS
1636 void EffectNoiseReduction::Dialog::EnableDisableSensitivityControls()
1637 {
1638  wxChoice *const pChoice =
1639  static_cast<wxChoice*>(wxWindow::FindWindowById(ID_CHOICE_METHOD, this));
1640  const bool bOldMethod =
1641  pChoice->GetSelection() == DM_OLD_METHOD;
1642  wxWindow::FindWindowById(ID_OLD_SENSITIVITY_SLIDER, this)->Enable(bOldMethod);
1643  wxWindow::FindWindowById(ID_OLD_SENSITIVITY_TEXT, this)->Enable(bOldMethod);
1644  wxWindow::FindWindowById(ID_NEW_SENSITIVITY_SLIDER, this)->Enable(!bOldMethod);
1645  wxWindow::FindWindowById(ID_NEW_SENSITIVITY_TEXT, this)->Enable(!bOldMethod);
1646 }
1647 #endif
1648 
1649 void EffectNoiseReduction::Dialog::OnGetProfile(wxCommandEvent & WXUNUSED(event))
1650 {
1651  // Project has not be changed so skip pushing state
1653 
1654  if (!TransferDataFromWindow())
1655  return;
1656 
1657  // Return code distinguishes this first step from the actual effect
1658  EndModal(1);
1659 }
1660 
1661 // This handles the whole radio group
1662 void EffectNoiseReduction::Dialog::OnNoiseReductionChoice( wxCommandEvent & WXUNUSED(event))
1663 {
1664  if (mKeepSignal->GetValue())
1665  mTempSettings.mNoiseReductionChoice = NRC_REDUCE_NOISE;
1666 #ifdef ISOLATE_CHOICE
1667  else if (mKeepNoise->GetValue())
1668  mTempSettings.mNoiseReductionChoice = NRC_ISOLATE_NOISE;
1669 #endif
1670 #ifdef RESIDUE_CHOICE
1671  else
1672  mTempSettings.mNoiseReductionChoice = NRC_LEAVE_RESIDUE;
1673 #endif
1674  DisableControlsIfIsolating();
1675 }
1676 
1677 #ifdef ADVANCED_SETTINGS
1678 void EffectNoiseReduction::Dialog::OnMethodChoice(wxCommandEvent &)
1679 {
1680  EnableDisableSensitivityControls();
1681 }
1682 #endif
1683 
1684 void EffectNoiseReduction::Dialog::OnPreview(wxCommandEvent & WXUNUSED(event))
1685 {
1686  if (!TransferDataFromWindow())
1687  return;
1688 
1689  // Save & restore parameters around Preview, because we didn't do OK.
1690  auto cleanup = valueRestorer( *m_pSettings );
1691  *m_pSettings = mTempSettings;
1692  m_pSettings->mDoProfile = false;
1693 
1694  m_pEffect->Preview( false );
1695 }
1696 
1697 void EffectNoiseReduction::Dialog::OnReduceNoise( wxCommandEvent & WXUNUSED(event))
1698 {
1699  if (!TransferDataFromWindow())
1700  return;
1701 
1702  EndModal(2);
1703 }
1704 
1705 void EffectNoiseReduction::Dialog::OnCancel(wxCommandEvent & WXUNUSED(event))
1706 {
1707  EndModal(0);
1708 }
1709 
1710 void EffectNoiseReduction::Dialog::OnHelp(wxCommandEvent & WXUNUSED(event))
1711 {
1712  HelpSystem::ShowHelp(this, "Noise_Reduction", true);
1713 }
1714 
1716 {
1717  S.StartStatic(XO("Step 1"));
1718  {
1719  S.AddVariableText(XO(
1720 "Select a few seconds of just noise so Audacity knows what to filter out,\nthen click Get Noise Profile:"));
1721  //m_pButton_GetProfile =
1722  S.Id(ID_BUTTON_GETPROFILE).AddButton(XXO("&Get Noise Profile"));
1723  }
1724  S.EndStatic();
1725 
1726  S.StartStatic(XO("Step 2"));
1727  {
1728  S.AddVariableText(XO(
1729 "Select all of the audio you want filtered, choose how much noise you want\nfiltered out, and then click 'OK' to reduce noise.\n"));
1730 
1731  S.StartMultiColumn(3, wxEXPAND);
1732  S.SetStretchyCol(2);
1733  {
1734  for (int id = FIRST_SLIDER; id < END_OF_BASIC_SLIDERS; id += 2) {
1735  const ControlInfo &info = controlInfo()[(id - FIRST_SLIDER) / 2];
1736  info.CreateControls(id, S);
1737  }
1738  }
1739  S.EndMultiColumn();
1740 
1741  S.StartMultiColumn(
1742  2
1743 #ifdef RESIDUE_CHOICE
1744  +1
1745 #endif
1746 #ifdef ISOLATE_CHOICE
1747  +1
1748 #endif
1749  ,
1750  wxALIGN_CENTER_HORIZONTAL);
1751  {
1752  S.AddPrompt(XXO("Noise:"));
1753  mKeepSignal = S.Id(ID_RADIOBUTTON_KEEPSIGNAL)
1754  /* i18n-hint: Translate differently from "Residue" ! */
1755  .AddRadioButton(XXO("Re&duce"));
1756 #ifdef ISOLATE_CHOICE
1757  mKeepNoise = S.Id(ID_RADIOBUTTON_KEEPNOISE)
1758  .AddRadioButtonToGroup(XXO("&Isolate"));
1759 #endif
1760 #ifdef RESIDUE_CHOICE
1761  mResidue = S.Id(ID_RADIOBUTTON_RESIDUE)
1762  /* i18n-hint: Means the difference between effect and original sound. Translate differently from "Reduce" ! */
1763  .AddRadioButtonToGroup(XXO("Resid&ue"));
1764 #endif
1765  }
1766  S.EndMultiColumn();
1767  }
1768  S.EndStatic();
1769 
1770 
1771 #ifdef ADVANCED_SETTINGS
1772  S.StartStatic(XO("Advanced Settings"));
1773  {
1774  S.StartMultiColumn(2);
1775  {
1776  S.TieChoice(XXO("&Window types:"),
1777  mTempSettings.mWindowTypes,
1778  []{
1779  TranslatableStrings windowTypeChoices;
1780  for (int ii = 0; ii < WT_N_WINDOW_TYPES; ++ii)
1781  windowTypeChoices.push_back(windowTypesInfo[ii].name);
1782  return windowTypeChoices;
1783  }()
1784  );
1785 
1786  S.TieChoice(XXO("Window si&ze:"),
1787  mTempSettings.mWindowSizeChoice,
1788  {
1789  XO("8") ,
1790  XO("16") ,
1791  XO("32") ,
1792  XO("64") ,
1793  XO("128") ,
1794  XO("256") ,
1795  XO("512") ,
1796  XO("1024") ,
1797  XO("2048 (default)") ,
1798  XO("4096") ,
1799  XO("8192") ,
1800  XO("16384") ,
1801  }
1802  );
1803 
1804  S.TieChoice(XXO("S&teps per window:"),
1805  mTempSettings.mStepsPerWindowChoice,
1806  {
1807  XO("2") ,
1808  XO("4 (default)") ,
1809  XO("8") ,
1810  XO("16") ,
1811  XO("32") ,
1812  XO("64") ,
1813  }
1814  );
1815 
1816  S.Id(ID_CHOICE_METHOD)
1817  .TieChoice(XXO("Discrimination &method:"),
1818  mTempSettings.mMethod,
1819  []{
1820  TranslatableStrings methodChoices;
1821  int nn = DM_N_METHODS;
1822 #ifndef OLD_METHOD_AVAILABLE
1823  --nn;
1824 #endif
1825  for (int ii = 0; ii < nn; ++ii)
1826  methodChoices.push_back(discriminationMethodInfo[ii].name);
1827  return methodChoices;
1828  }());
1829  }
1830  S.EndMultiColumn();
1831 
1832  S.StartMultiColumn(3, wxEXPAND);
1833  S.SetStretchyCol(2);
1834  {
1835  for (int id = END_OF_BASIC_SLIDERS; id < END_OF_ADVANCED_SLIDERS; id += 2) {
1836  const ControlInfo &info = controlInfo()[(id - FIRST_SLIDER) / 2];
1837  info.CreateControls(id, S);
1838  }
1839  }
1840  S.EndMultiColumn();
1841  }
1842  S.EndStatic();
1843 #endif
1844 }
1845 
1847 {
1848  // Do the choice controls:
1850  return false;
1851 
1852  for (int id = FIRST_SLIDER; id < END_OF_SLIDERS; id += 2) {
1853  wxSlider* slider =
1854  static_cast<wxSlider*>(wxWindow::FindWindowById(id, this));
1855  wxTextCtrl* text =
1856  static_cast<wxTextCtrl*>(wxWindow::FindWindowById(id + 1, this));
1857  const ControlInfo &info = controlInfo()[(id - FIRST_SLIDER) / 2];
1858  const double field = mTempSettings.*(info.field);
1859  text->SetValue(info.Text(field));
1860  slider->SetValue(info.SliderSetting(field));
1861  }
1862 
1863  mKeepSignal->SetValue(mTempSettings.mNoiseReductionChoice == NRC_REDUCE_NOISE);
1864 #ifdef ISOLATE_CHOICE
1865  mKeepNoise->SetValue(mTempSettings.mNoiseReductionChoice == NRC_ISOLATE_NOISE);
1866 #endif
1867 #ifdef RESIDUE_CHOICE
1868  mResidue->SetValue(mTempSettings.mNoiseReductionChoice == NRC_LEAVE_RESIDUE);
1869 #endif
1870 
1871  // Set the enabled states of controls
1872  DisableControlsIfIsolating();
1873 #ifdef ADVANCED_SETTINGS
1874  EnableDisableSensitivityControls();
1875 #endif
1876 
1877  return true;
1878 }
1879 
1881 {
1882  if( !wxWindow::Validate() )
1883  return false;
1884  // Do the choice controls:
1886  return false;
1887 
1888  wxCommandEvent dummy;
1889  OnNoiseReductionChoice(dummy);
1890 
1891  return mTempSettings.Validate(m_pEffect);
1892 }
1893 
1894 void EffectNoiseReduction::Dialog::OnText(wxCommandEvent &event)
1895 {
1896  int id = event.GetId();
1897  int idx = (id - FIRST_SLIDER - 1) / 2;
1898  const ControlInfo &info = controlInfo()[idx];
1899  wxTextCtrl* text =
1900  static_cast<wxTextCtrl*>(wxWindow::FindWindowById(id, this));
1901  wxSlider* slider =
1902  static_cast<wxSlider*>(wxWindow::FindWindowById(id - 1, this));
1903  double &field = mTempSettings.*(info.field);
1904 
1905  text->GetValue().ToDouble(&field);
1906  slider->SetValue(info.SliderSetting(field));
1907 }
1908 
1909 void EffectNoiseReduction::Dialog::OnSlider(wxCommandEvent &event)
1910 {
1911  int id = event.GetId();
1912  int idx = (id - FIRST_SLIDER) / 2;
1913  const ControlInfo &info = controlInfo()[idx];
1914  wxSlider* slider =
1915  static_cast<wxSlider*>(wxWindow::FindWindowById(id, this));
1916  wxTextCtrl* text =
1917  static_cast<wxTextCtrl*>(wxWindow::FindWindowById(id + 1, this));
1918  double &field = mTempSettings.*(info.field);
1919 
1920  field = info.Value(slider->GetValue());
1921  text->SetValue(info.Text(field));
1922 }
1923 
EffectNoiseReduction::Statistics
Definition: NoiseReduction.cpp:168
anonymous_namespace{NoiseReduction.cpp}::ControlInfo::Text
wxString Text(double value) const
Definition: NoiseReduction.cpp:1439
EffectNoiseReduction::Worker::Record::mImagFFTs
FloatVector mImagFFTs
Definition: NoiseReduction.cpp:347
EffectNoiseReduction::Settings::Settings
Settings()
Definition: NoiseReduction.cpp:244
anonymous_namespace{NoiseReduction.cpp}::ControlInfo::MemberPointer
doubleEffectNoiseReduction::Settings::* MemberPointer
Definition: NoiseReduction.cpp:1423
EVT_BUTTON
EVT_BUTTON(wxID_NO, DependencyDialog::OnNo) EVT_BUTTON(wxID_YES
EffectNoiseReduction
A two-pass effect to reduce background noise.
Definition: NoiseReduction.h:18
EffectNoiseReduction::CheckWhetherSkipEffect
bool CheckWhetherSkipEffect() override
Definition: NoiseReduction.cpp:462
TranslatableString
Definition: Types.h:290
anonymous_namespace{NoiseReduction.cpp}::NRC_REDUCE_NOISE
@ NRC_REDUCE_NOISE
Definition: NoiseReduction.cpp:156
anonymous_namespace{NoiseReduction.cpp}::ControlInfo::format
const wxChar * format
Definition: NoiseReduction.cpp:1471
EffectNoiseReduction::Worker::FinishTrack
void FinishTrack(Statistics &statistics, WaveTrack *outputTrack)
Definition: NoiseReduction.cpp:1038
field
#define field(n, t)
Definition: ImportAUP.cpp:165
EffectNoiseReduction::GetSymbol
ComponentInterfaceSymbol GetSymbol() override
Definition: NoiseReduction.cpp:440
anonymous_namespace{NoiseReduction.cpp}::NRC_LEAVE_RESIDUE
@ NRC_LEAVE_RESIDUE
Definition: NoiseReduction.cpp:158
anonymous_namespace{NoiseReduction.cpp}::DiscriminationMethodInfo::name
const TranslatableString name
Definition: NoiseReduction.cpp:104
valueRestorer
ValueRestorer< T > valueRestorer(T &var)
inline functions provide convenient parameter type deduction
Definition: MemoryX.h:430
EffectNoiseReduction::Settings::mDoProfile
bool mDoProfile
Definition: NoiseReduction.cpp:220
anonymous_namespace{NoiseReduction.cpp}::WT_HAMMING_INV_HAMMING
@ WT_HAMMING_INV_HAMMING
Definition: NoiseReduction.cpp:123
EffectNoiseReduction::Dialog::OnHelp
void OnHelp(wxCommandEvent &event)
Definition: NoiseReduction.cpp:1710
EffectNoiseReduction::Worker::ProcessSamples
void ProcessSamples(Statistics &statistics, WaveTrack *outputTrack, size_t len, float *buffer)
Definition: NoiseReduction.cpp:939
WaveTrack
A Track that contains audio waveform data.
Definition: WaveTrack.h:68
EffectTypeProcess
@ EffectTypeProcess
Definition: EffectInterface.h:59
DB_TO_LINEAR
const double MIN_Threshold_Linear DB_TO_LINEAR(MIN_Threshold_dB)
EffectNoiseReduction::Worker::mCenter
unsigned mCenter
Definition: NoiseReduction.cpp:331
EffectNoiseReduction::Settings::StepsPerWindow
unsigned StepsPerWindow() const
Definition: NoiseReduction.cpp:218
END_OF_SLIDERS
@ END_OF_SLIDERS
Definition: NoiseReduction.cpp:1414
EffectNoiseReduction::Worker::mOutOverlapBuffer
FloatVector mOutOverlapBuffer
Definition: NoiseReduction.cpp:302
EffectNoiseReduction::Dialog::OnGetProfile
void OnGetProfile(wxCommandEvent &event)
Definition: NoiseReduction.cpp:1649
EffectNoiseReduction::Settings::mNoiseReductionChoice
int mNoiseReductionChoice
Definition: NoiseReduction.cpp:235
EffectDialog::Init
void Init()
Definition: EffectUI.cpp:2047
EffectNoiseReduction::Statistics::mTotalWindows
int mTotalWindows
Definition: NoiseReduction.cpp:189
EffectNoiseReduction::Worker::mStepSize
const size_t mStepSize
Definition: NoiseReduction.cpp:316
anonymous_namespace{NoiseReduction.cpp}::ControlInfo::formatAsInt
bool formatAsInt
Definition: NoiseReduction.cpp:1472
gPrefs
FileConfig * gPrefs
Definition: Prefs.cpp:67
EffectNoiseReduction::Worker::mBinLow
int mBinLow
Definition: NoiseReduction.cpp:311
EffectNoiseReduction::Symbol
static const ComponentInterfaceSymbol Symbol
Definition: NoiseReduction.h:20
Effect::MessageBox
int MessageBox(const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
Definition: Effect.cpp:2478
anonymous_namespace{NoiseReduction.cpp}::WindowTypesInfo::inCoefficients
double inCoefficients[3]
Definition: NoiseReduction.cpp:132
Effect::CopyInputTracks
void CopyInputTracks(bool allSyncLockSelected=false)
Definition: Effect.cpp:2070
anonymous_namespace{NoiseReduction.cpp}::windowTypesInfo
const struct anonymous_namespace{NoiseReduction.cpp}::WindowTypesInfo windowTypesInfo[WT_N_WINDOW_TYPES]
anonymous_namespace{NoiseReduction.cpp}::WT_N_WINDOW_TYPES
@ WT_N_WINDOW_TYPES
Definition: NoiseReduction.cpp:125
EffectNoiseReduction::Dialog::OnNoiseReductionChoice
void OnNoiseReductionChoice(wxCommandEvent &event)
Definition: NoiseReduction.cpp:1662
EffectNoiseReduction::Settings::mWindowSizeChoice
int mWindowSizeChoice
Definition: NoiseReduction.cpp:239
EffectNoiseReduction::Worker::Record::mRealFFTs
FloatVector mRealFFTs
Definition: NoiseReduction.cpp:346
EffectNoiseReduction::Worker::mWindowSize
const size_t mWindowSize
Definition: NoiseReduction.cpp:297
TrackList
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:1263
anonymous_namespace{NoiseReduction.cpp}::WT_HANN_RECTANGULAR
@ WT_HANN_RECTANGULAR
Definition: NoiseReduction.cpp:118
ShuttleGuiBase::AddRadioButtonToGroup
wxRadioButton * AddRadioButtonToGroup(const TranslatableString &Prompt, int selector=1, int initValue=0)
Definition: ShuttleGui.cpp:567
RealFFTf
void RealFFTf(fft_type *buffer, const FFTParam *h)
Definition: RealFFTf.cpp:165
anonymous_namespace{NoiseReduction.cpp}::NoiseReductionChoice
NoiseReductionChoice
Definition: NoiseReduction.cpp:155
EffectNoiseReduction::ShowInterface
bool ShowInterface(wxWindow &parent, const EffectDialogFactory &factory, bool forceModal=false) override
Definition: NoiseReduction.cpp:467
EffectNoiseReduction::Dialog::OnSlider
void OnSlider(wxCommandEvent &event)
Definition: NoiseReduction.cpp:1909
Effect::mT1
double mT1
Definition: Effect.h:466
EffectNoiseReduction::Statistics::mWindowTypes
int mWindowTypes
Definition: NoiseReduction.cpp:187
EffectNoiseReduction::Statistics::Statistics
Statistics(size_t spectrumSize, double rate, int windowTypes)
Definition: NoiseReduction.cpp:170
anonymous_namespace{NoiseReduction.cpp}::minSignalTime
const float minSignalTime
Definition: NoiseReduction.cpp:114
EffectNoiseReduction::Worker::GatherStatistics
void GatherStatistics(Statistics &statistics)
Definition: NoiseReduction.cpp:1054
EffectNoiseReduction::GetDescription
TranslatableString GetDescription() override
Definition: NoiseReduction.cpp:445
ShuttleGui::MinSize
ShuttleGui & MinSize()
Definition: ShuttleGui.h:740
XO
#define XO(s)
Definition: Internat.h:32
anonymous_namespace{NoiseReduction.cpp}::ControlInfo
Definition: NoiseReduction.cpp:1422
EffectNoiseReduction::Worker::Classify
bool Classify(const Statistics &statistics, int band)
Definition: NoiseReduction.cpp:1092
anonymous_namespace{NoiseReduction.cpp}::ControlInfo::valueMin
double valueMin
Definition: NoiseReduction.cpp:1467
anonymous_namespace{NoiseReduction.cpp}::PrefsTableEntry::MemberPointer
FieldTypeStructureType::* MemberPointer
Definition: NoiseReduction.cpp:502
EffectNoiseReduction::Dialog::TransferDataFromWindow
bool TransferDataFromWindow() override
Definition: NoiseReduction.cpp:1880
anonymous_namespace{NoiseReduction.cpp}::WT_BLACKMAN_HANN
@ WT_BLACKMAN_HANN
Definition: NoiseReduction.cpp:120
anonymous_namespace{NoiseReduction.cpp}::DEFAULT_STEPS_PER_WINDOW_CHOICE
@ DEFAULT_STEPS_PER_WINDOW_CHOICE
Definition: NoiseReduction.cpp:152
EffectDialog::TransferDataToWindow
bool TransferDataToWindow() override
Definition: EffectUI.cpp:2083
ShuttleGuiBase::EndMultiColumn
void EndMultiColumn()
Definition: ShuttleGui.cpp:1212
EffectNoiseReduction::Worker::ReduceNoise
void ReduceNoise(const Statistics &statistics, WaveTrack *outputTrack)
Definition: NoiseReduction.cpp:1161
floatSample
@ floatSample
Definition: Types.h:722
anonymous_namespace{NoiseReduction.cpp}::WindowTypesInfo::outCoefficients
double outCoefficients[3]
Definition: NoiseReduction.cpp:133
EffectManager::Get
static EffectManager & Get()
Definition: EffectManager.cpp:42
ID_EFFECT_PREVIEW
#define ID_EFFECT_PREVIEW
Definition: Effect.h:548
EffectNoiseReduction::Dialog::OnText
void OnText(wxCommandEvent &event)
Definition: NoiseReduction.cpp:1894
EffectNoiseReduction::Dialog::GetTempSettings
const Settings & GetTempSettings() const
Definition: NoiseReduction.cpp:377
anonymous_namespace{NoiseReduction.cpp}::DM_OLD_METHOD
@ DM_OLD_METHOD
Definition: NoiseReduction.cpp:97
EffectNoiseReduction::Worker::mNoiseAttenFactor
float mNoiseAttenFactor
Definition: NoiseReduction.cpp:327
WaveTrack::ClearAndPaste
void ClearAndPaste(double t0, double t1, const Track *src, bool preserve=true, bool merge=true, const TimeWarper *effectWarper=NULL)
Definition: WaveTrack.cpp:750
EffectNoiseReduction::Dialog::m_pSettings
EffectNoiseReduction::Settings * m_pSettings
Definition: NoiseReduction.cpp:404
anonymous_namespace{NoiseReduction.cpp}::WindowTypesInfo::name
const TranslatableString name
Definition: NoiseReduction.cpp:130
Effect::TransferDataFromWindow
virtual bool TransferDataFromWindow()
Definition: Effect.cpp:1920
EffectNoiseReduction::Worker::mMethod
const int mMethod
Definition: NoiseReduction.cpp:317
WaveTrack::EmptyCopy
Holder EmptyCopy(const SampleBlockFactoryPtr &pFactory={}) const
Definition: WaveTrack.cpp:574
EffectNoiseReduction::Settings::mAttackTime
double mAttackTime
Definition: NoiseReduction.cpp:228
ComponentInterfaceSymbol
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Definition: ComponentInterface.h:60
anonymous_namespace{NoiseReduction.cpp}::PrefsTableEntry::field
MemberPointer field
Definition: NoiseReduction.cpp:504
Effect::mFactory
WaveTrackFactory * mFactory
Definition: Effect.h:461
EffectNoiseReduction::Dialog::mResidue
wxRadioButton * mResidue
Definition: NoiseReduction.cpp:416
ShuttleGui::Id
ShuttleGui & Id(int id)
Definition: ShuttleGui.cpp:2248
EffectManager::SetSkipStateFlag
void SetSkipStateFlag(bool flag)
Definition: EffectManager.cpp:213
anonymous_namespace{NoiseReduction.cpp}::DM_N_METHODS
@ DM_N_METHODS
Definition: NoiseReduction.cpp:99
ID_BUTTON_GETPROFILE
@ ID_BUTTON_GETPROFILE
Definition: NoiseReduction.cpp:1374
WaveTrack::Get
bool Get(samplePtr buffer, sampleFormat format, sampleCount start, size_t len, fillFormat fill=fillZero, bool mayThrow=true, sampleCount *pNumWithinClips=nullptr) const
Definition: WaveTrack.cpp:1895
limitSampleBufferSize
size_t limitSampleBufferSize(size_t bufferSize, sampleCount limit)
Definition: Types.h:706
anonymous_namespace{NoiseReduction.cpp}::DiscriminationMethodInfo
Definition: NoiseReduction.cpp:103
EffectNoiseReduction::Worker::mOldSensitivityFactor
float mOldSensitivityFactor
Definition: NoiseReduction.cpp:328
EffectNoiseReduction::Dialog::TransferDataToWindow
bool TransferDataToWindow() override
Definition: NoiseReduction.cpp:1846
EffectNoiseReduction::Worker::mQueue
std::vector< std::unique_ptr< Record > > mQueue
Definition: NoiseReduction.cpp:349
WaveTrack::Holder
std::shared_ptr< WaveTrack > Holder
Definition: WaveTrack.h:93
ShuttleGui::Style
ShuttleGui & Style(long iStyle)
Definition: ShuttleGui.h:734
EffectNoiseReduction::Dialog::Dialog
Dialog(EffectNoiseReduction *effect, Settings *settings, wxWindow *parent, bool bHasProfile, bool bAllowTwiddleSettings)
Definition: NoiseReduction.cpp:1562
EffectUI.h
EffectNoiseReduction::Worker::Settings
EffectNoiseReduction::Settings Settings
Definition: NoiseReduction.cpp:258
TranslatableStrings
std::vector< TranslatableString > TranslatableStrings
Definition: Types.h:555
EffectNoiseReduction::Worker::mSampleRate
const double mSampleRate
Definition: NoiseReduction.cpp:295
EffectNoiseReduction::Settings::mReleaseTime
double mReleaseTime
Definition: NoiseReduction.cpp:229
EffectNoiseReduction::Worker::Record::Record
Record(size_t spectrumSize)
Definition: NoiseReduction.cpp:336
EffectNoiseReduction::Worker::StartNewTrack
void StartNewTrack()
Definition: NoiseReduction.cpp:891
samplePtr
char * samplePtr
Definition: Types.h:737
EffectNoiseReduction::Worker::hFFT
HFFT hFFT
Definition: NoiseReduction.cpp:299
XXO
#define XXO(s)
Definition: Internat.h:45
anonymous_namespace{NoiseReduction.cpp}::ControlInfo::CreateControls
void CreateControls(int id, ShuttleGui &S) const
Definition: NoiseReduction.cpp:1447
anonymous_namespace{NoiseReduction.cpp}::ControlInfo::sliderMax
long sliderMax
Definition: NoiseReduction.cpp:1469
EffectNoiseReduction::Worker::ApplyFreqSmoothing
void ApplyFreqSmoothing(FloatVector &gains)
Definition: NoiseReduction.cpp:714
EffectNoiseReduction::Worker::Record
Definition: NoiseReduction.cpp:335
EffectNoiseReduction::GetType
EffectType GetType() override
Definition: NoiseReduction.cpp:452
Effect::mT0
double mT0
Definition: Effect.h:465
factory
static RegisteredToolbarFactory factory
Definition: ControlToolBar.cpp:804
EffectNoiseReduction::Statistics::mMeans
FloatVector mMeans
Definition: NoiseReduction.cpp:192
sampleCount::as_double
double as_double() const
Definition: Types.h:616
anonymous_namespace{NoiseReduction.cpp}::DiscriminationMethod
DiscriminationMethod
Definition: NoiseReduction.cpp:94
anonymous_namespace{NoiseReduction.cpp}::PrefsTableEntry::defaultValue
FieldType defaultValue
Definition: NoiseReduction.cpp:506
EffectNoiseReduction::Settings::mOldSensitivity
double mOldSensitivity
Definition: NoiseReduction.cpp:232
ID_NEW_SENSITIVITY_TEXT
@ ID_NEW_SENSITIVITY_TEXT
Definition: NoiseReduction.cpp:1392
ShuttleGuiBase::StartMultiColumn
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
Definition: ShuttleGui.cpp:1203
anonymous_namespace{NoiseReduction.cpp}::WT_HANN_HANN
@ WT_HANN_HANN
Definition: NoiseReduction.cpp:119
EffectNoiseReduction::Settings::mMethod
int mMethod
Definition: NoiseReduction.cpp:241
anonymous_namespace{NoiseReduction.cpp}::ControlInfo::valueMax
double valueMax
Definition: NoiseReduction.cpp:1468
eHelpButton
@ eHelpButton
Definition: ShuttleGui.h:611
anonymous_namespace{NoiseReduction.cpp}::writePrefs
void writePrefs(StructureType *structure, const wxString &prefix, const PrefsTableEntry< StructureType, FieldType > *fields, int numFields)
Definition: NoiseReduction.cpp:522
EffectNoiseReduction::Worker::FinishTrackStatistics
void FinishTrackStatistics(Statistics &statistics)
Definition: NoiseReduction.cpp:1016
EffectNoiseReduction::Worker::Worker
Worker(const Settings &settings, double sampleRate)
Definition: NoiseReduction.cpp:746
EffectNoiseReduction::Worker::mBinHigh
int mBinHigh
Definition: NoiseReduction.cpp:312
EffectNoiseReduction::Dialog::DisableControlsIfIsolating
void DisableControlsIfIsolating()
Definition: NoiseReduction.cpp:1597
anonymous_namespace{NoiseReduction.cpp}::ControlInfo::Value
double Value(long sliderSetting) const
Definition: NoiseReduction.cpp:1425
Effect::ReplaceProcessedTracks
void ReplaceProcessedTracks(const bool bGoodResult)
Definition: Effect.cpp:2192
EffectNoiseReduction::Worker::mInWindow
FloatVector mInWindow
Definition: NoiseReduction.cpp:304
name
const TranslatableString name
Definition: Distortion.cpp:98
anonymous_namespace{NoiseReduction.cpp}::WT_HAMMING_RECTANGULAR
@ WT_HAMMING_RECTANGULAR
Definition: NoiseReduction.cpp:121
EffectNoiseReduction::Worker::mNewSensitivity
const double mNewSensitivity
Definition: NoiseReduction.cpp:318
FloatVector
std::vector< float > FloatVector
Definition: NoiseReduction.cpp:77
EffectNoiseReduction::Worker::mSpectrumSize
const size_t mSpectrumSize
Definition: NoiseReduction.cpp:307
format
int format
Definition: ExportPCM.cpp:54
EffectDialog
Definition: EffectUI.h:240
ShuttleGui::Validator
ShuttleGui & Validator(const Factory &f)
Definition: ShuttleGui.h:685
anonymous_namespace{NoiseReduction.cpp}::NRC_ISOLATE_NOISE
@ NRC_ISOLATE_NOISE
Definition: NoiseReduction.cpp:157
EffectNoiseReduction::Settings::PromptUser
bool PromptUser(EffectNoiseReduction *effect, wxWindow &parent, bool bHasProfile, bool bAllowTwiddleSettings)
Definition: NoiseReduction.cpp:481
ID_FREQ_TEXT
@ ID_FREQ_TEXT
Definition: NoiseReduction.cpp:1403
anonymous_namespace{NoiseReduction.cpp}::reg
BuiltinEffectsModule::Registration< EffectNoiseReduction > reg
Definition: NoiseReduction.cpp:426
EffectNoiseReduction::Settings::mStepsPerWindowChoice
int mStepsPerWindowChoice
Definition: NoiseReduction.cpp:240
EffectClientInterface::EffectDialogFactory
std::function< wxDialog *(wxWindow &parent, EffectHostInterface *, EffectUIClientInterface *) > EffectDialogFactory
Definition: EffectInterface.h:149
ShuttleGuiBase::AddRadioButton
wxRadioButton * AddRadioButton(const TranslatableString &Prompt, int selector=0, int initValue=0)
Definition: ShuttleGui.cpp:561
InverseRealFFTf
void InverseRealFFTf(fft_type *buffer, const FFTParam *h)
Definition: RealFFTf.cpp:267
EffectNoiseReduction::Statistics::mSums
FloatVector mSums
Definition: NoiseReduction.cpp:191
EffectNoiseReduction::Worker::Statistics
EffectNoiseReduction::Statistics Statistics
Definition: NoiseReduction.cpp:259
EffectNoiseReduction::Process
bool Process() override
Definition: NoiseReduction.cpp:619
EffectNoiseReduction::Worker::mOneBlockAttack
float mOneBlockAttack
Definition: NoiseReduction.cpp:325
WaveTrack::Append
bool Append(constSamplePtr buffer, sampleFormat format, size_t len, unsigned int stride=1)
Append the sample data to the WaveTrack. You must call Flush() after the last Append.
Definition: WaveTrack.cpp:1541
EffectNoiseReduction::Dialog::OnReduceNoise
void OnReduceNoise(wxCommandEvent &event)
Definition: NoiseReduction.cpp:1697
EffectNoiseReduction::TrackProgress
bool TrackProgress(int whichTrack, double frac, const TranslatableString &={})
Definition: Effect.cpp:2024
Effect::mOutputTracks
std::shared_ptr< TrackList > mOutputTracks
Definition: Effect.h:464
ID_RADIOBUTTON_RESIDUE
@ ID_RADIOBUTTON_RESIDUE
Definition: NoiseReduction.cpp:1380
EffectNoiseReduction::Worker::ProcessOne
bool ProcessOne(EffectNoiseReduction &effect, Statistics &statistics, WaveTrackFactory &factory, int count, WaveTrack *track, sampleCount start, sampleCount len)
Definition: NoiseReduction.cpp:1308
NoiseReduction.h
anonymous_namespace{NoiseReduction.cpp}::PrefsTableEntry
Definition: NoiseReduction.cpp:501
EffectNoiseReduction::EffectNoiseReduction
EffectNoiseReduction()
Definition: NoiseReduction.cpp:428
WaveTrackFactory
Used to create or clone a WaveTrack, with appropriate context from the project that will own the trac...
Definition: WaveTrack.h:675
anonymous_namespace{NoiseReduction.cpp}::WT_HAMMING_HANN
@ WT_HAMMING_HANN
Definition: NoiseReduction.cpp:122
EffectNoiseReduction::Worker::mDoProfile
const bool mDoProfile
Definition: NoiseReduction.cpp:293
ShuttleGuiBase::AddButton
wxButton * AddButton(const TranslatableString &Text, int PositionFlags=wxALIGN_CENTRE, bool setDefault=false)
Definition: ShuttleGui.cpp:353
EffectNoiseReduction::Worker::Record::mSpectrums
FloatVector mSpectrums
Definition: NoiseReduction.cpp:344
LoadEffects.h
EffectNoiseReduction::Statistics::mRate
double mRate
Definition: NoiseReduction.cpp:185
ID_RADIOBUTTON_KEEPNOISE
@ ID_RADIOBUTTON_KEEPNOISE
Definition: NoiseRemoval.cpp:596
EffectNoiseReduction::Statistics::mTrackWindows
int mTrackWindows
Definition: NoiseReduction.cpp:190
ShuttleGuiBase::StartStatic
wxStaticBox * StartStatic(const TranslatableString &Str, int iProp=0)
Definition: ShuttleGui.cpp:886
EffectNoiseReduction::Settings::WindowSize
size_t WindowSize() const
Definition: NoiseReduction.cpp:217
anonymous_namespace{NoiseReduction.cpp}::PrefsTableEntry::name
const wxChar * name
Definition: NoiseReduction.cpp:505
EffectNoiseReduction::Worker::mInSampleCount
sampleCount mInSampleCount
Definition: NoiseReduction.cpp:321
WaveTrack::GetMaxBlockSize
size_t GetMaxBlockSize() const
Definition: WaveTrack.cpp:1578
min
int min(int a, int b)
Definition: CompareAudioCommand.cpp:106
EffectNoiseReduction::Worker
Definition: NoiseReduction.cpp:256
ShuttleGui::Name
ShuttleGui & Name(const TranslatableString &name)
Definition: ShuttleGui.h:670
wxDialogWrapper
Definition: wxPanelWrapper.h:81
EffectNoiseReduction::Worker::mFreqSmoothingBins
const size_t mFreqSmoothingBins
Definition: NoiseReduction.cpp:309
END_OF_BASIC_SLIDERS
@ END_OF_BASIC_SLIDERS
Definition: NoiseReduction.cpp:1405
Effect::mSampleRate
double mSampleRate
Definition: Effect.h:459
RESIDUE_CHOICE
#define RESIDUE_CHOICE
Definition: NoiseReduction.cpp:80
EffectNoiseReduction::Statistics::mWindowSize
size_t mWindowSize
Definition: NoiseReduction.cpp:186
EffectNoiseReduction::Worker::mInWaveBuffer
FloatVector mInWaveBuffer
Definition: NoiseReduction.cpp:301
ID_GAIN_TEXT
@ ID_GAIN_TEXT
Definition: NoiseReduction.cpp:1389
EffectNoiseReduction::Worker::mNoiseReductionChoice
const int mNoiseReductionChoice
Definition: NoiseReduction.cpp:314
FileConfig::Flush
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:151
anonymous_namespace{NoiseReduction.cpp}::discriminationMethodInfo
const struct anonymous_namespace{NoiseReduction.cpp}::DiscriminationMethodInfo discriminationMethodInfo[DM_N_METHODS]
anonymous_namespace{NoiseReduction.cpp}::WindowTypesInfo::productConstantTerm
double productConstantTerm
Definition: NoiseReduction.cpp:134
HelpSystem::ShowHelp
static void ShowHelp(wxWindow *parent, const wxString &localFileName, const wxString &remoteURL, bool bModal=false, bool alwaysDefaultBrowser=false)
Definition: HelpSystem.cpp:238
EffectNoiseReduction::Settings::PrefsIO
bool PrefsIO(bool read)
Definition: NoiseReduction.cpp:533
anonymous_namespace{NoiseReduction.cpp}::controlInfo
const ControlInfo * controlInfo()
Definition: NoiseReduction.cpp:1484
BuiltinEffectsModule::Registration
Definition: LoadEffects.h:40
EffectNoiseReduction::Worker::mOutStepCount
sampleCount mOutStepCount
Definition: NoiseReduction.cpp:322
EffectNoiseReduction::Worker::mFreqSmoothingScratch
FloatVector mFreqSmoothingScratch
Definition: NoiseReduction.cpp:308
EffectNoiseReduction::Worker::mFFTBuffer
FloatVector mFFTBuffer
Definition: NoiseReduction.cpp:300
EffectNoiseReduction::Settings::mWindowTypes
int mWindowTypes
Definition: NoiseReduction.cpp:238
EffectNoiseReduction::Worker::mHistoryLen
unsigned mHistoryLen
Definition: NoiseReduction.cpp:332
ID_NEW_SENSITIVITY_SLIDER
@ ID_NEW_SENSITIVITY_SLIDER
Definition: NoiseReduction.cpp:1391
EffectNoiseReduction::Dialog::OnCancel
void OnCancel(wxCommandEvent &event)
Definition: NoiseReduction.cpp:1705
sampleCount
Definition: Types.h:589
anonymous_namespace{NoiseReduction.cpp}::DM_MEDIAN
@ DM_MEDIAN
Definition: NoiseReduction.cpp:95
EffectNoiseReduction::Worker::Record::mGains
FloatVector mGains
Definition: NoiseReduction.cpp:345
EffectNoiseReduction::Settings::mNoiseGain
double mNoiseGain
Definition: NoiseReduction.cpp:227
anonymous_namespace{NoiseReduction.cpp}::WindowTypesInfo::minSteps
unsigned minSteps
Definition: NoiseReduction.cpp:131
anonymous_namespace{NoiseReduction.cpp}::ControlInfo::sliderName
const TranslatableString sliderName
Definition: NoiseReduction.cpp:1474
anonymous_namespace{NoiseReduction.cpp}::WT_RECTANGULAR_HANN
@ WT_RECTANGULAR_HANN
Definition: NoiseReduction.cpp:117
EffectNoiseReduction::Worker::mNWindowsToExamine
unsigned mNWindowsToExamine
Definition: NoiseReduction.cpp:330
EffectNoiseReduction::Settings::~Settings
~Settings()
Definition: NoiseReduction.cpp:210
HFFT
std::unique_ptr< FFTParam, FFTDeleter > HFFT
Definition: RealFFTf.h:26
EffectNoiseReduction::Settings::Validate
bool Validate(EffectNoiseReduction *effect) const
Definition: NoiseReduction.cpp:595
EffectNoiseReduction::Worker::RotateHistoryWindows
void RotateHistoryWindows()
Definition: NoiseReduction.cpp:1011
anonymous_namespace{NoiseReduction.cpp}::ControlInfo::textBoxCaption
const TranslatableString textBoxCaption
Definition: NoiseReduction.cpp:1473
TrapLong
long TrapLong(long x, long min, long max)
Definition: Effect.h:574
anonymous_namespace{NoiseReduction.cpp}::WindowTypesInfo
Definition: NoiseReduction.cpp:129
ID_RADIOBUTTON_KEEPSIGNAL
@ ID_RADIOBUTTON_KEEPSIGNAL
Definition: NoiseReduction.cpp:1375
M_PI
#define M_PI
Definition: Distortion.cpp:29
anonymous_namespace{NoiseReduction.cpp}::ControlInfo::field
MemberPointer field
Definition: NoiseReduction.cpp:1466
anonymous_namespace{NoiseReduction.cpp}::DM_DEFAULT_METHOD
@ DM_DEFAULT_METHOD
Definition: NoiseReduction.cpp:100
GetFFT
HFFT GetFFT(size_t fftlen)
Definition: RealFFTf.cpp:108
WaveTrack::GetBestBlockSize
size_t GetBestBlockSize(sampleCount t) const
Definition: WaveTrack.cpp:1560
EffectNoiseReduction::Dialog
Dialog used with EffectNoiseReduction.
Definition: NoiseReduction.cpp:364
EffectNoiseReduction::Dialog::PopulateOrExchange
void PopulateOrExchange(ShuttleGui &S) override
Definition: NoiseReduction.cpp:1715
anonymous_namespace{NoiseReduction.cpp}::WT_DEFAULT_WINDOW_TYPES
@ WT_DEFAULT_WINDOW_TYPES
Definition: NoiseReduction.cpp:126
EffectNoiseReduction::Settings::mNewSensitivity
double mNewSensitivity
Definition: NoiseReduction.cpp:225
ShuttleGuiBase::AddPrompt
void AddPrompt(const TranslatableString &Prompt, int wrapWidth=0)
Right aligned text string.
Definition: ShuttleGui.cpp:231
EffectNoiseReduction::Worker::Process
bool Process(EffectNoiseReduction &effect, Statistics &statistics, WaveTrackFactory &factory, TrackList &tracks, double mT0, double mT1)
Definition: NoiseReduction.cpp:670
EffectNoiseReduction::~EffectNoiseReduction
virtual ~EffectNoiseReduction()
Definition: NoiseReduction.cpp:434
EffectNoiseReduction::Settings::mFreqSmoothingBands
double mFreqSmoothingBands
Definition: NoiseReduction.cpp:226
ShuttleGuiBase::AddVariableText
wxStaticText * AddVariableText(const TranslatableString &Str, bool bCenter=false, int PositionFlags=0, int wrapWidth=0)
Definition: ShuttleGui.cpp:456
ID_FREQ_SLIDER
@ ID_FREQ_SLIDER
Definition: NoiseReduction.cpp:1402
EffectNoiseReduction::Dialog::mbAllowTwiddleSettings
bool mbAllowTwiddleSettings
Definition: NoiseReduction.cpp:408
EffectNoiseReduction::Worker::FillFirstHistoryWindow
void FillFirstHistoryWindow()
Definition: NoiseReduction.cpp:966
EffectNoiseReduction::Worker::~Worker
~Worker()
Definition: NoiseReduction.cpp:665
ShuttleGuiBase::EndStatic
void EndStatic()
Definition: ShuttleGui.cpp:915
EffectNoiseReduction::Dialog::OnPreview
void OnPreview(wxCommandEvent &event) override
Definition: NoiseReduction.cpp:1684
EffectNoiseReduction::mSettings
std::unique_ptr< Settings > mSettings
Definition: NoiseReduction.h:55
anonymous_namespace{NoiseReduction.cpp}::readPrefs
void readPrefs(StructureType *structure, const wxString &prefix, const PrefsTableEntry< StructureType, FieldType > *fields, int numFields)
Definition: NoiseReduction.cpp:510
EffectType
EffectType
Definition: EffectInterface.h:55
EffectManager.h
settings
static Settings & settings()
Definition: TrackInfo.cpp:87
EffectNoiseReduction::Worker::mOutWindow
FloatVector mOutWindow
Definition: NoiseReduction.cpp:305
ShuttleGuiBase::SetStretchyCol
void SetStretchyCol(int i)
Used to modify an already placed FlexGridSizer to make a column stretchy.
Definition: ShuttleGui.cpp:195
EffectNoiseReduction::mStatistics
std::unique_ptr< Statistics > mStatistics
Definition: NoiseReduction.h:56
EffectDialog::TransferDataFromWindow
bool TransferDataFromWindow() override
Definition: EffectUI.cpp:2091
EffectNoiseReduction::Dialog::mKeepSignal
wxRadioButton * mKeepSignal
Definition: NoiseReduction.cpp:411
EffectNoiseReduction::Worker::mInWavePos
int mInWavePos
Definition: NoiseReduction.cpp:323
EffectNoiseReduction::Worker::mOneBlockRelease
float mOneBlockRelease
Definition: NoiseReduction.cpp:326
TrackList::Selected
auto Selected() -> TrackIterRange< TrackType >
Definition: Track.h:1371
EffectNoiseReduction::Settings
Definition: NoiseReduction.cpp:207
END_EVENT_TABLE
END_EVENT_TABLE()
ShuttleGuiBase::TieChoice
wxChoice * TieChoice(const TranslatableString &Prompt, TranslatableString &Selected, const TranslatableStrings &choices)
Definition: ShuttleGui.cpp:1701
FIRST_SLIDER
@ FIRST_SLIDER
Definition: NoiseReduction.cpp:1417
anonymous_namespace{NoiseReduction.cpp}::WindowTypes
WindowTypes
Definition: NoiseReduction.cpp:116
EffectNoiseReduction::Dialog::mbHasProfile
bool mbHasProfile
Definition: NoiseReduction.cpp:407
ID_GAIN_SLIDER
@ ID_GAIN_SLIDER
Definition: NoiseReduction.cpp:1388
EffectNoiseReduction::Dialog::m_pEffect
EffectNoiseReduction * m_pEffect
Definition: NoiseReduction.cpp:403
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:638
EffectNoiseReduction::Dialog::mTempSettings
EffectNoiseReduction::Settings mTempSettings
Definition: NoiseReduction.cpp:405
anonymous_namespace{NoiseReduction.cpp}::ControlInfo::SliderSetting
long SliderSetting(double value) const
Definition: NoiseReduction.cpp:1432
anonymous_namespace{NoiseReduction.cpp}::ControlInfo::ControlInfo
ControlInfo(MemberPointer f, double vMin, double vMax, long sMax, const wxChar *fmt, bool fAsInt, const TranslatableString &caption, const TranslatableString &name)
Definition: NoiseReduction.cpp:1476
EffectNoiseReduction::Worker::mStepsPerWindow
const unsigned mStepsPerWindow
Definition: NoiseReduction.cpp:315
anonymous_namespace{NoiseReduction.cpp}::DM_SECOND_GREATEST
@ DM_SECOND_GREATEST
Definition: NoiseReduction.cpp:96
anonymous_namespace{NoiseReduction.cpp}::DEFAULT_WINDOW_SIZE_CHOICE
@ DEFAULT_WINDOW_SIZE_CHOICE
Definition: NoiseReduction.cpp:151
EffectNoiseReduction::Init
bool Init() override
Definition: NoiseReduction.cpp:457