| 342 | } // namespace |
| 343 | |
| 344 | bool NoiseReductionBase::Settings::PrefsIO(bool read) |
| 345 | { |
| 346 | static const double DEFAULT_OLD_SENSITIVITY = 0.0; |
| 347 | |
| 348 | static const PrefsTableEntry<Settings, double> doubleTable[] = { |
| 349 | { &Settings::mNewSensitivity, wxT("Sensitivity"), 6.0 }, |
| 350 | { &Settings::mNoiseGain, wxT("Gain"), 6.0 }, |
| 351 | { &Settings::mAttackTime, wxT("AttackTime"), 0.02 }, |
| 352 | { &Settings::mReleaseTime, wxT("ReleaseTime"), 0.10 }, |
| 353 | { &Settings::mFreqSmoothingBands, wxT("FreqSmoothing"), 6.0 }, |
| 354 | |
| 355 | // Advanced settings |
| 356 | { &Settings::mOldSensitivity, wxT("OldSensitivity"), |
| 357 | DEFAULT_OLD_SENSITIVITY }, |
| 358 | }; |
| 359 | static auto doubleTableSize = sizeof(doubleTable) / sizeof(doubleTable[0]); |
| 360 | |
| 361 | static const PrefsTableEntry<Settings, int> intTable[] = { |
| 362 | { &Settings::mNoiseReductionChoice, wxT("ReductionChoice"), |
| 363 | NRC_REDUCE_NOISE }, |
| 364 | |
| 365 | // Advanced settings |
| 366 | { &Settings::mWindowTypes, wxT("WindowTypes"), WT_DEFAULT_WINDOW_TYPES }, |
| 367 | { &Settings::mWindowSizeChoice, wxT("WindowSize"), |
| 368 | DEFAULT_WINDOW_SIZE_CHOICE }, |
| 369 | { &Settings::mStepsPerWindowChoice, wxT("StepsPerWindow"), |
| 370 | DEFAULT_STEPS_PER_WINDOW_CHOICE }, |
| 371 | { &Settings::mMethod, wxT("Method"), DM_DEFAULT_METHOD }, |
| 372 | }; |
| 373 | static auto intTableSize = sizeof(intTable) / sizeof(intTable[0]); |
| 374 | |
| 375 | static const wxString prefix(wxT("/Effects/NoiseReduction/")); |
| 376 | |
| 377 | if (read) |
| 378 | { |
| 379 | readPrefs(this, prefix, doubleTable, doubleTableSize); |
| 380 | readPrefs(this, prefix, intTable, intTableSize); |
| 381 | |
| 382 | // Ignore preferences for unavailable options. |
| 383 | #if !(defined(RESIDUE_CHOICE) || defined(ISOLATE_CHOICE)) |
| 384 | mNoiseReductionChoice == NRC_REDUCE_NOISE; |
| 385 | #elif !(defined(RESIDUE_CHOICE)) |
| 386 | if (mNoiseReductionChoice == NRC_LEAVE_RESIDUE) |
| 387 | mNoiseReductionChoice = NRC_ISOLATE_NOISE; |
| 388 | #elif !(defined(ISOLATE_CHOICE)) |
| 389 | if (mNoiseReductionChoice == NRC_ISOLATE_NOISE) |
| 390 | mNoiseReductionChoice = NRC_LEAVE_RESIDUE; |
| 391 | #endif |
| 392 | |
| 393 | #ifndef ADVANCED_SETTINGS |
| 394 | // Initialize all hidden advanced settings to defaults. |
| 395 | mWindowTypes = WT_DEFAULT_WINDOW_TYPES; |
| 396 | mWindowSizeChoice = DEFAULT_WINDOW_SIZE_CHOICE; |
| 397 | mStepsPerWindowChoice = DEFAULT_STEPS_PER_WINDOW_CHOICE; |
| 398 | mMethod = DM_DEFAULT_METHOD; |
| 399 | mOldSensitivity = DEFAULT_OLD_SENSITIVITY; |
| 400 | #endif |
| 401 |
no test coverage detected