1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-17 08:30:06 +02:00
audacity/src/prefs/SpectrogramSettings.h
Paul Licameli 7d379cde13 Conditional compilation (disabled) to make Spectral selection choice global...
... not per track,
and the preferences or View Settings page has a separate static box for
global settings as opposed to track settings.  This is the only global setting
for now.
2015-07-27 23:01:06 -04:00

141 lines
3.0 KiB
C++

/**********************************************************************
Audacity: A Digital Audio Editor
SpectrogramSettings.h
Paul Licameli
**********************************************************************/
#ifndef __AUDACITY_SPECTROGRAM_SETTINGS__
#define __AUDACITY_SPECTROGRAM_SETTINGS__
#include "../Experimental.h"
#undef SPECTRAL_SELECTION_GLOBAL_SWITCH
struct FFTParam;
class SpectrumPrefs;
class wxArrayString;
class SpectrogramSettings
{
friend class SpectrumPrefs;
public:
// Singleton for settings that are not per-track
class Globals
{
public:
static Globals &Get();
void SavePrefs();
#ifdef SPECTRAL_SELECTION_GLOBAL_SWITCH
bool spectralSelection;
#endif
private:
Globals();
void LoadPrefs();
};
enum {
LogMinWindowSize = 3,
LogMaxWindowSize = 15,
NumWindowSizes = LogMaxWindowSize - LogMinWindowSize + 1,
};
// Do not assume that this enumeration will remain the
// same as NumberScaleType in future. That enum may become
// more general purpose.
enum ScaleType {
stLinear,
stLogarithmic,
stNumScaleTypes,
};
static void InvalidateNames(); // in case of language change
static const wxArrayString &GetScaleNames();
static SpectrogramSettings &defaults();
SpectrogramSettings();
SpectrogramSettings(const SpectrogramSettings &other);
SpectrogramSettings& operator= (const SpectrogramSettings &other);
~SpectrogramSettings();
bool IsDefault() const
{
return this == &defaults();
}
bool Validate(bool quiet);
void LoadPrefs();
void SavePrefs();
void InvalidateCaches();
void DestroyWindows();
void CacheWindows() const;
void ConvertToEnumeratedWindowSizes();
void ConvertToActualWindowSizes();
private:
int minFreq;
int maxFreq;
int logMinFreq;
int logMaxFreq;
public:
int GetMinFreq(double rate) const;
int GetMaxFreq(double rate) const;
int GetLogMinFreq(double rate) const;
int GetLogMaxFreq(double rate) const;
bool SpectralSelectionEnabled() const;
void SetMinFreq(int freq);
void SetMaxFreq(int freq);
void SetLogMinFreq(int freq);
void SetLogMaxFreq(int freq);
public:
int range;
int gain;
int frequencyGain;
int windowType;
int windowSize;
#ifdef EXPERIMENTAL_ZERO_PADDED_SPECTROGRAMS
int zeroPaddingFactor;
#endif
int GetFFTLength(bool autocorrelation) const; // window size (times zero padding, if STFT)
bool isGrayscale;
ScaleType scaleType;
#ifndef SPECTRAL_SELECTION_GLOBAL_SWITCH
bool spectralSelection; // But should this vary per track? -- PRL
#endif
#ifdef EXPERIMENTAL_FFT_Y_GRID
bool fftYGrid;
#endif //EXPERIMENTAL_FFT_Y_GRID
#ifdef EXPERIMENTAL_FIND_NOTES
bool fftFindNotes;
bool findNotesMinA;
bool numberOfMaxima;
bool findNotesQuantize;
#endif //EXPERIMENTAL_FIND_NOTES
// Following fields are derived from preferences.
#ifdef EXPERIMENTAL_USE_REALFFTF
// Variables used for computing the spectrum
mutable FFTParam *hFFT;
mutable float *window;
#endif
};
#endif