Vital
Loading...
Searching...
No Matches
bend_section.h
Go to the documentation of this file.
1
3
4#pragma once
5
6#include "JuceHeader.h"
7#include "synth_section.h"
8#include "synth_slider.h"
9
11
17class ControlWheel : public SynthSlider {
18public:
20 static constexpr float kBufferWidthRatio = 0.05f;
22 static constexpr float kWheelRoundAmountRatio = 0.25f;
24 static constexpr float kContainerRoundAmountRatio = 0.15f;
25
28 ControlWheel(String name);
29
35 void paintLine(Graphics& g, float y_percent, Colour line_color, Colour fill_color);
36
39 void paint(Graphics& g) override;
40
42 void parentHierarchyChanged() override;
43
44protected:
46
47 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ControlWheel)
48};
49
52class ModWheel : public ControlWheel {
53public:
55 ModWheel();
57 virtual ~ModWheel() = default;
58
59private:
60 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ModWheel)
61};
62
67class PitchWheel : public ControlWheel {
68public:
70 PitchWheel();
72 virtual ~PitchWheel() = default;
73
76 void mouseUp(const MouseEvent& e) override;
77
78private:
79 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PitchWheel)
80};
81
84class BendSection : public SynthSection {
85public:
88 BendSection(const String& name);
89
92
95 void paintBackground(Graphics& g) override;
96
99 void paintBackgroundShadow(Graphics& g) override { paintTabShadow(g); }
100
102 void resized() override;
103
106 void sliderValueChanged(Slider* changed_slider) override;
107
108private:
109 std::unique_ptr<PitchWheel> pitch_wheel_;
110 std::unique_ptr<ModWheel> mod_wheel_;
111
112 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(BendSection)
113};
A UI section containing both pitch and modulation wheels.
Definition bend_section.h:84
BendSection(const String &name)
Constructor for BendSection.
Definition bend_section.cpp:129
void paintBackground(Graphics &g) override
Paints the background of the BendSection.
Definition bend_section.cpp:145
void paintBackgroundShadow(Graphics &g) override
Definition bend_section.h:99
void sliderValueChanged(Slider *changed_slider) override
Called when a slider value changes in the BendSection (pitch or mod wheel).
Definition bend_section.cpp:168
~BendSection()
Destructor.
void resized() override
Resizes and lays out the wheels.
Definition bend_section.cpp:153
A specialized SynthSlider representing a wheel control (pitch or modulation).
Definition bend_section.h:17
ControlWheel(String name)
Constructor for ControlWheel.
Definition bend_section.cpp:13
static constexpr float kBufferWidthRatio
Ratio of width used as a buffer space inside the wheel.
Definition bend_section.h:20
SynthGuiInterface * parent_
Reference to the parent SynthGuiInterface.
Definition bend_section.h:45
void parentHierarchyChanged() override
Called when the component's parent hierarchy changes.
Definition bend_section.cpp:109
void paintLine(Graphics &g, float y_percent, Colour line_color, Colour fill_color)
Paints a line segment representing the wheel position.
Definition bend_section.cpp:21
void paint(Graphics &g) override
Paints the ControlWheel.
Definition bend_section.cpp:56
static constexpr float kContainerRoundAmountRatio
Ratio for the rounded corner of the container.
Definition bend_section.h:24
static constexpr float kWheelRoundAmountRatio
Ratio for the rounded amount of the wheel arc.
Definition bend_section.h:22
A modulation wheel control, typically for controlling modulation depth.
Definition bend_section.h:52
ModWheel()
Constructor.
Definition bend_section.cpp:117
virtual ~ModWheel()=default
Destructor.
A pitch wheel control, typically for controlling pitch bending.
Definition bend_section.h:67
void mouseUp(const MouseEvent &e) override
Mouse up event for PitchWheel resets the value to 0.
Definition bend_section.cpp:123
PitchWheel()
Constructor.
Definition bend_section.cpp:120
virtual ~PitchWheel()=default
Destructor.
An interface class linking the Vital synthesizer backend (SynthBase) with a GUI.
Definition synth_gui_interface.h:56
Base class for all synthesizer sections, providing UI layout, painting, and interaction logic.
Definition synth_section.h:193
virtual void paintTabShadow(Graphics &g)
Paints a tab-like shadow effect around the component.
Definition synth_section.cpp:188
A specialized slider with extended functionality for modulation, parameter control,...
Definition synth_slider.h:314
Declares the SynthSlider and related classes, providing various slider styles and functionality in th...