mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-26 15:23:48 +01:00
Access SpectrogramSettings via WaveTrack, which may be nondefault (no UI yet)...
... and add accessors to SpectrogramSettings, and remove TrackArtist functions for getting and setting the globals.
This commit is contained in:
@@ -19,6 +19,9 @@ Paul Licameli
|
||||
#include "../Prefs.h"
|
||||
#include "../RealFFTf.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
SpectrogramSettings::SpectrogramSettings()
|
||||
: hFFT(0)
|
||||
, window(0)
|
||||
@@ -254,6 +257,59 @@ void SpectrogramSettings::CacheWindows() const
|
||||
#endif // EXPERIMENTAL_USE_REALFFTF
|
||||
}
|
||||
|
||||
int SpectrogramSettings::GetMinFreq(double rate) const
|
||||
{
|
||||
const int top = lrint(rate / 2.);
|
||||
return std::max(0, std::min(top, minFreq));
|
||||
}
|
||||
|
||||
int SpectrogramSettings::GetMaxFreq(double rate) const
|
||||
{
|
||||
const int top = lrint(rate / 2.);
|
||||
if (maxFreq < 0)
|
||||
return top;
|
||||
else
|
||||
return std::max(0, std::min(top, maxFreq));
|
||||
}
|
||||
|
||||
int SpectrogramSettings::GetLogMinFreq(double rate) const
|
||||
{
|
||||
const int top = lrint(rate / 2.);
|
||||
if (logMinFreq < 0)
|
||||
return top / 1000.0;
|
||||
else
|
||||
return std::max(1, std::min(top, logMinFreq));
|
||||
}
|
||||
|
||||
int SpectrogramSettings::GetLogMaxFreq(double rate) const
|
||||
{
|
||||
const int top = lrint(rate / 2.);
|
||||
if (logMaxFreq < 0)
|
||||
return top;
|
||||
else
|
||||
return std::max(1, std::min(top, logMaxFreq));
|
||||
}
|
||||
|
||||
void SpectrogramSettings::SetMinFreq(int freq)
|
||||
{
|
||||
minFreq = freq;
|
||||
}
|
||||
|
||||
void SpectrogramSettings::SetMaxFreq(int freq)
|
||||
{
|
||||
maxFreq = freq;
|
||||
}
|
||||
|
||||
void SpectrogramSettings::SetLogMinFreq(int freq)
|
||||
{
|
||||
logMinFreq = freq;
|
||||
}
|
||||
|
||||
void SpectrogramSettings::SetLogMaxFreq(int freq)
|
||||
{
|
||||
logMaxFreq = freq;
|
||||
}
|
||||
|
||||
int SpectrogramSettings::GetFFTLength(bool autocorrelation) const
|
||||
{
|
||||
return windowSize
|
||||
|
||||
@@ -28,12 +28,23 @@ public:
|
||||
void DestroyWindows();
|
||||
void CacheWindows() const;
|
||||
|
||||
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;
|
||||
|
||||
void SetMinFreq(int freq);
|
||||
void SetMaxFreq(int freq);
|
||||
void SetLogMinFreq(int freq);
|
||||
void SetLogMaxFreq(int freq);
|
||||
|
||||
public:
|
||||
int range;
|
||||
int gain;
|
||||
int frequencyGain;
|
||||
@@ -67,5 +78,4 @@ public:
|
||||
mutable float *window;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user