18 class Handle :
public juce::Component
21 static constexpr int handleSize = 20;
22 Handle(Filter::Type type, juce::RangedAudioParameter *bypassParam, juce::RangedAudioParameter *freqParam,
23 juce::RangedAudioParameter *filterOrder, juce::RangedAudioParameter *gainParam =
nullptr,
24 juce::RangedAudioParameter *qParam =
nullptr);
26 void paint(juce::Graphics &g)
override;
27 void mouseDown(
const juce::MouseEvent &event)
override;
28 void mouseDrag(
const juce::MouseEvent &event)
override;
29 void mouseWheelMove(
const juce::MouseEvent &event,
const juce::MouseWheelDetails &wheel)
override;
30 void updateFrequencyPositionFromParameter(
float newValue);
31 void updateGainPositionFromParameter(
float newValue);
32 void updateFilerOrderFromParameter(
float newValue);
34 juce::RangedAudioParameter *mBypassParameter;
35 juce::RangedAudioParameter *mFreqParameter;
36 juce::RangedAudioParameter *mGainParameter;
37 juce::RangedAudioParameter *mQParameter;
38 juce::RangedAudioParameter *mFilterOrder;
40 std::unique_ptr<Filter> mFilter;
43 juce::ComponentDragger dragger;
44 juce::ComponentBoundsConstrainer constrainer;
46 std::unique_ptr<juce::ParameterAttachment> mBypassAttachment{
nullptr};
47 std::unique_ptr<juce::ParameterAttachment> mFilterOrderAttachment{
nullptr};
48 std::unique_ptr<juce::ParameterAttachment> mFreqAttachment{
nullptr};
49 std::unique_ptr<juce::ParameterAttachment> mGainAttachment{
nullptr};
50 std::unique_ptr<juce::ParameterAttachment> mQAttachment{
nullptr};
52 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Handle)
58 void resized()
override;
59 void paint(juce::Graphics &g)
override;
61 void drawGrid(juce::Graphics &g);
62 void drawTextLabels(juce::Graphics &g);
63 void drawVerticalLines(juce::Graphics &g);
64 void drawHorizontalLines(juce::Graphics &g);
65 void drawPlotCurve(juce::Graphics &g);
66 void updateFrequencyResponse();
67 std::vector<std::unique_ptr<Handle>> &getHandles()
72 std::vector<float> getFrequencies();
73 std::vector<float> getXs(
const std::vector<float> &freqs,
float left,
float width);
74 std::vector<int> getGains();
76 juce::Rectangle<int> getRenderArea();
80 juce::AudioProcessorValueTreeState &mParameters;
82 juce::Path frequencyResponse;
84 juce::Component handleContainer;
85 juce::Font deathMetalFont;
86 static constexpr int reducedSize = 30;
88 std::atomic<bool> parameterChanged{
false};
90 std::vector<std::unique_ptr<Handle>> mHandles;
92 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
EQView)