Audacity  2.2.2
Public Member Functions | Public Attributes | List of all members
EffectNoiseReduction::Settings Class Reference

Public Member Functions

 Settings ()
 
 ~Settings ()
 
bool PromptUser (EffectNoiseReduction *effect, wxWindow *parent, bool bHasProfile, bool bAllowTwiddleSettings)
 
bool PrefsIO (bool read)
 
bool Validate (EffectNoiseReduction *effect) const
 
size_t WindowSize () const
 
unsigned StepsPerWindow () const
 

Public Attributes

bool mDoProfile
 
double mNewSensitivity
 
double mFreqSmoothingBands
 
double mNoiseGain
 
double mAttackTime
 
double mReleaseTime
 
double mOldSensitivity
 
int mNoiseReductionChoice
 
int mWindowTypes
 
int mWindowSizeChoice
 
int mStepsPerWindowChoice
 
int mMethod
 

Detailed Description

Definition at line 203 of file NoiseReduction.cpp.

Constructor & Destructor Documentation

EffectNoiseReduction::Settings::Settings ( )

Definition at line 241 of file NoiseReduction.cpp.

References PrefsIO().

242  : mDoProfile(true)
243 {
244  PrefsIO(true);
245 }
EffectNoiseReduction::Settings::~Settings ( )
inline

Definition at line 207 of file NoiseReduction.cpp.

207 {}

Member Function Documentation

bool EffectNoiseReduction::Settings::PrefsIO ( bool  read)

Definition at line 521 of file NoiseReduction.cpp.

References gPrefs, mAttackTime, mFreqSmoothingBands, mMethod, mNewSensitivity, mNoiseGain, mNoiseReductionChoice, mOldSensitivity, mReleaseTime, mStepsPerWindowChoice, mWindowSizeChoice, and mWindowTypes.

Referenced by Settings().

