Audacity 3.2.0
SpectrumAnalyst.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 SpectrumAnalyst.h
6
7 Dominic Mazzoni
8 Paul Licameli split from FreqWindow.h
9
10**********************************************************************/
11
12#pragma once
13
14#include <vector>
15#include <functional>
16
17class FFT_API SpectrumAnalyst
18{
19public:
20
21 enum Algorithm {
27
28 NumAlgorithms
29 };
30
31 using ProgressFn = std::function<void(long long num, long long den)>;
32
35
36 // Return true iff successful
37 bool Calculate(Algorithm alg,
38 int windowFunc, // see FFT.h for values
39 size_t windowSize, double rate,
40 const float *data, size_t dataLen,
41 float *pYMin = NULL, float *pYMax = NULL, // outputs
42 ProgressFn progress = NULL);
43
44 const float *GetProcessed() const;
45 int GetProcessedSize() const;
46
47 float GetProcessedValue(float freq0, float freq1) const;
48 float FindPeak(float xPos, float *pY) const;
49
50private:
51 float CubicInterpolate(float y0, float y1, float y2, float y3, float x) const;
52 float CubicMaximize(float y0, float y1, float y2, float y3, float * max) const;
53
54private:
56 double mRate;
58 std::vector<float> mProcessed;
59};
Used for finding the peaks, for snapping to peaks.
std::vector< float > mProcessed
std::function< void(long long num, long long den)> ProgressFn