mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-24 00:18:07 +02:00
Publicize class SpecCache. TrackArtist will re-use it.
This commit is contained in:
parent
e0f4595485
commit
c14b326913
@ -17,12 +17,6 @@
|
|||||||
\class WaveCache
|
\class WaveCache
|
||||||
\brief Cache used with WaveClip to cache wave information (for drawing).
|
\brief Cache used with WaveClip to cache wave information (for drawing).
|
||||||
|
|
||||||
*//****************************************************************//**
|
|
||||||
|
|
||||||
\class SpecCache
|
|
||||||
\brief Cache used with WaveClip to cache spectrum information (for
|
|
||||||
drawing). Cache's the Spectrogram frequency samples.
|
|
||||||
|
|
||||||
*//*******************************************************************/
|
*//*******************************************************************/
|
||||||
|
|
||||||
#include "WaveClip.h"
|
#include "WaveClip.h"
|
||||||
@ -263,90 +257,6 @@ protected:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SpecCache {
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Make invalid cache
|
|
||||||
SpecCache()
|
|
||||||
: len(-1)
|
|
||||||
, ac(false)
|
|
||||||
, pps(-1.0)
|
|
||||||
, start(-1.0)
|
|
||||||
, windowType(-1)
|
|
||||||
, windowSize(-1)
|
|
||||||
, zeroPaddingFactor(-1)
|
|
||||||
, frequencyGain(-1)
|
|
||||||
|
|
||||||
, freq(NULL)
|
|
||||||
, where(NULL)
|
|
||||||
|
|
||||||
, dirty(-1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make valid cache, to be filled in
|
|
||||||
SpecCache(int cacheLen, bool autocorrelation,
|
|
||||||
double pps_, double start_, int windowType_, int windowSize_,
|
|
||||||
int zeroPaddingFactor_, int frequencyGain_
|
|
||||||
)
|
|
||||||
: len(cacheLen)
|
|
||||||
, ac(autocorrelation)
|
|
||||||
, pps(pps_)
|
|
||||||
, start(start_)
|
|
||||||
, windowType(windowType_)
|
|
||||||
, windowSize(windowSize_)
|
|
||||||
, zeroPaddingFactor(zeroPaddingFactor_)
|
|
||||||
, frequencyGain(frequencyGain_)
|
|
||||||
|
|
||||||
// len columns, and so many rows, column-major.
|
|
||||||
// Don't take column literally -- this isn't pixel data yet, it's the
|
|
||||||
// raw data to be mapped onto the display.
|
|
||||||
, freq(len * ((windowSize * zeroPaddingFactor) / 2))
|
|
||||||
|
|
||||||
// Sample counts corresponding to the columns, and to one past the end.
|
|
||||||
, where(len + 1)
|
|
||||||
|
|
||||||
, dirty(-1)
|
|
||||||
{
|
|
||||||
where[0] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
~SpecCache()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Matches(int dirty_, bool autocorrelation, double pixelsPerSecond,
|
|
||||||
const SpectrogramSettings &settings, double rate) const;
|
|
||||||
|
|
||||||
void CalculateOneSpectrum
|
|
||||||
(const SpectrogramSettings &settings,
|
|
||||||
WaveTrackCache &waveTrackCache,
|
|
||||||
int xx, sampleCount numSamples,
|
|
||||||
double offset, double rate,
|
|
||||||
bool autocorrelation, const std::vector<float> &gainFactors,
|
|
||||||
float *scratch);
|
|
||||||
|
|
||||||
void Populate
|
|
||||||
(const SpectrogramSettings &settings, WaveTrackCache &waveTrackCache,
|
|
||||||
int copyBegin, int copyEnd, int numPixels,
|
|
||||||
sampleCount numSamples,
|
|
||||||
double offset, double rate,
|
|
||||||
bool autocorrelation);
|
|
||||||
|
|
||||||
const int len; // counts pixels, not samples
|
|
||||||
const bool ac;
|
|
||||||
const double pps;
|
|
||||||
const double start;
|
|
||||||
const int windowType;
|
|
||||||
const int windowSize;
|
|
||||||
const int zeroPaddingFactor;
|
|
||||||
const int frequencyGain;
|
|
||||||
std::vector<float> freq;
|
|
||||||
std::vector<sampleCount> where;
|
|
||||||
|
|
||||||
int dirty;
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_USE_REALFFTF
|
#ifdef EXPERIMENTAL_USE_REALFFTF
|
||||||
#include "FFT.h"
|
#include "FFT.h"
|
||||||
static void ComputeSpectrumUsingRealFFTf
|
static void ComputeSpectrumUsingRealFFTf
|
||||||
|
@ -32,9 +32,93 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class Envelope;
|
class Envelope;
|
||||||
|
class SpectrogramSettings;
|
||||||
class WaveCache;
|
class WaveCache;
|
||||||
class WaveTrackCache;
|
class WaveTrackCache;
|
||||||
class SpecCache;
|
|
||||||
|
class SpecCache {
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Make invalid cache
|
||||||
|
SpecCache()
|
||||||
|
: len(-1)
|
||||||
|
, ac(false)
|
||||||
|
, pps(-1.0)
|
||||||
|
, start(-1.0)
|
||||||
|
, windowType(-1)
|
||||||
|
, windowSize(-1)
|
||||||
|
, zeroPaddingFactor(-1)
|
||||||
|
, frequencyGain(-1)
|
||||||
|
|
||||||
|
, freq(NULL)
|
||||||
|
, where(NULL)
|
||||||
|
|
||||||
|
, dirty(-1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make valid cache, to be filled in
|
||||||
|
SpecCache(int cacheLen, bool autocorrelation,
|
||||||
|
double pps_, double start_, int windowType_, int windowSize_,
|
||||||
|
int zeroPaddingFactor_, int frequencyGain_
|
||||||
|
)
|
||||||
|
: len(cacheLen)
|
||||||
|
, ac(autocorrelation)
|
||||||
|
, pps(pps_)
|
||||||
|
, start(start_)
|
||||||
|
, windowType(windowType_)
|
||||||
|
, windowSize(windowSize_)
|
||||||
|
, zeroPaddingFactor(zeroPaddingFactor_)
|
||||||
|
, frequencyGain(frequencyGain_)
|
||||||
|
|
||||||
|
// len columns, and so many rows, column-major.
|
||||||
|
// Don't take column literally -- this isn't pixel data yet, it's the
|
||||||
|
// raw data to be mapped onto the display.
|
||||||
|
, freq(len * ((windowSize * zeroPaddingFactor) / 2))
|
||||||
|
|
||||||
|
// Sample counts corresponding to the columns, and to one past the end.
|
||||||
|
, where(len + 1)
|
||||||
|
|
||||||
|
, dirty(-1)
|
||||||
|
{
|
||||||
|
where[0] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
~SpecCache()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Matches(int dirty_, bool autocorrelation, double pixelsPerSecond,
|
||||||
|
const SpectrogramSettings &settings, double rate) const;
|
||||||
|
|
||||||
|
void CalculateOneSpectrum
|
||||||
|
(const SpectrogramSettings &settings,
|
||||||
|
WaveTrackCache &waveTrackCache,
|
||||||
|
int xx, sampleCount numSamples,
|
||||||
|
double offset, double rate,
|
||||||
|
bool autocorrelation, const std::vector<float> &gainFactors,
|
||||||
|
float *scratch);
|
||||||
|
|
||||||
|
void Populate
|
||||||
|
(const SpectrogramSettings &settings, WaveTrackCache &waveTrackCache,
|
||||||
|
int copyBegin, int copyEnd, int numPixels,
|
||||||
|
sampleCount numSamples,
|
||||||
|
double offset, double rate,
|
||||||
|
bool autocorrelation);
|
||||||
|
|
||||||
|
const int len; // counts pixels, not samples
|
||||||
|
const bool ac;
|
||||||
|
const double pps;
|
||||||
|
const double start;
|
||||||
|
const int windowType;
|
||||||
|
const int windowSize;
|
||||||
|
const int zeroPaddingFactor;
|
||||||
|
const int frequencyGain;
|
||||||
|
std::vector<float> freq;
|
||||||
|
std::vector<sampleCount> where;
|
||||||
|
|
||||||
|
int dirty;
|
||||||
|
};
|
||||||
|
|
||||||
class SpecPxCache {
|
class SpecPxCache {
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user