FahlGrahn Audio v1.0.0
Loading...
Searching...
No Matches
AnalyzerCurve.h
1#pragma once
2
3#include "PluginProcessor.h"
4#include <JuceHeader.h>
5
6class AnalyzerCurve : public juce::Component, juce::Timer
7{
8 public:
10 ~AnalyzerCurve() override;
11
12 void paint(juce::Graphics &g) override;
13 void resized() override;
14 void timerCallback() override;
15
16 private:
17 AudioPluginAudioProcessor &mProcessor;
18 juce::dsp::FFT mFFT{12};
19 juce::dsp::WindowingFunction<float> mWindow{static_cast<size_t>(mFFT.getSize()),
20 juce::dsp::WindowingFunction<float>::hann};
21 juce::AudioBuffer<float> mFFTBuffer{1, mFFT.getSize() * 2};
22 juce::AudioBuffer<float> avgFFTBuffer{5, mFFT.getSize() / 2};
23 int avgFFTBufferPtr = 1;
24
25 juce::Path mFFTPath;
26 juce::CriticalSection pathCreationLock;
27 int mSampleRate;
28
29 struct FFTPoint
30 {
31 int firstBinIndex = 0;
32 int lastBinIndex = 120;
33
34 int x;
35 };
36
37 size_t fftPointsSize = 0;
38 std::vector<FFTPoint> mFFTPoints;
39
40 float getFFTPointLevel(const float *buffer, const FFTPoint &point);
41
42 static constexpr float maxdB = 0.0;
43 static constexpr float mindB = -100.0;
44
45 void drawNextFrame();
46
47 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(AnalyzerCurve)
48};
Definition AnalyzerCurve.h:7
Definition PluginProcessor.h:9