13 static constexpr double kKnobSensitivity = 0.2;
16 polyphony_ = std::make_unique<SynthSlider>(
"polyphony");
18 polyphony_->setSliderStyle(Slider::RotaryHorizontalVerticalDrag);
19 polyphony_->setSensitivity(kKnobSensitivity);
21 polyphony_->useSuffix(
false);
24 velocity_track_ = std::make_unique<SynthSlider>(
"velocity_track");
26 velocity_track_->setSliderStyle(Slider::RotaryHorizontalVerticalDrag);
27 velocity_track_->setBipolar(
true);
30 pitch_bend_range_ = std::make_unique<SynthSlider>(
"pitch_bend_range");
32 pitch_bend_range_->setSliderStyle(Slider::RotaryHorizontalVerticalDrag);
33 pitch_bend_range_->setSensitivity(kKnobSensitivity);
35 pitch_bend_range_->useSuffix(
false);
38 stereo_routing_ = std::make_unique<SynthSlider>(
"stereo_routing");
39 stereo_routing_->setSliderStyle(Slider::RotaryHorizontalVerticalDrag);
43 stereo_mode_text_ = std::make_unique<PlainTextComponent>(
"Stereo Mode Text",
"---");
47 stereo_mode_type_selector_ = std::make_unique<ShapeButton>(
"Stereo Mode", Colours::black,
48 Colours::black, Colours::black);
49 addAndMakeVisible(stereo_mode_type_selector_.get());
50 stereo_mode_type_selector_->addListener(
this);
51 stereo_mode_type_selector_->setTriggeredOnMouseDown(
true);
78 int text_height = getHeight() - 2 * widget_margin;
81 polyphony_->setBounds(widget_margin, widget_margin, text_width, text_height);
82 pitch_bend_range_->setBounds(polyphony_->getRight() + widget_margin, widget_margin, text_width, text_height);
85 int knobs_x = pitch_bend_range_->getRight();
86 Rectangle<int> knob_bounds(knobs_x, 0, getWidth() - knobs_x, getHeight());
87 placeKnobsInArea(knob_bounds, { velocity_track_.get(), stereo_routing_.get() });
91 stereo_mode_text_->setBounds(stereo_label_bounds);
93 stereo_mode_type_selector_->setBounds(stereo_label_bounds);
100 int stereo_mode = controls[
"stereo_mode"]->value();
106 if (clicked_button == stereo_mode_type_selector_.get()) {
109 for (
int i = 0; i < num_modes; ++i)
112 showPopupSelector(
this, Point<int>(clicked_button->getX(), clicked_button->getBottom()), options,
113 [=](
int selection) { setStereoModeSelected(selection); });
@ kWidgetMargin
Definition skin.h:103
@ kLabelHeight
Definition skin.h:72
@ kModulationButtonWidth
Definition skin.h:101
@ kBodyText
Definition skin.h:133
@ kKeyboard
Definition skin.h:44
void valueChangedInternal(const std::string &name, vital::mono_float value)
Handles internal value changes, updating the parameter and optionally notifying the host.
Definition synth_base.cpp:54
An interface class linking the Vital synthesizer backend (SynthBase) with a GUI.
Definition synth_gui_interface.h:56
SynthBase * getSynth()
Returns the SynthBase instance this interface is managing.
Definition synth_gui_interface.h:85
Base class for all synthesizer sections, providing UI layout, painting, and interaction logic.
Definition synth_section.h:193
void drawTextComponentBackground(Graphics &g, Rectangle< int > bounds, bool extend_to_label)
Draws a background for a text component area.
Definition synth_section.cpp:319
virtual void buttonClicked(Button *clicked_button) override
Called when a button is clicked. Updates the synth parameter accordingly.
Definition synth_section.cpp:398
void placeKnobsInArea(Rectangle< int > area, std::vector< Component * > knobs)
Definition synth_section.cpp:601
void addSlider(SynthSlider *slider, bool show=true, bool listen=true)
Definition synth_section.cpp:445
void paintOpenGlChildrenBackgrounds(Graphics &g)
Paints the backgrounds for all OpenGL child components.
Definition synth_section.cpp:267
virtual void resized() override
Called when the component is resized. Arranges layout of child components.
Definition synth_section.cpp:35
virtual void paintBody(Graphics &g, Rectangle< int > bounds)
Paints the body background within given bounds.
Definition synth_section.cpp:165
void paintKnobShadows(Graphics &g)
Paints knob shadows for all sliders.
Definition synth_section.cpp:253
void drawLabelForComponent(Graphics &g, String text, Component *component, bool text_component=false)
Draws a label for a given component.
Definition synth_section.h:548
void setLabelFont(Graphics &g)
Sets the Graphics context font and color for labels.
Definition synth_section.cpp:740
void showPopupSelector(Component *source, Point< int > position, const PopupItems &options, std::function< void(int)> callback, std::function< void()> cancel={ })
Shows a popup selector with options.
Definition synth_section.cpp:119
Rectangle< int > getLabelBackgroundBounds(Rectangle< int > bounds, bool text_component=false)
Gets the background bounds for a label.
Definition synth_section.cpp:782
float findValue(Skin::ValueId value_id) const
Finds a value in the skin overrides or from the parent if not found locally.
Definition synth_section.cpp:18
virtual void paintBorder(Graphics &g, Rectangle< int > bounds)
Paints the border around given bounds.
Definition synth_section.cpp:170
void addOpenGlComponent(OpenGlComponent *open_gl_component, bool to_beginning=false)
Definition synth_section.cpp:489
virtual void setAllValues(vital::control_map &controls)
Sets values for all known parameters from a control map.
Definition synth_section.cpp:827
void setSkinOverride(Skin::SectionOverride skin_override)
Definition synth_section.h:303
static TextLookAndFeel * instance()
Singleton instance access.
Definition text_look_and_feel.h:106
virtual ~VoiceSection()
Destructor.
Definition voice_section.cpp:56
VoiceSection(String name)
Constructs a VoiceSection with a given name.
Definition voice_section.cpp:12
void setAllValues(vital::control_map &controls) override
Updates all parameter values from a given control map.
Definition voice_section.cpp:98
void paintBackground(Graphics &g) override
Paints the background of the voice section, including labels and shadows.
Definition voice_section.cpp:58
void buttonClicked(Button *clicked_button) override
Handles button click events for this section.
Definition voice_section.cpp:104
void resized() override
Lays out child components and adjusts sizing after a resize event.
Definition voice_section.cpp:74
void setStereoModeSelected(int selection)
Sets the selected stereo mode.
Definition voice_section.cpp:119
@ kNumStereoModes
Definition operators.h:524
const std::string kStereoModeNames[vital::StereoEncoder::kNumStereoModes]
Names for stereo routing modes.
Definition synth_strings.h:261
std::map< std::string, Value * > control_map
Maps parameter names to Value pointers representing synth control parameters.
Definition synth_types.h:214
Declares the SynthSlider and related classes, providing various slider styles and functionality in th...