mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-26 23:33:49 +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
|
||||
|
||||
Reference in New Issue
Block a user