mirror of
https://codeberg.org/armin/pascalcompressor.git
synced 2026-10-11 16:51:56 +02:00
77 lines
No EOL
2.2 KiB
C++
77 lines
No EOL
2.2 KiB
C++
#pragma once
|
|
|
|
#include <juce_audio_utils/juce_audio_utils.h>
|
|
#include <functional>
|
|
#include "PluginProcessor.h"
|
|
|
|
namespace pascal
|
|
{
|
|
|
|
inline const juce::Colour background (0xFF101014);
|
|
inline const juce::Colour track (0xFF2A2A30);
|
|
inline const juce::Colour accent (0xFFEDEDF2);
|
|
inline const juce::Colour labelColour (0xFF9A9AA2);
|
|
inline const juce::Colour valueColour (0xFFC8C8D0);
|
|
inline const juce::Colour footerColour (0xFF6A6A72);
|
|
inline const juce::Colour ruleColour (0xFF1E1E23);
|
|
|
|
class MinimalLookAndFeel final : public juce::LookAndFeel_V4
|
|
{
|
|
public:
|
|
void drawRotarySlider (juce::Graphics& g, int x, int y, int width, int height,
|
|
float sliderPos, float rotaryStartAngle, float rotaryEndAngle,
|
|
juce::Slider& slider) override;
|
|
};
|
|
|
|
class KnobComponent final : public juce::Component, private juce::Slider::Listener
|
|
{
|
|
public:
|
|
KnobComponent (juce::AudioProcessorValueTreeState& apvts, const juce::String& paramId,
|
|
const juce::String& displayName, float defaultValue,
|
|
juce::LookAndFeel& lnf, std::function<juce::String (double)> format);
|
|
|
|
void resized() override;
|
|
|
|
private:
|
|
void sliderValueChanged (juce::Slider*) override;
|
|
|
|
juce::Slider slider;
|
|
juce::Label nameLabel;
|
|
juce::Label valueLabel;
|
|
std::function<juce::String (double)> format;
|
|
std::unique_ptr<juce::AudioProcessorValueTreeState::SliderAttachment> attachment;
|
|
};
|
|
|
|
class FooterBar final : public juce::Component, private juce::Timer
|
|
{
|
|
public:
|
|
explicit FooterBar (PascalcompressorAudioProcessor& p);
|
|
|
|
void paint (juce::Graphics&) override;
|
|
|
|
private:
|
|
void timerCallback() override;
|
|
|
|
PascalcompressorAudioProcessor& processor;
|
|
juce::String leftText;
|
|
juce::String rightText;
|
|
};
|
|
|
|
class PascalcompressorAudioProcessorEditor final : public juce::AudioProcessorEditor
|
|
{
|
|
public:
|
|
explicit PascalcompressorAudioProcessorEditor (PascalcompressorAudioProcessor&);
|
|
~PascalcompressorAudioProcessorEditor() override = default;
|
|
|
|
void paint (juce::Graphics&) override;
|
|
void resized() override;
|
|
|
|
private:
|
|
PascalcompressorAudioProcessor& processorRef;
|
|
MinimalLookAndFeel lookAndFeel;
|
|
juce::OwnedArray<KnobComponent> knobs;
|
|
FooterBar footer;
|
|
bool ready = false;
|
|
};
|
|
|
|
} |