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

#include <NoiseReductionBase.h>

Public Member Functions

 Settings ()
 
 ~Settings ()
 
bool PrefsIO (bool read)
 
bool Validate (NoiseReductionBase *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 47 of file NoiseReductionBase.h.

Constructor & Destructor Documentation

◆ Settings()

NoiseReductionBase::Settings::Settings ( )

Definition at line 179 of file NoiseReductionBase.cpp.

180 : mDoProfile { true }
181{
182 PrefsIO(true);
183}

References PrefsIO().

Here is the call graph for this function:

◆ ~Settings()

NoiseReductionBase::Settings::~Settings ( )
inline

Definition at line 51 of file NoiseReductionBase.h.

52 {
53 }

Member Function Documentation

◆ PrefsIO()

bool NoiseReductionBase::Settings::PrefsIO ( bool  read)

Definition at line 357 of file NoiseReductionBase.cpp.

358{
359 static const double DEFAULT_OLD_SENSITIVITY = 0.0;
360
361 static const PrefsTableEntry<Settings, double> doubleTable[] = {
362 { &Settings::mNewSensitivity, wxT("Sensitivity"), 6.0 },
363 { &Settings::mNoiseGain, wxT("Gain"), 6.0 },
364 { &Settings::mAttackTime, wxT("AttackTime"), 0.02 },
365 { &Settings::mReleaseTime, wxT("ReleaseTime"), 0.10 },
366 { &Settings::mFreqSmoothingBands, wxT("FreqSmoothing"), 6.0 },
367
368 // Advanced settings
369 { &Settings::mOldSensitivity, wxT("OldSensitivity"),
370 DEFAULT_OLD_SENSITIVITY },
371 };
372 static auto doubleTableSize = sizeof(doubleTable) / sizeof(doubleTable[0]);
373
374 static const PrefsTableEntry<Settings, int> intTable[] = {
375 { &Settings::mNoiseReductionChoice, wxT("ReductionChoice"),
377
378 // Advanced settings
380 { &Settings::mWindowSizeChoice, wxT("WindowSize"),
382 { &Settings::mStepsPerWindowChoice, wxT("StepsPerWindow"),
384 { &Settings::mMethod, wxT("Method"), DM_DEFAULT_METHOD },
385 };
386 static auto intTableSize = sizeof(intTable) / sizeof(intTable[0]);
387
388 static const wxString prefix(wxT("/Effects/NoiseReduction/"));
389
390 if (read)
391 {
392 readPrefs(this, prefix, doubleTable, doubleTableSize);
393 readPrefs(this, prefix, intTable, intTableSize);
394
395 // Ignore preferences for unavailable options.
396#if !(defined(RESIDUE_CHOICE) || defined(ISOLATE_CHOICE))
398#elif !(defined(RESIDUE_CHOICE))
401#elif !(defined(ISOLATE_CHOICE))
404#endif
405
406#ifndef ADVANCED_SETTINGS
407 // Initialize all hidden advanced settings to defaults.
412 mOldSensitivity = DEFAULT_OLD_SENSITIVITY;
413#endif
414
415#ifndef OLD_METHOD_AVAILABLE
416 if (mMethod == DM_OLD_METHOD)
418#endif
419
420 return true;
421 }
422 else
423 {
424 writePrefs(this, prefix, doubleTable, doubleTableSize);
425 writePrefs(this, prefix, intTable, intTableSize);
426 return gPrefs->Flush();
427 }
428}
wxT("CloseDown"))
@ NRC_REDUCE_NOISE
@ NRC_LEAVE_RESIDUE
@ NRC_ISOLATE_NOISE
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
virtual bool Flush() noexcept=0
void readPrefs(StructureType *structure, const wxString &prefix, const PrefsTableEntry< StructureType, FieldType > *fields, size_t numFields)
void writePrefs(const StructureType *structure, const wxString &prefix, const PrefsTableEntry< StructureType, FieldType > *fields, size_t numFields)

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

Referenced by Settings().

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

◆ SpectrumSize()

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

Definition at line 66 of file NoiseReductionBase.h.

67 {
68 return 1 + WindowSize() / 2;
69 }

◆ StepSize()

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

Definition at line 70 of file NoiseReductionBase.h.

71 {
72 return WindowSize() / StepsPerWindow();
73 }

Referenced by NoiseReductionBase::Worker::Worker().

Here is the caller graph for this function:

◆ StepsPerWindow()

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

Definition at line 62 of file NoiseReductionBase.h.

63 {
64 return 1u << (1 + mStepsPerWindowChoice);
65 }

Referenced by NoiseReductionBase::Worker::Worker().

Here is the caller graph for this function:

◆ Validate()

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

Definition at line 430 of file NoiseReductionBase.cpp.

431{
432 using namespace BasicUI;
434 {
435 ShowMessageBox(XO("Steps per block are too few for the window types."));
436 return false;
437 }
438
439 if (StepsPerWindow() > WindowSize())
440 {
441 ShowMessageBox(XO("Steps per block cannot exceed the window size."));
442 return false;
443 }
444
445 if (mMethod == DM_MEDIAN && StepsPerWindow() > 4)
446 {
448 "Median method is not implemented for more than four steps per window."));
449 return false;
450 }
451
452 return true;
453}
XO("Cut/Copy/Paste")
MessageBoxResult ShowMessageBox(const TranslatableString &message, MessageBoxOptions options={})
Show a modal message box with either Ok or Yes and No, and optionally Cancel.
Definition: BasicUI.h:287
const struct anonymous_namespace{NoiseReductionBase.cpp}::WindowTypesInfo windowTypesInfo[WT_N_WINDOW_TYPES]

References anonymous_namespace{NoiseReductionBase.cpp}::DM_MEDIAN, BasicUI::ShowMessageBox(), anonymous_namespace{NoiseReductionBase.cpp}::windowTypesInfo, and XO().

Here is the call graph for this function:

◆ WindowSize()

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

Definition at line 58 of file NoiseReductionBase.h.

59 {
60 return 1u << (3 + mWindowSizeChoice);
61 }

Member Data Documentation

◆ mAttackTime

double NoiseReductionBase::Settings::mAttackTime

◆ mDoProfile

bool NoiseReductionBase::Settings::mDoProfile

Definition at line 75 of file NoiseReductionBase.h.

◆ mFreqSmoothingBands

double NoiseReductionBase::Settings::mFreqSmoothingBands

◆ mMethod

int NoiseReductionBase::Settings::mMethod

Definition at line 96 of file NoiseReductionBase.h.

Referenced by PrefsIO().

◆ mNewSensitivity

double NoiseReductionBase::Settings::mNewSensitivity

◆ mNoiseGain

double NoiseReductionBase::Settings::mNoiseGain

◆ mNoiseReductionChoice

int NoiseReductionBase::Settings::mNoiseReductionChoice

Definition at line 90 of file NoiseReductionBase.h.

Referenced by PrefsIO().

◆ mOldSensitivity

double NoiseReductionBase::Settings::mOldSensitivity

◆ mReleaseTime

double NoiseReductionBase::Settings::mReleaseTime

◆ mStepsPerWindowChoice

int NoiseReductionBase::Settings::mStepsPerWindowChoice

Definition at line 95 of file NoiseReductionBase.h.

Referenced by PrefsIO().

◆ mWindowSizeChoice

int NoiseReductionBase::Settings::mWindowSizeChoice

Definition at line 94 of file NoiseReductionBase.h.

Referenced by PrefsIO().

◆ mWindowTypes

int NoiseReductionBase::Settings::mWindowTypes

Definition at line 93 of file NoiseReductionBase.h.

Referenced by PrefsIO().


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