mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 16:10:06 +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
|
#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()
|
void SpectrogramSettings::InvalidateCaches()
|
||||||
{
|
{
|
||||||
DestroyWindows();
|
DestroyWindows();
|
||||||
|
@ -13,9 +13,11 @@ Paul Licameli
|
|||||||
|
|
||||||
#include "../Experimental.h"
|
#include "../Experimental.h"
|
||||||
|
|
||||||
|
#include "../Prefs.h"
|
||||||
#include "../SampleFormat.h"
|
#include "../SampleFormat.h"
|
||||||
#include "../RealFFTf.h"
|
#include "../RealFFTf.h"
|
||||||
|
|
||||||
|
|
||||||
#undef SPECTRAL_SELECTION_GLOBAL_SWITCH
|
#undef SPECTRAL_SELECTION_GLOBAL_SWITCH
|
||||||
|
|
||||||
class EnumValueSymbols;
|
class EnumValueSymbols;
|
||||||
@ -24,7 +26,7 @@ class NumberScale;
|
|||||||
class SpectrumPrefs;
|
class SpectrumPrefs;
|
||||||
class wxArrayStringEx;
|
class wxArrayStringEx;
|
||||||
|
|
||||||
class SpectrogramSettings
|
class SpectrogramSettings : public PrefsListener
|
||||||
{
|
{
|
||||||
friend class SpectrumPrefs;
|
friend class SpectrumPrefs;
|
||||||
public:
|
public:
|
||||||
@ -84,6 +86,9 @@ public:
|
|||||||
bool Validate(bool quiet);
|
bool Validate(bool quiet);
|
||||||
void LoadPrefs();
|
void LoadPrefs();
|
||||||
void SavePrefs();
|
void SavePrefs();
|
||||||
|
|
||||||
|
void UpdatePrefs() override;
|
||||||
|
|
||||||
void InvalidateCaches();
|
void InvalidateCaches();
|
||||||
void DestroyWindows();
|
void DestroyWindows();
|
||||||
void CacheWindows() const;
|
void CacheWindows() const;
|
||||||
|
@ -18,6 +18,7 @@ Paul Licameli
|
|||||||
|
|
||||||
#include "GUISettings.h"
|
#include "GUISettings.h"
|
||||||
#include "GUIPrefs.h"
|
#include "GUIPrefs.h"
|
||||||
|
#include "TracksPrefs.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
@ -85,8 +86,13 @@ bool WaveformSettings::Validate(bool /* quiet */)
|
|||||||
|
|
||||||
void WaveformSettings::LoadPrefs()
|
void WaveformSettings::LoadPrefs()
|
||||||
{
|
{
|
||||||
scaleType = ScaleType(gPrefs->Read(wxT("/Waveform/ScaleType"), 0L));
|
bool newPrefFound;
|
||||||
bool newPrefFound = gPrefs->Read(wxT("/Waveform/dBRange"), &dBRange);
|
|
||||||
|
newPrefFound = gPrefs->Read(wxT("/Waveform/ScaleType"), &scaleType);
|
||||||
|
if (!newPrefFound)
|
||||||
|
scaleType = TracksPrefs::WaveformScaleChoice();
|
||||||
|
|
||||||
|
newPrefFound = gPrefs->Read(wxT("/Waveform/dBRange"), &dBRange);
|
||||||
if (!newPrefFound)
|
if (!newPrefFound)
|
||||||
dBRange = gPrefs->Read(ENV_DB_KEY, ENV_DB_RANGE);
|
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()
|
void WaveformSettings::ConvertToEnumeratedDBRange()
|
||||||
{
|
{
|
||||||
// Assumes the codes are in ascending sequence.
|
// Assumes the codes are in ascending sequence.
|
||||||
|
@ -12,10 +12,11 @@ Paul Licameli
|
|||||||
#define __AUDACITY_WAVEFORM_SETTINGS__
|
#define __AUDACITY_WAVEFORM_SETTINGS__
|
||||||
|
|
||||||
#include "../Internat.h" // for TranslatableStrings
|
#include "../Internat.h" // for TranslatableStrings
|
||||||
|
#include "../Prefs.h"
|
||||||
|
|
||||||
class EnumValueSymbols;
|
class EnumValueSymbols;
|
||||||
|
|
||||||
class WaveformSettings
|
class WaveformSettings : public PrefsListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -47,6 +48,8 @@ public:
|
|||||||
void SavePrefs();
|
void SavePrefs();
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
|
void UpdatePrefs() override;
|
||||||
|
|
||||||
void ConvertToEnumeratedDBRange();
|
void ConvertToEnumeratedDBRange();
|
||||||
void ConvertToActualDBRange();
|
void ConvertToActualDBRange();
|
||||||
void NextLowerDBRange();
|
void NextLowerDBRange();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user