fsh::stk
fantastic spatial holophonic synthesis toolkit
Loading...
Searching...
No Matches
Knob.h
1/***************************************************************************************************
2 ██████ █████ █████ █████
3 ███░░███ ░░███ ░░███ ░░███
4 ░███ ░░░ █████ ░███████ ██ ██ █████ ███████ ░███ █████
5 ███████ ███░░ ░███░░███ ░░ ░░ ███░░ ░░░███░ ░███░░███
6 ░░░███░ ░░█████ ░███ ░███ ░░█████ ░███ ░██████░
7 ░███ ░░░░███ ░███ ░███ ░░░░███ ░███ ███ ░███░░███
8 █████ ██████ ████ █████ ██ ██ ██████ ░░█████ ████ █████
9 ░░░░░ ░░░░░░ ░░░░ ░░░░░ ░░ ░░ ░░░░░░ ░░░░░ ░░░░ ░░░░░
10
11 fantastic spatial holophonic synthesis tool kit
12
13 copyright (c) fabian hummel
14 www.github.com/fshstk
15 www.fshstk.com
16
17 this file is part of the fantastic spatial holophonic synthesis toolkit (fsh::stk)
18 fsh::stk is free software: it is provided under the terms of the gnu general public license v3.0
19 www.gnu.org/licenses/gpl-3.0
20***************************************************************************************************/
21
22#pragma once
23#include "Colors.h"
24#include "StateManager.h"
25#include <juce_gui_basics/juce_gui_basics.h>
26
27namespace fsh::gui
28{
34class Knob : public juce::Slider
35{
36public:
38 enum class Behavior
39 {
40 Bounded,
41 Endless
42 };
43
45 struct Params
46 {
47 juce::Colour color = Colors::dark;
49 float knobRangeDegrees = 270.0f;
50 float notchWidthDegrees = 7.0f;
51 float notchDepthFraction = 0.7f;
52 };
53
55 explicit Knob(const Params&);
56
58 void attach(plugin::StateManager&, juce::ParameterID);
59
60private:
61 std::unique_ptr<plugin::StateManager::SliderAttachment> _attachment;
62 void paint(juce::Graphics& g) override;
63 Params _params;
64};
65} // namespace fsh::gui
Custom knob component that displays a label and a value.
Definition Knob.h:35
void attach(plugin::StateManager &, juce::ParameterID)
Attach this knob to a parameter.
Definition Knob.cpp:98
Knob(const Params &)
Constructor.
Definition Knob.cpp:71
Behavior
Defines the behavior of the knob when the user drags it beyond its range.
Definition Knob.h:39
@ Endless
The knob will wrap around when the user drags it beyond its range.
@ Bounded
The knob will stop at its minimum and maximum values.
Base class for storing plugin state.
Definition StateManager.h:39
static const auto dark
Dark.
Definition Colors.h:40
Parameters for the Knob component.
Definition Knob.h:46
float notchDepthFraction
Depth of the indicator notch as a fraction of the radius.
Definition Knob.h:51
float knobRangeDegrees
Range of the knob in degrees.
Definition Knob.h:49
float notchWidthDegrees
Width of the indicator notch in degrees.
Definition Knob.h:50
Behavior behavior
Behavior of the knob.
Definition Knob.h:48
juce::Colour color
Color of the knob.
Definition Knob.h:47