522 {
523  static const double DEFAULT_OLD_SENSITIVITY = 0.0;
524 
525  static const PrefsTableEntry<Settings, double> doubleTable[] = {
526  { &Settings::mNewSensitivity, wxT("Sensitivity"), 6.0 },
527  { &Settings::mNoiseGain, wxT("Gain"), 12.0 },
528  { &Settings::mAttackTime, wxT("AttackTime"), 0.02 },
529  { &Settings::mReleaseTime, wxT("ReleaseTime"), 0.10 },
530  { &Settings::mFreqSmoothingBands, wxT("FreqSmoothing"), 3.0 },
531 
532  // Advanced settings
533  { &Settings::mOldSensitivity, wxT("OldSensitivity"), DEFAULT_OLD_SENSITIVITY },
534  };
535  static int doubleTableSize = sizeof(doubleTable) / sizeof(doubleTable[0]);
536 
537  static const PrefsTableEntry<Settings, int> intTable[] = {
538  { &Settings::mNoiseReductionChoice, wxT("ReductionChoice"), NRC_REDUCE_NOISE },
539 
540  // Advanced settings
541  { &Settings::mWindowTypes, wxT("WindowTypes"), WT_DEFAULT_WINDOW_TYPES },
542  { &Settings::mWindowSizeChoice, wxT("WindowSize"), DEFAULT_WINDOW_SIZE_CHOICE },
543  { &Settings::mStepsPerWindowChoice, wxT("StepsPerWindow"), DEFAULT_STEPS_PER_WINDOW_CHOICE },
544  { &Settings::mMethod, wxT("Method"), DM_DEFAULT_METHOD },
545  };
546  static int intTableSize = sizeof(intTable) / sizeof(intTable[0]);
547 
548  static const wxString prefix(wxT("/Effects/NoiseReduction/"));
549 
550  if (read) {
551  readPrefs(this, prefix, doubleTable, doubleTableSize);
552  readPrefs(this, prefix, intTable, intTableSize);
553 
554  // Ignore preferences for unavailable options.
555 #ifndef RESIDUE_CHOICE
556  if (mNoiseReductionChoice == NRC_LEAVE_RESIDUE)
557  mNoiseReductionChoice = NRC_ISOLATE_NOISE;
558 #endif
559 
560 #ifndef ADVANCED_SETTINGS
561  // Initialize all hidden advanced settings to defaults.
562  mWindowTypes = WT_DEFAULT_WINDOW_TYPES;
563  mWindowSizeChoice = DEFAULT_WINDOW_SIZE_CHOICE;
564  mStepsPerWindowChoice = DEFAULT_STEPS_PER_WINDOW_CHOICE;
565  mMethod = DM_DEFAULT_METHOD;
566  mOldSensitivity = DEFAULT_OLD_SENSITIVITY;
567 #endif
568 
569 #ifndef OLD_METHOD_AVAILABLE
570  if (mMethod == DM_OLD_METHOD)
571  mMethod = DM_DEFAULT_METHOD;
572 #endif
573 
574  return true;
575  }
576  else {
577  writePrefs(this, prefix, doubleTable, doubleTableSize);
578  writePrefs(this, prefix, intTable, intTableSize);
579  return gPrefs->Flush();
580  }
581 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
bool EffectNoiseReduction::Settings::PromptUser ( EffectNoiseReduction effect,
wxWindow *  parent,
bool  bHasProfile,
bool  bAllowTwiddleSettings 
)

Definition at line 469 of file NoiseReduction.cpp.

References EffectNoiseReduction::Dialog::GetTempSettings().

471 {
473  (effect, this, parent, bHasProfile, bAllowTwiddleSettings);
474 
475  dlog.CentreOnParent();
476  dlog.ShowModal();
477 
478  if (dlog.GetReturnCode() == 0)
479  return false;
480 
481  *this = dlog.GetTempSettings();
482  mDoProfile = (dlog.GetReturnCode() == 1);
483 
484  return PrefsIO(false);
485 }
Dialog used with EffectNoiseReduction.
unsigned EffectNoiseReduction::Settings::StepsPerWindow ( ) const
inline

Definition at line 215 of file NoiseReduction.cpp.

References mStepsPerWindowChoice.

215 { return 1u << (1 + mStepsPerWindowChoice); }
bool EffectNoiseReduction::Settings::Validate ( EffectNoiseReduction effect) const

Definition at line 583 of file NoiseReduction.cpp.

References _().

584 {
585  if (StepsPerWindow() < windowTypesInfo[mWindowTypes].minSteps) {
586  effect->Effect::MessageBox(_("Steps per block are too few for the window types."));
587  return false;
588  }
589 
590  if (StepsPerWindow() > WindowSize()) {
591  effect->Effect::MessageBox(_("Steps per block cannot exceed the window size."));
592  return false;
593  }
594 
595  if (mMethod == DM_MEDIAN && StepsPerWindow() > 4) {
596  effect->Effect::MessageBox(_("Median method is not implemented for more than four steps per window."));
597  return false;
598  }
599 
600  return true;
601 }
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
size_t EffectNoiseReduction::Settings::WindowSize ( ) const
inline

Definition at line 214 of file NoiseReduction.cpp.

References mWindowSizeChoice.

214 { return 1u << (3 + mWindowSizeChoice); }

Member Data Documentation

double EffectNoiseReduction::Settings::mAttackTime

Definition at line 225 of file NoiseReduction.cpp.

Referenced by PrefsIO(), and EffectNoiseReduction::Worker::Worker().

bool EffectNoiseReduction::Settings::mDoProfile

Definition at line 217 of file NoiseReduction.cpp.

double EffectNoiseReduction::Settings::mFreqSmoothingBands

Definition at line 223 of file NoiseReduction.cpp.

Referenced by PrefsIO().

int EffectNoiseReduction::Settings::mMethod

Definition at line 238 of file NoiseReduction.cpp.

Referenced by PrefsIO().

double EffectNoiseReduction::Settings::mNewSensitivity

Definition at line 222 of file NoiseReduction.cpp.

Referenced by PrefsIO().

double EffectNoiseReduction::Settings::mNoiseGain

Definition at line 224 of file NoiseReduction.cpp.

Referenced by PrefsIO(), and EffectNoiseReduction::Worker::Worker().

int EffectNoiseReduction::Settings::mNoiseReductionChoice

Definition at line 232 of file NoiseReduction.cpp.

Referenced by PrefsIO().

double EffectNoiseReduction::Settings::mOldSensitivity

Definition at line 229 of file NoiseReduction.cpp.

Referenced by PrefsIO(), and EffectNoiseReduction::Worker::Worker().

double EffectNoiseReduction::Settings::mReleaseTime

Definition at line 226 of file NoiseReduction.cpp.

Referenced by PrefsIO(), and EffectNoiseReduction::Worker::Worker().

int EffectNoiseReduction::Settings::mStepsPerWindowChoice

Definition at line 237 of file NoiseReduction.cpp.

Referenced by PrefsIO(), and StepsPerWindow().

int EffectNoiseReduction::Settings::mWindowSizeChoice

Definition at line 236 of file NoiseReduction.cpp.

Referenced by PrefsIO(), and WindowSize().

int EffectNoiseReduction::Settings::mWindowTypes

Definition at line 235 of file NoiseReduction.cpp.

Referenced by PrefsIO(), and EffectNoiseReduction::Worker::Worker().


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