mirror of
https://codeberg.org/armin/horizont.git
synced 2026-09-01 12:20:47 +02:00
31 lines
795 B
C
31 lines
795 B
C
|
|
#pragma once
|
||
|
|
|
||
|
|
#include <JuceHeader.h>
|
||
|
|
|
||
|
|
class Knob : public juce::Component
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
Knob (const juce::String& title,
|
||
|
|
juce::AudioProcessorValueTreeState& apvts,
|
||
|
|
const juce::String& paramID,
|
||
|
|
float defaultValue,
|
||
|
|
std::function<juce::String (float)> format,
|
||
|
|
const juce::String& tooltip);
|
||
|
|
|
||
|
|
void paint (juce::Graphics&) override;
|
||
|
|
void resized() override;
|
||
|
|
void setScaleFactor (float scale);
|
||
|
|
|
||
|
|
private:
|
||
|
|
void updateValueLabel();
|
||
|
|
|
||
|
|
std::function<juce::String (float)> format;
|
||
|
|
juce::Label nameLabel;
|
||
|
|
juce::Label valueLabel;
|
||
|
|
juce::Slider slider;
|
||
|
|
std::unique_ptr<juce::AudioProcessorValueTreeState::SliderAttachment> attachment;
|
||
|
|
|
||
|
|
float scaleFactor = 1.0f;
|
||
|
|
|
||
|
|
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Knob)
|
||
|
|
};
|