mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-04 01:29:43 +02:00
Throw away EXPERIMENTAL_FFT_SKIP_POINTS...
... with James' consent.
This commit is contained in:
parent
78d0347be2
commit
b25994a82d
@ -86,10 +86,6 @@
|
||||
// to activate it instead of the Spectrum log(f) mode.
|
||||
//#define EXPERIMENTAL_FIND_NOTES
|
||||
|
||||
// AM, 22.Nov 2007
|
||||
// Skip Points support in the spectrum view mode.
|
||||
//#define EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
|
||||
// AM, 22.Nov 2007:
|
||||
// A Frequency Grid for the Spectrum Log(f) & Find Notes modes
|
||||
//#define EXPERIMENTAL_FFT_Y_GRID
|
||||
|
@ -665,10 +665,6 @@ void TrackArtist::DrawVRuler(Track *t, wxDC * dc, wxRect & r)
|
||||
|
||||
void TrackArtist::UpdateVRuler(Track *t, wxRect & r)
|
||||
{
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
const int fftSkipPoints = SpectrogramSettings::defaults().fftSkipPoints;
|
||||
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
|
||||
// Label tracks do not have a vruler
|
||||
if (t->GetKind() == Track::Label) {
|
||||
return;
|
||||
@ -807,16 +803,10 @@ void TrackArtist::UpdateVRuler(Track *t, wxRect & r)
|
||||
int freq = lrint(rate/2.);
|
||||
|
||||
int maxFreq = GetSpectrumMaxFreq(freq);
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
maxFreq/=(fftSkipPoints+1);
|
||||
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
if(maxFreq > freq)
|
||||
maxFreq = freq;
|
||||
|
||||
int minFreq = GetSpectrumMinFreq(0);
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
minFreq/=(fftSkipPoints+1);
|
||||
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
if(minFreq < 0)
|
||||
minFreq = 0;
|
||||
|
||||
@ -853,16 +843,10 @@ void TrackArtist::UpdateVRuler(Track *t, wxRect & r)
|
||||
int freq = lrint(rate/2.);
|
||||
|
||||
int maxFreq = GetSpectrumLogMaxFreq(freq);
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
maxFreq/=(fftSkipPoints+1);
|
||||
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
if(maxFreq > freq)
|
||||
maxFreq = freq;
|
||||
|
||||
int minFreq = GetSpectrumLogMinFreq(freq/1000.0);
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
minFreq/=(fftSkipPoints+1);
|
||||
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
if(minFreq < 1)
|
||||
minFreq = 1;
|
||||
|
||||
@ -1964,11 +1948,6 @@ void TrackArtist::DrawClipSpectrum(WaveTrackCache &cache,
|
||||
bool updated = clip->GetSpectrogram(cache, freq, where, mid.width,
|
||||
t0, pps, autocorrelation);
|
||||
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
int fftSkipPoints = SpectrogramSettings::defaults().fftSkipPoints;
|
||||
int fftSkipPoints1 = fftSkipPoints + 1;
|
||||
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
|
||||
int ifreq = lrint(rate/2);
|
||||
|
||||
int maxFreq;
|
||||
@ -2057,14 +2036,8 @@ void TrackArtist::DrawClipSpectrum(WaveTrackCache &cache,
|
||||
#endif
|
||||
|
||||
#ifdef EXPERIMENTAL_FIND_NOTES
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
const float
|
||||
lmins = logf(float(minFreq) / (fftSkipPoints + 1)),
|
||||
lmaxs = logf(float(maxFreq) / (fftSkipPoints + 1))
|
||||
#else //!EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
lmins = lmin,
|
||||
lmaxs = lmax
|
||||
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
;
|
||||
#endif //EXPERIMENTAL_FIND_NOTES
|
||||
|
||||
@ -2072,11 +2045,7 @@ void TrackArtist::DrawClipSpectrum(WaveTrackCache &cache,
|
||||
int maxima[128];
|
||||
float maxima0[128], maxima1[128];
|
||||
const float
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
f2bin = half / (rate / 2.0f / (fftSkipPoints + 1)),
|
||||
#else //!EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
f2bin = half / (rate / 2.0f),
|
||||
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
bin2f = 1.0f / f2bin,
|
||||
minDistance = powf(2.0f, 2.0f / 12.0f),
|
||||
i0 = expf(lmin) / binUnit,
|
||||
@ -3086,13 +3055,6 @@ int TrackArtist::GetSpectrumWindowSize(bool includeZeroPadding)
|
||||
return windowSize;
|
||||
}
|
||||
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
int TrackArtist::GetSpectrumFftSkipPoints()
|
||||
{
|
||||
return SpectrogramSettings::defaults().fftSkipPoints;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Set various preference values
|
||||
void TrackArtist::SetSpectrumMinFreq(int freq)
|
||||
{
|
||||
|
@ -76,10 +76,6 @@ class AUDACITY_DLL_API TrackArtist {
|
||||
int GetSpectrumLogMaxFreq(int deffreq);
|
||||
int GetSpectrumWindowSize(bool includeZeroPadding);
|
||||
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
int GetSpectrumFftSkipPoints();
|
||||
#endif
|
||||
|
||||
void SetSpectrumMinFreq(int freq);
|
||||
void SetSpectrumMaxFreq(int freq);
|
||||
void SetSpectrumLogMinFreq(int freq);
|
||||
|
@ -4714,9 +4714,6 @@ void TrackPanel::HandleVZoomButtonUp( wxMouseEvent & event )
|
||||
float min, max, c, l, binSize = 0.0;
|
||||
bool spectrum, spectrumLog;
|
||||
int windowSize;
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
int fftSkipPoints=0;
|
||||
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
double rate = ((WaveTrack *)track)->GetRate();
|
||||
spectrum = (((WaveTrack *) track)->GetDisplay() == WaveTrack::SpectrumDisplay) ||
|
||||
(((WaveTrack *) track)->GetDisplay() == WaveTrack::SpectralSelectionDisplay) ;
|
||||
@ -4733,9 +4730,6 @@ void TrackPanel::HandleVZoomButtonUp( wxMouseEvent & event )
|
||||
|
||||
// Always spectrogram, never pitch view, pass true
|
||||
windowSize = mTrackArtist->GetSpectrumWindowSize(true);
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
fftSkipPoints = SpectrogramSettings::defaults().fftSkipPoints;
|
||||
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
binSize = rate / windowSize;
|
||||
minBins = wxMin(10, windowSize/2); //minimum 10 freq bins, unless there are less
|
||||
}
|
||||
@ -4750,9 +4744,6 @@ void TrackPanel::HandleVZoomButtonUp( wxMouseEvent & event )
|
||||
|
||||
// Always spectrogram, never pitch view, pass true
|
||||
windowSize = mTrackArtist->GetSpectrumWindowSize(true);
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
fftSkipPoints = SpectrogramSettings::defaults().fftSkipPoints;
|
||||
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
binSize = rate / windowSize;
|
||||
minBins = wxMin(10, windowSize/2); //minimum 10 freq bins, unless there are less
|
||||
}
|
||||
|
@ -276,9 +276,6 @@ public:
|
||||
, windowSize(-1)
|
||||
, zeroPaddingFactor(-1)
|
||||
, frequencyGain(-1)
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
, fftSkipPoints(-1)
|
||||
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
|
||||
, freq(NULL)
|
||||
, where(NULL)
|
||||
@ -291,10 +288,7 @@ public:
|
||||
SpecCache(int cacheLen, bool autocorrelation,
|
||||
double pps_, double start_, int windowType_, int windowSize_,
|
||||
int zeroPaddingFactor_, int frequencyGain_
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
, int fftSkipPoints_
|
||||
#endif
|
||||
)
|
||||
)
|
||||
: len(cacheLen)
|
||||
, ac(autocorrelation)
|
||||
, pps(pps_)
|
||||
@ -303,9 +297,6 @@ public:
|
||||
, windowSize(windowSize_)
|
||||
, zeroPaddingFactor(zeroPaddingFactor_)
|
||||
, frequencyGain(frequencyGain_)
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
, fftSkipPoints(fftSkipPoints_)
|
||||
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
|
||||
// len columns, and so many rows, column-major.
|
||||
// Don't take column literally -- this isn't pixel data yet, it's the
|
||||
@ -350,9 +341,6 @@ public:
|
||||
const int windowSize;
|
||||
const int zeroPaddingFactor;
|
||||
const int frequencyGain;
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
const int fftSkipPoints;
|
||||
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
std::vector<float> freq;
|
||||
std::vector<sampleCount> where;
|
||||
|
||||
@ -833,9 +821,6 @@ bool SpecCache::Matches
|
||||
windowSize == settings.windowSize &&
|
||||
zeroPaddingFactor == settings.zeroPaddingFactor &&
|
||||
frequencyGain == settings.frequencyGain &&
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
fftSkipPoints == settings.fftSkipPoints &&
|
||||
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
ac == autocorrelation;
|
||||
}
|
||||
|
||||
@ -847,11 +832,6 @@ void SpecCache::CalculateOneSpectrum
|
||||
bool autocorrelation, const std::vector<float> &gainFactors,
|
||||
float *scratch)
|
||||
{
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
int fftSkipPoints = settings.fftSkipPoints;
|
||||
int fftSkipPoints1 = fftSkipPoints + 1;
|
||||
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
|
||||
const int windowSize = settings.windowSize;
|
||||
sampleCount start = where[xx];
|
||||
const int zeroPaddingFactor = (autocorrelation ? 1 : settings.zeroPaddingFactor);
|
||||
@ -881,15 +861,6 @@ void SpecCache::CalculateOneSpectrum
|
||||
start = 0;
|
||||
copy = true;
|
||||
}
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
copy = true;
|
||||
if (start + len*fftSkipPoints1 > numSamples) {
|
||||
int newlen = (numSamples - start) / fftSkipPoints1;
|
||||
for (int i = newlen*fftSkipPoints1; i < (sampleCount)len*fftSkipPoints1; i++)
|
||||
adj[i] = 0;
|
||||
len = newlen;
|
||||
}
|
||||
#else //!EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
if (start + len > numSamples) {
|
||||
// Near the end of the clip, pad right with zeroes as needed.
|
||||
int newlen = numSamples - start;
|
||||
@ -898,28 +869,13 @@ void SpecCache::CalculateOneSpectrum
|
||||
len = newlen;
|
||||
copy = true;
|
||||
}
|
||||
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
|
||||
if (len > 0) {
|
||||
// Copy samples out of the track.
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
useBuffer = (float*)(waveTrackCache.Get(floatSample,
|
||||
floor(0.5 + start + offset * rate), len*fftSkipPoints1));
|
||||
memcpy(adj, useBuffer, len * fftSkipPoints1 * sizeof(float));
|
||||
if (fftSkipPoints) {
|
||||
// TODO: (maybe) alternatively change Get to include skipping of points
|
||||
int j = 0;
|
||||
for (int i = 0; i < len; i++) {
|
||||
adj[i] = adj[j];
|
||||
j += fftSkipPoints1;
|
||||
}
|
||||
}
|
||||
#else //!EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
useBuffer = (float*)(waveTrackCache.Get(floatSample,
|
||||
floor(0.5 + start + offset * rate), len));
|
||||
if (copy)
|
||||
memcpy(adj, useBuffer, len * sizeof(float));
|
||||
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
}
|
||||
|
||||
if (copy)
|
||||
@ -961,11 +917,6 @@ void SpecCache::Populate
|
||||
settings.CacheWindows();
|
||||
#endif
|
||||
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
int fftSkipPoints = settings.fftSkipPoints;
|
||||
int fftSkipPoints1 = fftSkipPoints + 1;
|
||||
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
|
||||
const int &frequencyGain = settings.frequencyGain;
|
||||
const int &windowSize = settings.windowSize;
|
||||
#ifdef EXPERIMENTAL_ZERO_PADDED_SPECTROGRAMS
|
||||
@ -979,11 +930,7 @@ void SpecCache::Populate
|
||||
const int fftLen = windowSize * zeroPaddingFactor;
|
||||
|
||||
std::vector<float> buffer(
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
fftLen*fftSkipPoints1
|
||||
#else //!EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
fftLen
|
||||
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
);
|
||||
|
||||
std::vector<float> gainFactors;
|
||||
@ -1009,10 +956,6 @@ bool WaveClip::GetSpectrogram(WaveTrackCache &waveTrackCache,
|
||||
{
|
||||
const SpectrogramSettings &settings = SpectrogramSettings::defaults();
|
||||
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
int fftSkipPoints = settings.fftSkipPoints;
|
||||
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
|
||||
const int &frequencyGain = settings.frequencyGain;
|
||||
const int &windowSize = settings.windowSize;
|
||||
const int &windowType = settings.windowType;
|
||||
@ -1070,9 +1013,6 @@ bool WaveClip::GetSpectrogram(WaveTrackCache &waveTrackCache,
|
||||
mSpecCache = new SpecCache(
|
||||
numPixels, autocorrelation, pixelsPerSecond, t0,
|
||||
windowType, windowSize, zeroPaddingFactor, frequencyGain
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
, fftSkipPoints
|
||||
#endif
|
||||
);
|
||||
|
||||
fillWhere(mSpecCache->where, numPixels, 0.5, correction,
|
||||
|
@ -164,35 +164,6 @@ void SpectrumPrefs::PopulateOrExchange(ShuttleGui & S)
|
||||
}
|
||||
S.EndStatic();
|
||||
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
// Search and replace with _ if you want translation.
|
||||
#define TRANSLATABLE( x ) wxT(x)
|
||||
wxArrayString wskipn;
|
||||
wxArrayInt wskipv;
|
||||
|
||||
for (size_t i = 0; i < 7; i++) {
|
||||
wskipn.Add(wxString::Format(wxT("%d"), (1 << i) - 1));
|
||||
wskipv.Add((1 << i) - 1);
|
||||
}
|
||||
|
||||
/* /////i18n-hint: (noun) Experimental. Don't know what it does. Don't translate.*/
|
||||
S.StartStatic(TRANSLATABLE("FFT Skip Points"));
|
||||
{
|
||||
S.StartMultiColumn(2);
|
||||
{
|
||||
/* /////i18n-hint: (noun) here the user chooses points to skip.*/
|
||||
S.TieChoice(TRANSLATABLE("Skip Points:"),
|
||||
wxT("/Spectrum/FFTSkipPoints"),
|
||||
0,
|
||||
wskipn,
|
||||
wskipv);
|
||||
S.SetSizeHints(wskipn);
|
||||
}
|
||||
S.EndMultiColumn();
|
||||
}
|
||||
S.EndStatic();
|
||||
#endif //EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
|
||||
S.StartStatic(_("Display"));
|
||||
{
|
||||
S.StartTwoColumn();
|
||||
@ -430,10 +401,6 @@ void SpectrogramSettings::UpdatePrefs()
|
||||
|
||||
isGrayscale = (gPrefs->Read(wxT("/Spectrum/Grayscale"), 0L) != 0);
|
||||
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
fftSkipPoints = gPrefs->Read(wxT("/Spectrum/FFTSkipPoints"), 0L);
|
||||
#endif
|
||||
|
||||
#ifdef EXPERIMENTAL_FFT_Y_GRID
|
||||
fftYGrid = (gPrefs->Read(wxT("/Spectrum/FFTYGrid"), 0L) != 0);
|
||||
#endif //EXPERIMENTAL_FFT_Y_GRID
|
||||
|
@ -103,10 +103,6 @@ public:
|
||||
|
||||
bool isGrayscale;
|
||||
|
||||
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS
|
||||
int fftSkipPoints;
|
||||
#endif
|
||||
|
||||
#ifdef EXPERIMENTAL_FFT_Y_GRID
|
||||
bool fftYGrid;
|
||||
#endif //EXPERIMENTAL_FFT_Y_GRID
|
||||
|
Loading…
x
Reference in New Issue
Block a user