Vital
Loading...
Searching...
No Matches
modulation_meter.h
Go to the documentation of this file.
1#pragma once
2
3#include "JuceHeader.h"
4#include "common.h"
5
7class SynthSlider;
8namespace vital {
9 struct Output;
10}
11
21class ModulationMeter : public Component {
22public:
31 ModulationMeter(const vital::Output* mono_total, const vital::Output* poly_total,
32 const SynthSlider* slider, OpenGlMultiQuad* quads, int index);
33
37 virtual ~ModulationMeter();
38
44 void resized() override;
45
50 void setActive(bool active);
51
56 void updateDrawing(bool use_poly);
57
64 void setModulationAmountQuad(OpenGlQuad& quad, float amount, bool bipolar);
65
71
76 bool isModulated() const { return modulated_; }
77
82 bool isRotary() const { return rotary_; }
83
88 void setModulated(bool modulated) { modulated_ = modulated; }
89
94 vital::poly_float getModPercent() { return mod_percent_; }
95
100 const SynthSlider* destination() { return destination_; }
101
102private:
103 ModulationMeter() = delete;
104
109 Rectangle<float> getMeterBounds();
110
114 void setVertices();
115
119 void collapseVertices();
120
121 const vital::Output* mono_total_;
122 const vital::Output* poly_total_;
123 const SynthSlider* destination_;
124
125 OpenGlMultiQuad* quads_;
126 int index_;
127
128 vital::poly_float current_value_;
129 vital::poly_float mod_percent_;
130
131 bool modulated_;
132 bool rotary_;
133
134 float left_, right_, top_, bottom_;
135
136 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ModulationMeter)
137};
A visual component that displays the current modulation amount applied to a slider parameter.
Definition modulation_meter.h:21
void resized() override
Called when the component is resized.
Definition modulation_meter.cpp:27
void setModulationAmountQuad(OpenGlQuad &quad, float amount, bool bipolar)
Sets the given quad to represent a modulation amount line or arc.
Definition modulation_meter.cpp:180
bool isModulated() const
Checks whether there are any modulations on the associated parameter.
Definition modulation_meter.h:76
void updateDrawing(bool use_poly)
Updates the drawing of the modulation meter, recalculating mod percent and visuals.
Definition modulation_meter.cpp:144
vital::poly_float getModPercent()
Gets the current modulation percentage.
Definition modulation_meter.h:94
const SynthSlider * destination()
Gets the destination slider that the meter is visualizing.
Definition modulation_meter.h:100
bool isRotary() const
Checks if the associated parameter control is a rotary knob.
Definition modulation_meter.h:82
void setActive(bool active)
Sets whether the modulation meter is active (visible and updating).
Definition modulation_meter.cpp:42
void setModulated(bool modulated)
Sets the modulated state of the meter.
Definition modulation_meter.h:88
void setAmountQuadVertices(OpenGlQuad &quad)
Sets up the quad coordinates for the modulation amount indicator.
Definition modulation_meter.cpp:115
virtual ~ModulationMeter()
Destructor.
Definition modulation_meter.cpp:25
A component for rendering multiple quads using OpenGL, with customizable colors, rounding,...
Definition open_gl_multi_quad.h:16
A convenience class for a single quad rendered via OpenGL.
Definition open_gl_multi_quad.h:447
A specialized slider with extended functionality for modulation, parameter control,...
Definition synth_slider.h:314
Contains classes and functions used within the Vital synthesizer framework.
Holds and manages a buffer of samples (poly_float) for a Processor's output.
Definition processor.h:35
Represents a vector of floating-point values using SIMD instructions.
Definition poly_values.h:600