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#ifndef __AUDACITY_SPECTRUM_ANALYST__
13#define __AUDACITY_SPECTRUM_ANALYST__
14
15#include <vector>
16#include <wx/statusbr.h>
17
18class FreqGauge;
19
20class AUDACITY_DLL_API SpectrumAnalyst
21{
22public:
23
24 enum Algorithm {
30
31 NumAlgorithms
32 };
33
36
37 // Return true iff successful
38 bool Calculate(Algorithm alg,
39 int windowFunc, // see FFT.h for values
40 size_t windowSize, double rate,
41 const float *data, size_t dataLen,
42 float *pYMin = NULL, float *pYMax = NULL, // outputs
43 FreqGauge *progress = NULL);
44
45 const float *GetProcessed() const;
46 int GetProcessedSize() const;
47
48 float GetProcessedValue(float freq0, float freq1) const;
49 float FindPeak(float xPos, float *pY) const;
50
51private:
52 float CubicInterpolate(float y0, float y1, float y2, float y3, float x) const;
53 float CubicMaximize(float y0, float y1, float y2, float y3, float * max) const;
54
55private:
57 double mRate;
59 std::vector<float> mProcessed;
60};
61
62class AUDACITY_DLL_API FreqGauge final : public wxStatusBar
63{
64public:
65 FreqGauge(wxWindow * parent, wxWindowID winid);
66
67 void SetRange(int range, int bar = 12, int gap = 3);
68 void SetValue(int value);
69 void Reset();
70
71private:
72 wxRect mRect;
73 int mRange;
74 int mCur;
75 int mLast;
77 int mBar;
78 int mGap;
80};
81
82#endif
static const int gap
Definition: MeterPanel.cpp:259
wxRect mRect
Used for finding the peaks, for snapping to peaks.
std::vector< float > mProcessed