mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-26 23:33:49 +01:00
WaveTrack::WaveTrackDisplay does not encode scale or spectral selection...
... SpectrogramSettings does that instead, and Preferences or View Settings are the user interface for changing it. Handle invalidation of spectrogram pixel cache for scale type changes, just as for other changes of settings. No more TrackArtist::InvalidateSpectrumCache(). View type of track now switches to Spectrum when applying or OKing the View Settings... dialog and the Spectrogram page is open (and for now it is still the only page)
This commit is contained in:
@@ -47,6 +47,8 @@ SpectrogramSettings::SpectrogramSettings(const SpectrogramSettings &other)
|
||||
, zeroPaddingFactor(other.zeroPaddingFactor)
|
||||
#endif
|
||||
, isGrayscale(other.isGrayscale)
|
||||
, scaleType(other.scaleType)
|
||||
, spectralSelection(other.spectralSelection)
|
||||
#ifdef EXPERIMENTAL_FFT_Y_GRID
|
||||
, fftYGrid(other.fftYGrid)
|
||||
#endif
|
||||
@@ -79,6 +81,8 @@ SpectrogramSettings &SpectrogramSettings::operator= (const SpectrogramSettings &
|
||||
zeroPaddingFactor = other.zeroPaddingFactor;
|
||||
#endif
|
||||
isGrayscale = other.isGrayscale;
|
||||
scaleType = other.scaleType;
|
||||
spectralSelection = other.spectralSelection;
|
||||
#ifdef EXPERIMENTAL_FFT_Y_GRID
|
||||
fftYGrid = other.fftYGrid;
|
||||
#endif
|
||||
@@ -102,6 +106,35 @@ SpectrogramSettings& SpectrogramSettings::defaults()
|
||||
return instance;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
wxArrayString &scaleNamesArray()
|
||||
{
|
||||
static wxArrayString theArray;
|
||||
return theArray;
|
||||
}
|
||||
}
|
||||
|
||||
//static
|
||||
void SpectrogramSettings::InvalidateNames()
|
||||
{
|
||||
scaleNamesArray().Clear();
|
||||
}
|
||||
|
||||
//static
|
||||
const wxArrayString &SpectrogramSettings::GetScaleNames()
|
||||
{
|
||||
wxArrayString &theArray = scaleNamesArray();
|
||||
|
||||
if (theArray.IsEmpty()) {
|
||||
// Keep in correspondence with enum SpectrogramSettings::ScaleType:
|
||||
theArray.Add(_("Linear"));
|
||||
theArray.Add(_("Logarithmic"));
|
||||
}
|
||||
|
||||
return theArray;
|
||||
}
|
||||
|
||||
bool SpectrogramSettings::Validate(bool quiet)
|
||||
{
|
||||
if (!quiet &&
|
||||
@@ -155,6 +188,10 @@ bool SpectrogramSettings::Validate(bool quiet)
|
||||
// preference files, which could be or from future versions. Validate quietly.
|
||||
windowType =
|
||||
std::max(0, std::min(NumWindowFuncs() - 1, windowType));
|
||||
scaleType =
|
||||
ScaleType(std::max(0,
|
||||
std::min(int(SpectrogramSettings::stNumScaleTypes) - 1,
|
||||
int(scaleType))));
|
||||
ConvertToEnumeratedWindowSizes();
|
||||
ConvertToActualWindowSizes();
|
||||
|
||||
@@ -181,6 +218,9 @@ void SpectrogramSettings::LoadPrefs()
|
||||
|
||||
isGrayscale = (gPrefs->Read(wxT("/Spectrum/Grayscale"), 0L) != 0);
|
||||
|
||||
scaleType = ScaleType(gPrefs->Read(wxT("/Spectrum/ScaleType"), 0L));
|
||||
spectralSelection = (gPrefs->Read(wxT("/Spectrum/EnableSpectralSelection"), 0L) != 0);
|
||||
|
||||
#ifdef EXPERIMENTAL_FFT_Y_GRID
|
||||
fftYGrid = (gPrefs->Read(wxT("/Spectrum/FFTYGrid"), 0L) != 0);
|
||||
#endif //EXPERIMENTAL_FFT_Y_GRID
|
||||
@@ -235,6 +275,9 @@ void SpectrogramSettings::SavePrefs()
|
||||
|
||||
gPrefs->Write(wxT("/Spectrum/Grayscale"), isGrayscale);
|
||||
|
||||
gPrefs->Write(wxT("/Spectrum/ScaleType"), scaleType);
|
||||
gPrefs->Write(wxT("/Spectrum/EnableSpectralSelection"), spectralSelection);
|
||||
|
||||
#ifdef EXPERIMENTAL_FFT_Y_GRID
|
||||
gPrefs->Write(wxT("/Spectrum/FFTYGrid"), fftYGrid);
|
||||
#endif //EXPERIMENTAL_FFT_Y_GRID
|
||||
|
||||
Reference in New Issue
Block a user