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

Public Member Functions

 Settings ()
 
 ~Settings ()
 
int PromptUser (EffectNoiseReduction *effect, EffectSettingsAccess &access, 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 208 of file NoiseReduction.cpp.

Constructor & Destructor Documentation

◆ Settings()

EffectNoiseReduction::Settings::Settings ( )

Definition at line 246 of file NoiseReduction.cpp.

247 : mDoProfile{ true }
248{
249 PrefsIO(true);
250}

References PrefsIO().

Here is the call graph for this function:

◆ ~Settings()

EffectNoiseReduction::Settings::~Settings ( )
inline

Definition at line 212 of file NoiseReduction.cpp.

212{}

Member Function Documentation

◆ PrefsIO()

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

Definition at line 522 of file NoiseReduction.cpp.

523{
524 static const double DEFAULT_OLD_SENSITIVITY = 0.0;
525
526 static const PrefsTableEntry<Settings, double> doubleTable[] = {
527 { &Settings::mNewSensitivity, wxT("Sensitivity"), 6.0 },
528 { &Settings::mNoiseGain, wxT("Gain"), 12.0 },
529 { &Settings::mAttackTime, wxT("AttackTime"), 0.02 },
530 { &Settings::mReleaseTime, wxT("ReleaseTime"), 0.10 },
531 { &Settings::mFreqSmoothingBands, wxT("FreqSmoothing"), 3.0 },
532
533 // Advanced settings
534 { &Settings::mOldSensitivity, wxT("OldSensitivity"), DEFAULT_OLD_SENSITIVITY },
535 };
536 static auto doubleTableSize = sizeof(doubleTable) / sizeof(doubleTable[0]);
537
538 static const PrefsTableEntry<Settings, int> intTable[] = {
539 { &Settings::mNoiseReductionChoice, wxT("ReductionChoice"), NRC_REDUCE_NOISE },
540
541 // Advanced settings
542 { &Settings::mWindowTypes, wxT("WindowTypes"), WT_DEFAULT_WINDOW_TYPES },
545 { &Settings::mMethod, wxT("Method"), DM_DEFAULT_METHOD },
546 };
547 static auto intTableSize = sizeof(intTable) / sizeof(intTable[0]);
548
549 static const wxString prefix(wxT("/Effects/NoiseReduction/"));
550
551 if (read) {
552 readPrefs(this, prefix, doubleTable, doubleTableSize);
553 readPrefs(this, prefix, intTable, intTableSize);
554
555 // Ignore preferences for unavailable options.
556#if !(defined(RESIDUE_CHOICE) || defined (ISOLATE_CHOICE))
558#elif !(defined(RESIDUE_CHOICE))
561#elif !(defined(ISOLATE_CHOICE))
564#endif
565
566#ifndef ADVANCED_SETTINGS
567 // Initialize all hidden advanced settings to defaults.
572 mOldSensitivity = DEFAULT_OLD_SENSITIVITY;
573#endif
574
575#ifndef OLD_METHOD_AVAILABLE
576 if (mMethod == DM_OLD_METHOD)
578#endif
579
580 return true;
581 }
582 else {
583 writePrefs(this, prefix, doubleTable, doubleTableSize);
584 writePrefs(this, prefix, intTable, intTableSize);
585 return gPrefs->Flush();
586 }
587}
FileConfig * gPrefs
Definition: Prefs.cpp:71
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:143
void writePrefs(const StructureType *structure, const wxString &prefix, const PrefsTableEntry< StructureType, FieldType > *fields, size_t numFields)
void readPrefs(StructureType *structure, const wxString &prefix, const PrefsTableEntry< StructureType, FieldType > *fields, size_t numFields)

References anonymous_namespace{NoiseReduction.cpp}::DEFAULT_STEPS_PER_WINDOW_CHOICE, anonymous_namespace{NoiseReduction.cpp}::DEFAULT_WINDOW_SIZE_CHOICE, anonymous_namespace{NoiseReduction.cpp}::DM_DEFAULT_METHOD, anonymous_namespace{NoiseReduction.cpp}::DM_OLD_METHOD, FileConfig::Flush(), gPrefs, mAttackTime, mFreqSmoothingBands, mMethod, mNewSensitivity, mNoiseGain, mNoiseReductionChoice, mOldSensitivity, mReleaseTime, mStepsPerWindowChoice, mWindowSizeChoice, mWindowTypes, anonymous_namespace{NoiseReduction.cpp}::NRC_ISOLATE_NOISE, anonymous_namespace{NoiseReduction.cpp}::NRC_LEAVE_RESIDUE, anonymous_namespace{NoiseReduction.cpp}::NRC_REDUCE_NOISE, anonymous_namespace{NoiseReduction.cpp}::readPrefs(), anonymous_namespace{NoiseReduction.cpp}::writePrefs(), and anonymous_namespace{NoiseReduction.cpp}::WT_DEFAULT_WINDOW_TYPES.

Referenced by PromptUser(), and Settings().

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

◆ PromptUser()

int EffectNoiseReduction::Settings::PromptUser ( EffectNoiseReduction effect,
EffectSettingsAccess access,
wxWindow &  parent,
bool  bHasProfile,
bool  bAllowTwiddleSettings 
)

Definition at line 466 of file NoiseReduction.cpp.

469{
470 EffectNoiseReduction::Dialog dlog(effect, access,
471 this, &parent, bHasProfile, bAllowTwiddleSettings);
472
473 dlog.CentreOnParent();
474 dlog.ShowModal();
475
476 const auto returnCode = dlog.GetReturnCode();
477 if (!returnCode)
478 return 0;
479
480 *this = dlog.GetTempSettings();
481 mDoProfile = (returnCode == 1);
482
483 if (!PrefsIO(false))
484 return 0;
485 return returnCode;
486}
Dialog used with EffectNoiseReduction.

References EffectNoiseReduction::Dialog::GetTempSettings(), mDoProfile, and PrefsIO().

Here is the call graph for this function:

◆ StepsPerWindow()

unsigned EffectNoiseReduction::Settings::StepsPerWindow ( ) const
inline

Definition at line 220 of file NoiseReduction.cpp.

220{ return 1u << (1 + mStepsPerWindowChoice); }

References mStepsPerWindowChoice.

◆ Validate()

bool EffectNoiseReduction::Settings::Validate ( EffectNoiseReduction effect) const

Definition at line 589 of file NoiseReduction.cpp.

590{
591 if (StepsPerWindow() < windowTypesInfo[mWindowTypes].minSteps) {
592 effect->Effect::MessageBox(
593 XO("Steps per block are too few for the window types.") );
594 return false;
595 }
596
597 if (StepsPerWindow() > WindowSize()) {
598 effect->Effect::MessageBox(
599 XO("Steps per block cannot exceed the window size.") );
600 return false;
601 }
602
603 if (mMethod == DM_MEDIAN && StepsPerWindow() > 4) {
604 effect->Effect::MessageBox(
605 XO(
606"Median method is not implemented for more than four steps per window.") );
607 return false;
608 }
609
610 return true;
611}
#define XO(s)
Definition: Internat.h:31
const struct anonymous_namespace{NoiseReduction.cpp}::WindowTypesInfo windowTypesInfo[WT_N_WINDOW_TYPES]

References anonymous_namespace{NoiseReduction.cpp}::DM_MEDIAN, anonymous_namespace{NoiseReduction.cpp}::windowTypesInfo, and XO.

◆ WindowSize()

size_t EffectNoiseReduction::Settings::WindowSize ( ) const
inline

Definition at line 219 of file NoiseReduction.cpp.

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

References mWindowSizeChoice.

Member Data Documentation

◆ mAttackTime

double EffectNoiseReduction::Settings::mAttackTime

◆ mDoProfile

bool EffectNoiseReduction::Settings::mDoProfile

Definition at line 222 of file NoiseReduction.cpp.

Referenced by PromptUser().

◆ mFreqSmoothingBands

double EffectNoiseReduction::Settings::mFreqSmoothingBands

◆ mMethod

int EffectNoiseReduction::Settings::mMethod

Definition at line 243 of file NoiseReduction.cpp.

Referenced by PrefsIO().

◆ mNewSensitivity

double EffectNoiseReduction::Settings::mNewSensitivity

◆ mNoiseGain

double EffectNoiseReduction::Settings::mNoiseGain

◆ mNoiseReductionChoice

int EffectNoiseReduction::Settings::mNoiseReductionChoice

Definition at line 237 of file NoiseReduction.cpp.

Referenced by PrefsIO().

◆ mOldSensitivity

double EffectNoiseReduction::Settings::mOldSensitivity

◆ mReleaseTime

double EffectNoiseReduction::Settings::mReleaseTime

◆ mStepsPerWindowChoice

int EffectNoiseReduction::Settings::mStepsPerWindowChoice

Definition at line 242 of file NoiseReduction.cpp.

Referenced by PrefsIO(), and StepsPerWindow().

◆ mWindowSizeChoice

int EffectNoiseReduction::Settings::mWindowSizeChoice

Definition at line 241 of file NoiseReduction.cpp.

Referenced by PrefsIO(), and WindowSize().

◆ mWindowTypes

int EffectNoiseReduction::Settings::mWindowTypes

Definition at line 240 of file NoiseReduction.cpp.

Referenced by PrefsIO().


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