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
 
size_t SpectrumSize () const
 
size_t StepSize () 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 248 of file NoiseReduction.cpp.

249 : mDoProfile{ true }
250{
251 PrefsIO(true);
252}

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 535 of file NoiseReduction.cpp.

536{
537 static const double DEFAULT_OLD_SENSITIVITY = 0.0;
538
539 static const PrefsTableEntry<Settings, double> doubleTable[] = {
540 { &Settings::mNewSensitivity, wxT("Sensitivity"), 6.0 },
541 { &Settings::mNoiseGain, wxT("Gain"), 6.0 },
542 { &Settings::mAttackTime, wxT("AttackTime"), 0.02 },
543 { &Settings::mReleaseTime, wxT("ReleaseTime"), 0.10 },
544 { &Settings::mFreqSmoothingBands, wxT("FreqSmoothing"), 6.0 },
545
546 // Advanced settings
547 { &Settings::mOldSensitivity, wxT("OldSensitivity"), DEFAULT_OLD_SENSITIVITY },
548 };
549 static auto doubleTableSize = sizeof(doubleTable) / sizeof(doubleTable[0]);
550
551 static const PrefsTableEntry<Settings, int> intTable[] = {
552 { &Settings::mNoiseReductionChoice, wxT("ReductionChoice"), NRC_REDUCE_NOISE },
553
554 // Advanced settings
558 { &Settings::mMethod, wxT("Method"), DM_DEFAULT_METHOD },
559 };
560 static auto intTableSize = sizeof(intTable) / sizeof(intTable[0]);
561
562 static const wxString prefix(wxT("/Effects/NoiseReduction/"));
563
564 if (read) {
565 readPrefs(this, prefix, doubleTable, doubleTableSize);
566 readPrefs(this, prefix, intTable, intTableSize);
567
568 // Ignore preferences for unavailable options.
569#if !(defined(RESIDUE_CHOICE) || defined (ISOLATE_CHOICE))
571#elif !(defined(RESIDUE_CHOICE))
574#elif !(defined(ISOLATE_CHOICE))
577#endif
578
579#ifndef ADVANCED_SETTINGS
580 // Initialize all hidden advanced settings to defaults.
585 mOldSensitivity = DEFAULT_OLD_SENSITIVITY;
586#endif
587
588#ifndef OLD_METHOD_AVAILABLE
589 if (mMethod == DM_OLD_METHOD)
591#endif
592
593 return true;
594 }
595 else {
596 writePrefs(this, prefix, doubleTable, doubleTableSize);
597 writePrefs(this, prefix, intTable, intTableSize);
598 return gPrefs->Flush();
599 }
600}
wxT("CloseDown"))
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
virtual bool Flush() noexcept=0
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, audacity::BasicSettings::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(), anonymous_namespace{NoiseReduction.cpp}::WT_DEFAULT_WINDOW_TYPES, and wxT().

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 479 of file NoiseReduction.cpp.

482{
483 EffectNoiseReduction::Dialog dlog(effect, access,
484 this, &parent, bHasProfile, bAllowTwiddleSettings);
485
486 dlog.CentreOnParent();
487 dlog.ShowModal();
488
489 const auto returnCode = dlog.GetReturnCode();
490 if (!returnCode)
491 return 0;
492
493 *this = dlog.GetTempSettings();
494 mDoProfile = (returnCode == 1);
495
496 if (!PrefsIO(false))
497 return 0;
498 return returnCode;
499}
Dialog used with EffectNoiseReduction.

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

Here is the call graph for this function:

◆ SpectrumSize()

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

Definition at line 221 of file NoiseReduction.cpp.

221{ return 1 + WindowSize() / 2; }

References WindowSize().

Here is the call graph for this function:

◆ StepSize()

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

Definition at line 222 of file NoiseReduction.cpp.

222{ return WindowSize() / StepsPerWindow(); }

References StepsPerWindow(), and WindowSize().

Referenced by EffectNoiseReduction::Worker::Worker().

Here is the call graph for this function:
Here is the caller 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.

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

Here is the caller graph for this function:

◆ Validate()

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

Definition at line 602 of file NoiseReduction.cpp.

603{
604 if (StepsPerWindow() < windowTypesInfo[mWindowTypes].minSteps) {
606 XO("Steps per block are too few for the window types.") );
607 return false;
608 }
609
610 if (StepsPerWindow() > WindowSize()) {
612 XO("Steps per block cannot exceed the window size.") );
613 return false;
614 }
615
616 if (mMethod == DM_MEDIAN && StepsPerWindow() > 4) {
618 XO(
619"Median method is not implemented for more than four steps per window.") );
620 return false;
621 }
622
623 return true;
624}
XO("Cut/Copy/Paste")
static int DoMessageBox(const EffectPlugin &plugin, const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
const struct anonymous_namespace{NoiseReduction.cpp}::WindowTypesInfo windowTypesInfo[WT_N_WINDOW_TYPES]

References anonymous_namespace{NoiseReduction.cpp}::DM_MEDIAN, EffectUIServices::DoMessageBox(), anonymous_namespace{NoiseReduction.cpp}::windowTypesInfo, and XO().

Here is the call graph for this function:

◆ WindowSize()

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

Definition at line 219 of file NoiseReduction.cpp.

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

References mWindowSizeChoice.

Referenced by SpectrumSize(), and StepSize().

Here is the caller graph for this function:

Member Data Documentation

◆ mAttackTime

double EffectNoiseReduction::Settings::mAttackTime

◆ mDoProfile

bool EffectNoiseReduction::Settings::mDoProfile

Definition at line 224 of file NoiseReduction.cpp.

Referenced by PromptUser().

◆ mFreqSmoothingBands

double EffectNoiseReduction::Settings::mFreqSmoothingBands

◆ mMethod

int EffectNoiseReduction::Settings::mMethod

Definition at line 245 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 239 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 244 of file NoiseReduction.cpp.

Referenced by PrefsIO(), and StepsPerWindow().

◆ mWindowSizeChoice

int EffectNoiseReduction::Settings::mWindowSizeChoice

Definition at line 243 of file NoiseReduction.cpp.

Referenced by PrefsIO(), and WindowSize().

◆ mWindowTypes

int EffectNoiseReduction::Settings::mWindowTypes

Definition at line 242 of file NoiseReduction.cpp.

Referenced by PrefsIO().


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