mirror of
https://codeberg.org/armin/horizont.git
synced 2026-09-01 04:10:46 +02:00
update
This commit is contained in:
parent
ed28db30a3
commit
6c0d072465
19 changed files with 2212 additions and 0 deletions
43
Source/SpectrumDisplay.h
Normal file
43
Source/SpectrumDisplay.h
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#pragma once
|
||||
|
||||
#include <JuceHeader.h>
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "PluginProcessor.h"
|
||||
|
||||
class SpectrumDisplay : public juce::Component, private juce::Timer
|
||||
{
|
||||
public:
|
||||
explicit SpectrumDisplay (HorizontAudioProcessor&);
|
||||
~SpectrumDisplay() override;
|
||||
|
||||
void paint (juce::Graphics&) override;
|
||||
void setScaleFactor (float scale);
|
||||
|
||||
private:
|
||||
void timerCallback() override;
|
||||
|
||||
HorizontAudioProcessor& processor;
|
||||
|
||||
static constexpr int fftOrder = 10;
|
||||
static constexpr int fftSize = 1 << fftOrder;
|
||||
static constexpr int numBins = 48;
|
||||
|
||||
void computeLevels (const float* samples, int got, std::array<float, numBins>& out);
|
||||
juce::Path makeCurve (const juce::Rectangle<float>& graph, const std::array<float, numBins>& data) const;
|
||||
|
||||
juce::dsp::FFT fft { fftOrder };
|
||||
std::vector<float> fftData = std::vector<float> (2 * fftSize, 0.0f);
|
||||
std::vector<float> window;
|
||||
std::array<float, numBins> level {};
|
||||
std::array<float, numBins> display {};
|
||||
std::array<float, numBins> peak {};
|
||||
std::array<float, numBins> dryLevel {};
|
||||
std::array<float, numBins> dryDisplay {};
|
||||
std::array<float, numBins> dryPeak {};
|
||||
|
||||
float scaleFactor = 1.0f;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SpectrumDisplay)
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue