Vital
Loading...
Searching...
No Matches
envelope_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
10class SynthSlider;
11
18public:
21 class Listener {
22 public:
23 virtual ~Listener() { }
26 virtual void magnifyDragged(Point<float> delta) = 0;
28 virtual void magnifyDoubleClicked() = 0;
29 };
30
33
36 void mouseDown(const MouseEvent& e) override;
37
40 void mouseUp(const MouseEvent& e) override;
41
44 void mouseDrag(const MouseEvent& e) override;
45
48 void mouseDoubleClick(const MouseEvent& e) override;
49
52 void addListener(Listener* listener) { listeners_.push_back(listener); }
53
54private:
55 Point<float> last_position_;
56 Point<int> mouse_down_position_;
57 std::vector<Listener*> listeners_;
58};
59
67public:
73 EnvelopeSection(String name, std::string value_prepend,
74 const vital::output_map& mono_modulations,
75 const vital::output_map& poly_modulations);
76
78 virtual ~EnvelopeSection();
79
82 void paintBackground(Graphics& g) override;
83
85 void resized() override;
86
88 void reset() override;
89
92 void magnifyDragged(Point<float> delta) override;
93
95 void magnifyDoubleClicked() override;
96
97private:
98 std::unique_ptr<EnvelopeEditor> envelope_;
99 std::unique_ptr<SynthSlider> delay_;
100 std::unique_ptr<SynthSlider> attack_;
101 std::unique_ptr<SynthSlider> attack_power_;
102 std::unique_ptr<SynthSlider> hold_;
103 std::unique_ptr<SynthSlider> decay_;
104 std::unique_ptr<SynthSlider> decay_power_;
105 std::unique_ptr<SynthSlider> sustain_;
106 std::unique_ptr<SynthSlider> release_;
107 std::unique_ptr<SynthSlider> release_power_;
108 std::unique_ptr<DragMagnifyingGlass> drag_magnifying_glass_;
109
110 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(EnvelopeSection)
111};
Interface for objects that need to respond to magnification changes.
Definition envelope_section.h:21
virtual void magnifyDragged(Point< float > delta)=0
virtual ~Listener()
Definition envelope_section.h:23
virtual void magnifyDoubleClicked()=0
Called when the magnifying glass is double-clicked.
A draggable magnification control for the envelope editor.
Definition envelope_section.h:17
void mouseUp(const MouseEvent &e) override
Definition envelope_section.cpp:29
void mouseDrag(const MouseEvent &e) override
Definition envelope_section.cpp:40
void mouseDown(const MouseEvent &e) override
Definition envelope_section.cpp:17
void mouseDoubleClick(const MouseEvent &e) override
Definition envelope_section.cpp:51
void addListener(Listener *listener)
Definition envelope_section.h:52
DragMagnifyingGlass()
Constructor.
Definition envelope_section.cpp:13
A graphical editor for envelope shapes with interactive points and power curves.
Definition envelope_editor.h:19
A UI section for configuring and visualizing ADSR envelopes.
Definition envelope_section.h:66
EnvelopeSection(String name, std::string value_prepend, const vital::output_map &mono_modulations, const vital::output_map &poly_modulations)
Definition envelope_section.cpp:58
void magnifyDoubleClicked() override
Called when the magnifying glass is double-clicked. Resets envelope zoom.
Definition envelope_section.cpp:168
virtual ~EnvelopeSection()
Destructor.
Definition envelope_section.cpp:124
void reset() override
Resets the envelope editor to its default positions.
Definition envelope_section.cpp:159
void resized() override
Resizes and lays out child components, including the envelope editor and sliders.
Definition envelope_section.cpp:139
void magnifyDragged(Point< float > delta) override
Definition envelope_section.cpp:164
void paintBackground(Graphics &g) override
Definition envelope_section.cpp:126
A ToggleButton that uses an OpenGlShapeButtonComponent for its rendering.
Definition synth_button.h:110
Base class for all synthesizer sections, providing UI layout, painting, and interaction logic.
Definition synth_section.h:193
A specialized slider with extended functionality for modulation, parameter control,...
Definition synth_slider.h:314
std::map< std::string, Output * > output_map
Maps parameter names to Output pointers, representing output signals from various modules.
Definition synth_types.h:229