gelyk/Source/PluginEditor.h
2026-08-29 13:17:11 +02:00

83 lines
2.6 KiB
C++

#pragma once
#include <JuceHeader.h>
#include "PluginProcessor.h"
namespace gelyk
{
class NeonLookAndFeel : public juce::LookAndFeel_V4
{
public:
NeonLookAndFeel();
void drawLinearSlider(juce::Graphics&, int x, int y, int width, int height,
float sliderPos, float minSliderPos, float maxSliderPos,
const juce::Slider::SliderStyle, juce::Slider&) override;
void drawComboBox(juce::Graphics&, int width, int height, bool isButtonDown,
int buttonX, int buttonY, int buttonW, int buttonH,
juce::ComboBox&) override;
void positionComboBoxText(juce::ComboBox&, juce::Label&) override;
juce::Colour cyan { 0xff00e5ff };
juce::Colour magenta{ 0xffff2fd6 };
juce::Colour violet { 0xff8a2be2 };
juce::Colour bg { 0xff0b0f16 };
juce::Colour panel { 0xff121a24 };
juce::Colour line { 0xff1f2a38 };
juce::Colour textDim{ 0xff7a8aa0 };
};
// ---------------------------------------------------------------------------
class GelykEQAudioProcessorEditor final : public juce::AudioProcessorEditor,
public juce::Timer
{
public:
explicit GelykEQAudioProcessorEditor(GelykEQAudioProcessor&);
~GelykEQAudioProcessorEditor() override;
void paint(juce::Graphics&) override;
void resized() override;
void timerCallback() override;
private:
void rebuildFaders();
void scaleUI(float percent);
GelykEQAudioProcessor& processor;
NeonLookAndFeel lookAndFeel;
static constexpr int numBands = 5;
struct BandWidget
{
std::unique_ptr<juce::Slider> gain;
std::unique_ptr<juce::Slider> q;
std::unique_ptr<juce::Label> freqLabel;
std::unique_ptr<juce::Label> gainLabel;
};
BandWidget bands[numBands];
std::unique_ptr<juce::Label> masterLabel;
std::unique_ptr<juce::Slider> master;
std::unique_ptr<juce::ComboBox> scaleBox;
std::unique_ptr<juce::Label> titleLabel;
std::unique_ptr<juce::Label> statusBar;
std::unique_ptr<juce::Label> statusGit;
juce::AudioProcessorValueTreeState::SliderAttachment gainAttachments[numBands];
juce::AudioProcessorValueTreeState::SliderAttachment qAttachments[numBands];
std::unique_ptr<juce::AudioProcessorValueTreeState::SliderAttachment> masterAttachment;
juce::AudioProcessorValueTreeState::ParameterAttachment analyserAttachment;
juce::Array<float> spectrum;
juce::Array<float> freqBins;
std::atomic<float> scaling { 1.0f }; // for resized()
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(GelykEQAudioProcessorEditor)
};
} // namespace gelyk