mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 08:09:32 +02:00
Bug 2480 - Vertical Scale dB does not update when Meter range is changed in Prefs
This commit is contained in:
parent
2437aa15be
commit
238bb952ef
@ -327,6 +327,103 @@ void SpectrogramSettings::SavePrefs()
|
||||
#endif //EXPERIMENTAL_FIND_NOTES
|
||||
}
|
||||
|
||||
// This is a temporary hack until SpectrogramSettings gets fully integrated
|
||||
void SpectrogramSettings::UpdatePrefs()
|
||||
{
|
||||
if (minFreq == defaults().minFreq) {
|
||||
gPrefs->Read(wxT("/Spectrum/MinFreq"), &minFreq);
|
||||
}
|
||||
|
||||
if (maxFreq == defaults().maxFreq) {
|
||||
gPrefs->Read(wxT("/Spectrum/MaxFreq"), &maxFreq);
|
||||
}
|
||||
|
||||
if (range == defaults().range) {
|
||||
gPrefs->Read(wxT("/Spectrum/Range"), &range);
|
||||
}
|
||||
|
||||
if (gain == defaults().gain) {
|
||||
gPrefs->Read(wxT("/Spectrum/Gain"), &gain);
|
||||
}
|
||||
|
||||
if (frequencyGain == defaults().frequencyGain) {
|
||||
gPrefs->Read(wxT("/Spectrum/FrequencyGain"), &frequencyGain);
|
||||
}
|
||||
|
||||
if (windowSize == defaults().windowSize) {
|
||||
gPrefs->Read(wxT("/Spectrum/FFTSize"), &windowSize);
|
||||
}
|
||||
|
||||
#ifdef EXPERIMENTAL_ZERO_PADDED_SPECTROGRAMS
|
||||
if (zeroPaddingFactor == defaults().zeroPaddingFactor) {
|
||||
gPrefs->Read(wxT("/Spectrum/ZeroPaddingFactor"), &zeroPaddingFactor);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (windowType == defaults().windowType) {
|
||||
gPrefs->Read(wxT("/Spectrum/WindowType"), &windowType);
|
||||
}
|
||||
|
||||
if (isGrayscale == defaults().isGrayscale) {
|
||||
int temp;
|
||||
gPrefs->Read(wxT("/Spectrum/Grayscale"), &temp);
|
||||
isGrayscale = (temp != 0);
|
||||
}
|
||||
|
||||
if (scaleType == defaults().scaleType) {
|
||||
int temp;
|
||||
gPrefs->Read(wxT("/Spectrum/ScaleType"), &temp);
|
||||
scaleType = ScaleType(temp);
|
||||
}
|
||||
|
||||
#ifndef SPECTRAL_SELECTION_GLOBAL_SWITCH
|
||||
if (spectralSelection == defaults().spectralSelection) {
|
||||
int temp;
|
||||
gPrefs->Read(wxT("/Spectrum/EnableSpectralSelection"), &temp);
|
||||
spectralSelection = (temp != 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (algorithm == defaults().algorithm) {
|
||||
int temp;
|
||||
gPrefs->Read(wxT("/Spectrum/Algorithm"), &temp);
|
||||
algorithm = Algorithm(temp);
|
||||
}
|
||||
|
||||
#ifdef EXPERIMENTAL_FFT_Y_GRID
|
||||
if (fftYGrid == defaults().fftYGrid) {
|
||||
int temp;
|
||||
gPrefs->Read(wxT("/Spectrum/FFTYGrid"), &temp);
|
||||
fftYGrid = (temp != 0);
|
||||
}
|
||||
#endif //EXPERIMENTAL_FFT_Y_GRID
|
||||
|
||||
#ifdef EXPERIMENTAL_FIND_NOTES
|
||||
if (fftFindNotes == defaults().fftFindNotes) {
|
||||
int temp;
|
||||
gPrefs->Read(wxT("/Spectrum/FFTFindNotes"), &temp);
|
||||
fftFindNotes = (temp != 0);
|
||||
}
|
||||
|
||||
if (findNotesMinA == defaults().findNotesMinA) {
|
||||
gPrefs->Read(wxT("/Spectrum/FindNotesMinA"), &findNotesMinA);
|
||||
}
|
||||
|
||||
if (numberOfMaxima == defaults().numberOfMaxima) {
|
||||
numberOfMaxima = gPrefs->Read(wxT("/Spectrum/FindNotesN"), &numberOfMaxima);
|
||||
}
|
||||
|
||||
if (findNotesQuantize == defaults().findNotesQuantize) {
|
||||
int temp;
|
||||
gPrefs->Read(wxT("/Spectrum/FindNotesQuantize"), &temp);
|
||||
findNotesQuantize = (temp != 0);
|
||||
}
|
||||
#endif //EXPERIMENTAL_FIND_NOTES
|
||||
|
||||
// Enforce legal values
|
||||
Validate(true);
|
||||
}
|
||||
|
||||
void SpectrogramSettings::InvalidateCaches()
|
||||
{
|
||||
DestroyWindows();
|
||||
|
@ -13,9 +13,11 @@ Paul Licameli
|
||||
|
||||
#include "../Experimental.h"
|
||||
|
||||
#include "../Prefs.h"
|
||||
#include "../SampleFormat.h"
|
||||
#include "../RealFFTf.h"
|
||||
|
||||
|
||||
#undef SPECTRAL_SELECTION_GLOBAL_SWITCH
|
||||
|
||||
class EnumValueSymbols;
|
||||
@ -24,7 +26,7 @@ class NumberScale;
|
||||
class SpectrumPrefs;
|
||||
class wxArrayStringEx;
|
||||
|
||||
class SpectrogramSettings
|
||||
class SpectrogramSettings : public PrefsListener
|
||||
{
|
||||
friend class SpectrumPrefs;
|
||||
public:
|
||||
@ -84,6 +86,9 @@ public:
|
||||
bool Validate(bool quiet);
|
||||
void LoadPrefs();
|
||||
void SavePrefs();
|
||||
|
||||
void UpdatePrefs() override;
|
||||
|
||||
void InvalidateCaches();
|
||||
void DestroyWindows();
|
||||
void CacheWindows() const;
|
||||
|
@ -18,6 +18,7 @@ Paul Licameli
|
||||
|
||||
#include "GUISettings.h"
|
||||
#include "GUIPrefs.h"
|
||||
#include "TracksPrefs.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <wx/intl.h>
|
||||
@ -85,8 +86,13 @@ bool WaveformSettings::Validate(bool /* quiet */)
|
||||
|
||||
void WaveformSettings::LoadPrefs()
|
||||
{
|
||||
scaleType = ScaleType(gPrefs->Read(wxT("/Waveform/ScaleType"), 0L));
|
||||
bool newPrefFound = gPrefs->Read(wxT("/Waveform/dBRange"), &dBRange);
|
||||
bool newPrefFound;
|
||||
|
||||
newPrefFound = gPrefs->Read(wxT("/Waveform/ScaleType"), &scaleType);
|
||||
if (!newPrefFound)
|
||||
scaleType = TracksPrefs::WaveformScaleChoice();
|
||||
|
||||
newPrefFound = gPrefs->Read(wxT("/Waveform/dBRange"), &dBRange);
|
||||
if (!newPrefFound)
|
||||
dBRange = gPrefs->Read(ENV_DB_KEY, ENV_DB_RANGE);
|
||||
|
||||
@ -106,6 +112,21 @@ void WaveformSettings::Update()
|
||||
{
|
||||
}
|
||||
|
||||
// This is a temporary hack until WaveformSettings gets fully integrated
|
||||
void WaveformSettings::UpdatePrefs()
|
||||
{
|
||||
if (scaleType == defaults().scaleType) {
|
||||
scaleType = TracksPrefs::WaveformScaleChoice();
|
||||
}
|
||||
|
||||
if (dBRange == defaults().dBRange){
|
||||
dBRange = gPrefs->Read(ENV_DB_KEY, ENV_DB_RANGE);
|
||||
}
|
||||
|
||||
// Enforce legal values
|
||||
Validate(true);
|
||||
}
|
||||
|
||||
void WaveformSettings::ConvertToEnumeratedDBRange()
|
||||
{
|
||||
// Assumes the codes are in ascending sequence.
|
||||
|
@ -12,10 +12,11 @@ Paul Licameli
|
||||
#define __AUDACITY_WAVEFORM_SETTINGS__
|
||||
|
||||
#include "../Internat.h" // for TranslatableStrings
|
||||
#include "../Prefs.h"
|
||||
|
||||
class EnumValueSymbols;
|
||||
|
||||
class WaveformSettings
|
||||
class WaveformSettings : public PrefsListener
|
||||
{
|
||||
public:
|
||||
|
||||
@ -47,6 +48,8 @@ public:
|
||||
void SavePrefs();
|
||||
void Update();
|
||||
|
||||
void UpdatePrefs() override;
|
||||
|
||||
void ConvertToEnumeratedDBRange();
|
||||
void ConvertToActualDBRange();
|
||||
void NextLowerDBRange();
|
||||
|
Loading…
x
Reference in New Issue
Block a user