18 float getOpenGlYForDb(
float db) {
20 return 2.0f * t - 1.0f;
40 return getOpenGlYForDb(db);
54 void setQuadIfRatioMatch(
OpenGlMultiQuad& quads,
float ratio,
float ratio_match,
55 int index,
float x,
float y,
float w,
float h) {
56 if (ratio == ratio_match || (ratio > 0.0f && ratio_match > 0.0f) || (ratio < 0.0f && ratio_match < 0.0f))
57 quads.
setQuad(index, x, y, w, h);
59 quads.
setQuad(index, -2.0f, -2.0f, 0.0f, 0.0f);
68 std::string formatString(
float value, std::string suffix) {
69 static constexpr int kMaxDecimalPlaces = 4;
70 String format = String(value, kMaxDecimalPlaces);
72 int display_characters = kMaxDecimalPlaces;
74 display_characters += 1;
76 format = format.substring(0, display_characters);
77 if (format.getLastCharacter() ==
'.')
78 format = format.removeCharacters(
".");
80 return format.toStdString() + suffix;
85 input_dbs_(kNumChannels,
Shaders::kColorFragment),
86 output_dbs_(kNumChannels,
Shaders::kRoundedRectangleFragment),
87 thresholds_(kNumChannels,
Shaders::kColorFragment),
88 ratio_lines_(kTotalRatioLines,
Shaders::kFadeSquareFragment) {
90 addAndMakeVisible(hover_quad_);
91 addAndMakeVisible(input_dbs_);
92 addAndMakeVisible(output_dbs_);
93 addAndMakeVisible(thresholds_);
94 addAndMakeVisible(ratio_lines_);
97 section_parent_ =
nullptr;
100 high_band_active_ =
true;
101 low_band_active_ =
true;
106 low_upper_threshold_ =
kMaxDb;
107 band_upper_threshold_ =
kMaxDb;
108 high_upper_threshold_ =
kMaxDb;
109 low_lower_threshold_ =
kMinDb;
110 band_lower_threshold_ =
kMinDb;
111 high_lower_threshold_ =
kMinDb;
112 low_upper_ratio_ = 0.0f;
113 band_upper_ratio_ = 0.0f;
114 high_upper_ratio_ = 0.0f;
115 low_lower_ratio_ = 0.0f;
116 band_lower_ratio_ = 0.0f;
117 high_lower_ratio_ = 0.0f;
119 low_input_ms_ =
nullptr;
120 band_input_ms_ =
nullptr;
121 high_input_ms_ =
nullptr;
123 low_output_ms_ =
nullptr;
124 band_output_ms_ =
nullptr;
125 high_output_ms_ =
nullptr;
130CompressorEditor::DragPoint CompressorEditor::getHoverPoint(
const MouseEvent& e) {
132 int index = low_band_high_position;
133 float local_position = low_band_high_position - index;
137 if (index == 0 && !low_band_active_)
139 if (index == 2 && !high_band_active_)
142 float upper_threshold_values[] = { low_upper_threshold_, band_upper_threshold_, high_upper_threshold_ };
143 float lower_threshold_values[] = { low_lower_threshold_, band_lower_threshold_, high_lower_threshold_ };
144 DragPoint upper_threshold_points[] = { kLowUpperThreshold, kBandUpperThreshold, kHighUpperThreshold };
145 DragPoint lower_threshold_points[] = { kLowLowerThreshold, kBandLowerThreshold, kHighLowerThreshold };
146 DragPoint upper_ratio_points[] = { kLowUpperRatio, kBandUpperRatio, kHighUpperRatio };
147 DragPoint lower_ratio_points[] = { kLowLowerRatio, kBandLowerRatio, kHighLowerRatio };
150 int upper_handle_y = std::max(grab_radius, getYForDb(upper_threshold_values[index]));
151 int lower_handle_y = std::min(getHeight() - grab_radius, getYForDb(lower_threshold_values[index]));
153 float delta_upper = e.position.y - upper_handle_y;
154 float delta_lower = e.position.y - lower_handle_y;
155 if (fabsf(delta_upper) <= grab_radius && fabsf(delta_upper) < fabsf(delta_lower))
156 return upper_threshold_points[index];
157 if (fabsf(delta_lower) <= grab_radius)
158 return lower_threshold_points[index];
159 if (delta_upper < 0.0f)
160 return upper_ratio_points[index];
161 if (delta_lower > 0.0f)
162 return lower_ratio_points[index];
167 last_mouse_position_ = e.getPosition();
172 if (isRatio(hover_)) {
175 setLowUpperRatio(0.0f);
177 case kBandUpperRatio:
178 setBandUpperRatio(0.0f);
180 case kHighUpperRatio:
181 setHighUpperRatio(0.0f);
184 setLowLowerRatio(0.0f);
186 case kBandLowerRatio:
187 setBandLowerRatio(0.0f);
189 case kHighLowerRatio:
190 setHighLowerRatio(0.0f);
199 hover_ = getHoverPoint(e);
202 setMouseCursor(MouseCursor::BottomEdgeResizeCursor);
204 setMouseCursor(MouseCursor::NormalCursor);
208 if (hover_ == kNone || parent_ ==
nullptr)
211 float delta = (e.getPosition().y - last_mouse_position_.y) *
kMouseMultiplier / getHeight();
214 last_mouse_position_ = e.getPosition();
217 if (e.mods.isShiftDown()) {
218 setLowUpperThreshold(low_upper_threshold_ + delta_db_value,
false);
219 setBandUpperThreshold(band_upper_threshold_ + delta_db_value,
false);
220 setHighUpperThreshold(high_upper_threshold_ + delta_db_value,
false);
221 setLowLowerThreshold(low_lower_threshold_ + delta_db_value,
false);
222 setBandLowerThreshold(band_lower_threshold_ + delta_db_value,
false);
223 setHighLowerThreshold(high_lower_threshold_ + delta_db_value,
false);
227 case kLowUpperThreshold:
228 setLowUpperThreshold(low_upper_threshold_ + delta_db_value,
true);
231 setLowUpperRatio(low_upper_ratio_ + delta_ratio);
233 case kBandUpperThreshold:
234 setBandUpperThreshold(band_upper_threshold_ + delta_db_value,
true);
236 case kBandUpperRatio:
237 setBandUpperRatio(band_upper_ratio_ + delta_ratio);
239 case kHighUpperThreshold:
240 setHighUpperThreshold(high_upper_threshold_ + delta_db_value,
true);
242 case kHighUpperRatio:
243 setHighUpperRatio(high_upper_ratio_ + delta_ratio);
245 case kLowLowerThreshold:
246 setLowLowerThreshold(low_lower_threshold_ + delta_db_value,
true);
249 setLowLowerRatio(low_lower_ratio_ - delta_ratio);
251 case kBandLowerThreshold:
252 setBandLowerThreshold(band_lower_threshold_ + delta_db_value,
true);
254 case kBandLowerRatio:
255 setBandLowerRatio(band_lower_ratio_ - delta_ratio);
257 case kHighLowerThreshold:
258 setHighLowerThreshold(high_lower_threshold_ + delta_db_value,
true);
260 case kHighLowerRatio:
261 setHighLowerRatio(high_lower_ratio_ - delta_ratio);
271 setMouseCursor(MouseCursor::BottomEdgeResizeCursor);
277 setMouseCursor(MouseCursor::NormalCursor);
287 int y = getHeight() * t;
288 g.fillRect(0, y, getWidth(), 1);
294 hover_quad_.setBounds(getLocalBounds());
295 input_dbs_.setBounds(getLocalBounds());
296 output_dbs_.setBounds(getLocalBounds());
297 thresholds_.setBounds(getLocalBounds());
298 ratio_lines_.setBounds(getLocalBounds());
303 hover_quad_.
init(open_gl);
304 input_dbs_.
init(open_gl);
305 output_dbs_.
init(open_gl);
306 thresholds_.
init(open_gl);
307 ratio_lines_.
init(open_gl);
315void CompressorEditor::setThresholdPositions(
int low_start,
int low_end,
int band_start,
int band_end,
316 int high_start,
int high_end,
float ratio_match) {
317 thresholds_.
setColor(getColorForRatio(ratio_match));
318 float width = getWidth();
320 float low_start_x = low_start * 2.0f / width - 1.0f;
321 float low_width = (low_end - low_start) * 2.0f / width;
322 float band_start_x = band_start * 2.0f / width - 1.0f;
323 float band_width = (band_end - band_start) * 2.0f / width;
324 float high_start_x = high_start * 2.0f / width - 1.0f;
325 float high_width = (high_end - high_start) * 2.0f / width;
327 setQuadIfRatioMatch(thresholds_, -low_lower_ratio_, ratio_match, 0,
328 low_start_x, -1.0f, low_width, getOpenGlYForDb(low_lower_threshold_) + 1.0f);
329 setQuadIfRatioMatch(thresholds_, low_upper_ratio_, ratio_match, 1,
330 low_start_x, 1.0f, low_width, getOpenGlYForDb(low_upper_threshold_) - 1.0f);
331 setQuadIfRatioMatch(thresholds_, -band_lower_ratio_, ratio_match, 2,
332 band_start_x, -1.0f, band_width, getOpenGlYForDb(band_lower_threshold_) + 1.0f);
333 setQuadIfRatioMatch(thresholds_, band_upper_ratio_, ratio_match, 3,
334 band_start_x, 1.0f, band_width, getOpenGlYForDb(band_upper_threshold_) - 1.0f);
335 setQuadIfRatioMatch(thresholds_, -high_lower_ratio_, ratio_match, 4,
336 high_start_x, -1.0f, high_width, getOpenGlYForDb(high_lower_threshold_) + 1.0f);
337 setQuadIfRatioMatch(thresholds_, high_upper_ratio_, ratio_match, 5,
338 high_start_x, 1.0f, high_width, getOpenGlYForDb(high_upper_threshold_) - 1.0f);
341void CompressorEditor::setRatioLines(
int start_index,
int start_x,
int end_x,
342 float threshold,
float ratio,
bool upper,
bool hover) {
345 int db_index = db_position;
349 db_index =
ceil(db_position);
352 float width = getWidth();
353 float x = start_x * 2.0f / width - 1.0f;
354 float ratio_width = (end_x - start_x) * 2.0f / width;
355 float ratio_height = 4.0f / getHeight();
357 float mult = hover ? 5.0f : 2.5f;
361 float adjusted_db = getCompressedDb(db, threshold, ratio, threshold, ratio);
362 ratio_lines_.
setQuad(start_index + i, x, getOpenGlYForDb(adjusted_db) - ratio_height * 0.5f,
363 ratio_width, ratio_height);
369void CompressorEditor::setRatioLinePositions(
int low_start,
int low_end,
int band_start,
int band_end,
370 int high_start,
int high_end) {
371 setRatioLines(0, low_start, low_end, low_upper_threshold_, low_upper_ratio_,
372 true, hover_ == kLowUpperRatio);
373 setRatioLines(
kRatioDbLines, low_start, low_end, low_lower_threshold_, low_lower_ratio_,
374 false, hover_ == kLowLowerRatio);
375 setRatioLines(2 *
kRatioDbLines, band_start, band_end, band_upper_threshold_, band_upper_ratio_,
376 true, hover_ == kBandUpperRatio);
377 setRatioLines(3 *
kRatioDbLines, band_start, band_end, band_lower_threshold_, band_lower_ratio_,
378 false, hover_ == kBandLowerRatio);
379 setRatioLines(4 *
kRatioDbLines, high_start, high_end, high_upper_threshold_, high_upper_ratio_,
380 true, hover_ == kHighUpperRatio);
381 setRatioLines(5 *
kRatioDbLines, high_start, high_end, high_lower_threshold_, high_lower_ratio_,
382 false, hover_ == kHighLowerRatio);
385void CompressorEditor::renderHover(
OpenGlWrapper& open_gl,
int low_start,
int low_end,
386 int band_start,
int band_end,
int high_start,
int high_end) {
390 float width = getWidth();
391 float height = getHeight();
392 float threshold_height = 2.0f / height;
394 float low_start_x = low_start * 2.0f / width - 1.0f;
395 float low_width = (low_end - low_start) * 2.0f / width;
396 float band_start_x = band_start * 2.0f / width - 1.0f;
397 float band_width = (band_end - band_start) * 2.0f / width;
398 float high_start_x = high_start * 2.0f / width - 1.0f;
399 float high_width = (high_end - high_start) * 2.0f / width;
402 case kLowUpperThreshold:
403 hover_quad_.
setQuad(0, low_start_x, getOpenGlYForDb(low_upper_threshold_) - 0.5f * threshold_height,
404 low_width, threshold_height);
406 case kBandUpperThreshold:
407 hover_quad_.
setQuad(0, band_start_x, getOpenGlYForDb(band_upper_threshold_) - 0.5f * threshold_height,
408 band_width, threshold_height);
410 case kHighUpperThreshold:
411 hover_quad_.
setQuad(0, high_start_x, getOpenGlYForDb(high_upper_threshold_) - 0.5f * threshold_height,
412 high_width, threshold_height);
414 case kLowLowerThreshold:
415 hover_quad_.
setQuad(0, low_start_x, getOpenGlYForDb(low_lower_threshold_) - 0.5f * threshold_height,
416 low_width, threshold_height);
418 case kBandLowerThreshold:
419 hover_quad_.
setQuad(0, band_start_x, getOpenGlYForDb(band_lower_threshold_) - 0.5f * threshold_height,
420 band_width, threshold_height);
422 case kHighLowerThreshold:
423 hover_quad_.
setQuad(0, high_start_x, getOpenGlYForDb(high_lower_threshold_) - 0.5f * threshold_height,
424 high_width, threshold_height);
435 hover_quad_.
render(open_gl,
true);
439 static constexpr float kOutputBarHeight = 2.2f;
440 if (low_input_ms_ ==
nullptr || band_input_ms_ ==
nullptr || high_input_ms_ ==
nullptr ||
441 low_output_ms_ ==
nullptr || band_output_ms_ ==
nullptr || high_output_ms_ ==
nullptr) {
463 int width = getWidth();
465 float active_section_width = active_area /
kMaxBands;
470 int band_end = width - band_start;
471 int high_start = width - low_end;
472 int high_end = width - low_start;
474 if (!low_band_active_) {
475 band_start = low_start;
476 low_start = low_end = -width;
478 if (!high_band_active_) {
480 high_start = high_end = -width;
483 setThresholdPositions(low_start, low_end, band_start, band_end, high_start, high_end, 1.0f);
484 thresholds_.
render(open_gl,
true);
486 setThresholdPositions(low_start, low_end, band_start, band_end, high_start, high_end, 0.0f);
487 thresholds_.
render(open_gl,
true);
489 setThresholdPositions(low_start, low_end, band_start, band_end, high_start, high_end, -1.0f);
490 thresholds_.
render(open_gl,
true);
492 setRatioLinePositions(low_start, low_end, band_start, band_end, high_start, high_end);
494 ratio_lines_.
render(open_gl,
true);
496 renderHover(open_gl, low_start, low_end, band_start, band_end, high_start, high_end);
498 int bar_width =
kBarWidth * active_section_width * width;
499 int low_middle = (low_start + low_end) * 0.5f;
500 int band_middle = (band_start + band_end) * 0.5f;
501 int high_middle = (high_start + high_end) * 0.5f;
503 float gl_bar_width = bar_width * 2.0f / width;
504 float low_left = (low_middle - bar_width) * 2.0f / width - 1.0f;
505 float low_right = (low_middle + 1) * 2.0f / width - 1.0f;
506 float band_left = (band_middle - bar_width) * 2.0f / width - 1.0f;
507 float band_right = (band_middle + 1) * 2.0f / width - 1.0f;
508 float high_left = (high_middle - bar_width) * 2.0f / width - 1.0f;
509 float high_right = (high_middle + 1) * 2.0f / width - 1.0f;
510 output_dbs_.
setQuad(0, low_left, low_output_y[0] - kOutputBarHeight, gl_bar_width, kOutputBarHeight);
511 output_dbs_.
setQuad(1, low_right, low_output_y[1] - kOutputBarHeight, gl_bar_width, kOutputBarHeight);
512 output_dbs_.
setQuad(2, band_left, band_output_y[0] - kOutputBarHeight, gl_bar_width, kOutputBarHeight);
513 output_dbs_.
setQuad(3, band_right, band_output_y[1] - kOutputBarHeight, gl_bar_width, kOutputBarHeight);
514 output_dbs_.
setQuad(4, high_left, high_output_y[0] - kOutputBarHeight, gl_bar_width, kOutputBarHeight);
515 output_dbs_.
setQuad(5, high_right, high_output_y[1] - kOutputBarHeight, gl_bar_width, kOutputBarHeight);
517 float input_height = 2.0f / getHeight();
518 input_dbs_.
setQuad(0, low_left, low_input_y[0] - 0.5f * input_height, gl_bar_width, input_height);
519 input_dbs_.
setQuad(1, low_right, low_input_y[1] - 0.5f * input_height, gl_bar_width, input_height);
520 input_dbs_.
setQuad(2, band_left, band_input_y[0] - 0.5f * input_height, gl_bar_width, input_height);
521 input_dbs_.
setQuad(3, band_right, band_input_y[1] - 0.5f * input_height, gl_bar_width, input_height);
522 input_dbs_.
setQuad(4, high_left, high_input_y[0] - 0.5f * input_height, gl_bar_width, input_height);
523 input_dbs_.
setQuad(5, high_right, high_input_y[1] - 0.5f * input_height, gl_bar_width, input_height);
526 output_dbs_.
render(open_gl, animate);
529 input_dbs_.
render(open_gl, animate);
542 low_upper_threshold_ = controls[
"compressor_low_upper_threshold"]->value();
543 band_upper_threshold_ = controls[
"compressor_band_upper_threshold"]->value();
544 high_upper_threshold_ = controls[
"compressor_high_upper_threshold"]->value();
545 low_lower_threshold_ = controls[
"compressor_low_lower_threshold"]->value();
546 band_lower_threshold_ = controls[
"compressor_band_lower_threshold"]->value();
547 high_lower_threshold_ = controls[
"compressor_high_lower_threshold"]->value();
548 low_upper_ratio_ = controls[
"compressor_low_upper_ratio"]->value();
549 band_upper_ratio_ = controls[
"compressor_band_upper_ratio"]->value();
550 high_upper_ratio_ = controls[
"compressor_high_upper_ratio"]->value();
551 low_lower_ratio_ = controls[
"compressor_low_lower_ratio"]->value();
552 band_lower_ratio_ = controls[
"compressor_band_lower_ratio"]->value();
553 high_lower_ratio_ = controls[
"compressor_high_lower_ratio"]->value();
556void CompressorEditor::setLowUpperThreshold(
float db,
bool clamp) {
557 low_upper_threshold_ = db;
562 low_upper_threshold_ = db;
564 if (low_upper_threshold_ < low_lower_threshold_ && clamp)
565 setLowLowerThreshold(db, clamp);
567 section_parent_->
showPopupDisplay(
this, formatString(low_upper_threshold_,
" dB"), BubbleComponent::below,
true);
570void CompressorEditor::setBandUpperThreshold(
float db,
bool clamp) {
571 band_upper_threshold_ = db;
576 band_upper_threshold_ = db;
578 if (band_upper_threshold_ < band_lower_threshold_ && clamp)
579 setBandLowerThreshold(db, clamp);
581 section_parent_->
showPopupDisplay(
this, formatString(band_upper_threshold_,
" dB"), BubbleComponent::below,
true);
584void CompressorEditor::setHighUpperThreshold(
float db,
bool clamp) {
585 high_upper_threshold_ = db;
590 high_upper_threshold_ = db;
592 if (high_upper_threshold_ < high_lower_threshold_ && clamp)
593 setHighLowerThreshold(db, clamp);
595 section_parent_->
showPopupDisplay(
this, formatString(high_upper_threshold_,
" dB"), BubbleComponent::below,
true);
598void CompressorEditor::setLowLowerThreshold(
float db,
bool clamp) {
599 low_lower_threshold_ = db;
604 low_lower_threshold_ = db;
606 if (low_lower_threshold_ > low_upper_threshold_ && clamp)
607 setLowUpperThreshold(db, clamp);
609 section_parent_->
showPopupDisplay(
this, formatString(low_lower_threshold_,
" dB"), BubbleComponent::below,
true);
612void CompressorEditor::setBandLowerThreshold(
float db,
bool clamp) {
613 band_lower_threshold_ = db;
618 band_lower_threshold_ = db;
620 if (band_lower_threshold_ > band_upper_threshold_ && clamp)
621 setBandUpperThreshold(db, clamp);
623 section_parent_->
showPopupDisplay(
this, formatString(band_lower_threshold_,
" dB"), BubbleComponent::below,
true);
626void CompressorEditor::setHighLowerThreshold(
float db,
bool clamp ) {
627 high_lower_threshold_ = db;
632 high_lower_threshold_ = db;
634 if (high_lower_threshold_ > high_upper_threshold_ && clamp)
635 setHighUpperThreshold(db, clamp);
637 section_parent_->
showPopupDisplay(
this, formatString(high_lower_threshold_,
" dB"), BubbleComponent::below,
true);
640void CompressorEditor::setLowUpperRatio(
float ratio) {
647void CompressorEditor::setBandUpperRatio(
float ratio) {
654void CompressorEditor::setHighUpperRatio(
float ratio) {
661void CompressorEditor::setLowLowerRatio(
float ratio) {
668void CompressorEditor::setBandLowerRatio(
float ratio) {
675void CompressorEditor::setHighLowerRatio(
float ratio) {
682String CompressorEditor::formatValue(
float value) {
683 static constexpr int number_length = 5;
684 static constexpr int max_decimals = 3;
686 String format = String(value, max_decimals);
687 format = format.substring(0, number_length);
688 int spaces = number_length - format.length();
690 for (
int i = 0; i < spaces; ++i)
691 format =
" " + format;
697 if (parent_ ==
nullptr)
698 parent_ = findParentComponentOfClass<SynthGuiInterface>();
700 if (section_parent_ ==
nullptr)
701 section_parent_ = findParentComponentOfClass<SynthSection>();
703 if (parent_ ==
nullptr)
706 if (low_input_ms_ ==
nullptr)
708 if (band_input_ms_ ==
nullptr)
710 if (high_input_ms_ ==
nullptr)
712 if (low_output_ms_ ==
nullptr)
714 if (band_output_ms_ ==
nullptr)
716 if (high_output_ms_ ==
nullptr)
722float CompressorEditor::getYForDb(
float db) {
726float CompressorEditor::getCompressedDb(
float input_db,
float upper_threshold,
float upper_ratio,
727 float lower_threshold,
float lower_ratio) {
728 if (input_db < lower_threshold)
730 if (input_db > upper_threshold)
735Colour CompressorEditor::getColorForRatio(
float ratio) {
void mouseUp(const MouseEvent &e) override
Handles mouse up events.
Definition compressor_editor.cpp:269
static constexpr float kMouseMultiplier
General multiplier for mouse-drag edits.
Definition compressor_editor.h:60
static constexpr int kMaxBands
Maximum number of bands supported.
Definition compressor_editor.h:63
CompressorEditor()
Constructs a new CompressorEditor.
Definition compressor_editor.cpp:84
void destroy(OpenGlWrapper &open_gl) override
Destroys and cleans up OpenGL-related objects.
Definition compressor_editor.cpp:532
static constexpr float kMinLowerRatio
Minimum ratio value for the lower ratio segments.
Definition compressor_editor.h:40
void mouseDown(const MouseEvent &e) override
Handles mouse down events.
Definition compressor_editor.cpp:166
void mouseDrag(const MouseEvent &e) override
Handles mouse drag events.
Definition compressor_editor.cpp:207
static constexpr float kGrabRadius
Grab radius in pixels for clickable points (thresholds, ratio handles).
Definition compressor_editor.h:25
static constexpr float kMinUpperRatio
Minimum ratio value for the upper ratio segments.
Definition compressor_editor.h:44
static constexpr float kCompressorAreaBuffer
Buffer area around the compressor visualization.
Definition compressor_editor.h:52
static constexpr float kMaxEditDb
Maximum editable dB value (slightly below kMaxDb).
Definition compressor_editor.h:37
static constexpr float kMinDb
Minimum decibel value displayed in the compressor editor.
Definition compressor_editor.h:28
static constexpr float kMinEditDb
Minimum editable dB value (slightly above kMinDb).
Definition compressor_editor.h:35
void renderCompressor(OpenGlWrapper &open_gl, bool animate)
Renders the compressor-specific elements.
Definition compressor_editor.cpp:438
void resized() override
Called when the component is resized.
Definition compressor_editor.cpp:292
static constexpr int kDbLineSections
Number of dB line sections in the display.
Definition compressor_editor.h:68
static constexpr int kRatioDbLines
Total number of dB lines for ratio calculations.
Definition compressor_editor.h:72
static constexpr float kBarWidth
Width of the displayed bars relative to the component width.
Definition compressor_editor.h:54
void init(OpenGlWrapper &open_gl) override
Initializes the OpenGL context and related objects.
Definition compressor_editor.cpp:301
void setAllValues(vital::control_map &controls)
Sets all threshold and ratio values from a given control map.
Definition compressor_editor.cpp:541
static constexpr float kRatioEditMultiplier
Multiplier applied to ratio edits for finer control.
Definition compressor_editor.h:49
virtual ~CompressorEditor()
Destructor.
Definition compressor_editor.cpp:128
static constexpr float kMaxLowerRatio
Maximum ratio value for the lower ratio segments.
Definition compressor_editor.h:42
static constexpr float kMaxDb
Maximum decibel value displayed in the compressor editor.
Definition compressor_editor.h:30
static constexpr float kMaxUpperRatio
Maximum ratio value for the upper ratio segments.
Definition compressor_editor.h:46
void parentHierarchyChanged() override
Called when the component's parent hierarchy changes, used for initialization.
Definition compressor_editor.cpp:696
void paintBackground(Graphics &g) override
Draws the background of the editor.
Definition compressor_editor.cpp:281
void mouseDoubleClick(const MouseEvent &e) override
Handles mouse double-click events.
Definition compressor_editor.cpp:171
void mouseMove(const MouseEvent &e) override
Handles mouse move events (primarily used for updating hover state).
Definition compressor_editor.cpp:198
void mouseExit(const MouseEvent &e) override
Handles mouse exit events.
Definition compressor_editor.cpp:276
void render(OpenGlWrapper &open_gl, bool animate) override
Renders the compressor visualization.
Definition compressor_editor.cpp:310
void addRoundedCorners()
Adds rounded corners to the component's edges.
Definition open_gl_component.cpp:138
virtual void resized() override
Called when the component is resized.
Definition open_gl_component.cpp:121
void renderCorners(OpenGlWrapper &open_gl, bool animate, Colour color, float rounding)
Renders the corner shapes using the given color and rounding amount.
Definition open_gl_component.cpp:153
virtual void destroy(OpenGlWrapper &open_gl)
Destroys any OpenGL-specific resources allocated by this component.
Definition open_gl_component.cpp:168
virtual void paintBackground(Graphics &g)
Paints a standard background for the component.
Definition open_gl_component.cpp:105
virtual void init(OpenGlWrapper &open_gl)
Initializes any OpenGL-specific resources needed by the component.
Definition open_gl_component.cpp:148
virtual void parentHierarchyChanged() override
Called when the component's parent hierarchy changes.
Definition open_gl_component.cpp:128
A component for rendering multiple quads using OpenGL, with customizable colors, rounding,...
Definition open_gl_multi_quad.h:16
void setShaderValue(int i, float shader_value, int value_index=0)
Sets a shader value for all four vertices of a quad.
Definition open_gl_multi_quad.h:254
virtual void init(OpenGlWrapper &open_gl) override
Initializes OpenGL buffers and shader attributes.
Definition open_gl_multi_quad.cpp:37
void setQuad(int i, float x, float y, float w, float h)
Sets the position and size of a quad in normalized device space.
Definition open_gl_multi_quad.h:313
virtual void render(OpenGlWrapper &open_gl, bool animate) override
Renders the quads using OpenGL.
Definition open_gl_multi_quad.cpp:92
virtual void destroy(OpenGlWrapper &open_gl) override
Releases OpenGL resources when the component is destroyed.
Definition open_gl_multi_quad.cpp:69
force_inline void setColor(Colour color)
Sets the base color for the quads.
Definition open_gl_multi_quad.h:102
Manages and provides access to vertex and fragment shaders used by the OpenGL rendering pipeline.
Definition shaders.h:19
@ kWidgetPrimary2
Definition skin.h:166
@ kWidgetPrimary1
Definition skin.h:165
@ kWidgetSecondary1
Definition skin.h:168
@ kLightenScreen
Definition skin.h:141
@ kWidgetSecondaryDisabled
Definition skin.h:170
@ kWidgetCenterLine
Definition skin.h:164
@ kWidgetSecondary2
Definition skin.h:169
A base class providing foundational functionality for the Vital synthesizer’s engine,...
Definition synth_base.h:42
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
const vital::StatusOutput * getStatusOutput(const std::string &name)
Retrieves a status output by name.
Definition synth_base.cpp:262
SynthBase * getSynth()
Returns the SynthBase instance this interface is managing.
Definition synth_gui_interface.h:85
void hidePopupDisplay(bool primary)
Hides the currently shown popup display.
Definition synth_section.cpp:140
void showPopupDisplay(Component *source, const std::string &text, BubbleComponent::BubblePlacement placement, bool primary)
Shows a brief popup display (like a tooltip).
Definition synth_section.cpp:133
force_inline poly_float value() const
Returns the current status value.
Definition synth_module.h:49
force_inline poly_float clamp(poly_float value, mono_float min, mono_float max)
Clamps each lane of a vector to [min, max].
Definition poly_utils.h:306
force_inline poly_float magnitudeToDb(poly_float value)
Converts a magnitude value to decibels (vectorized).
Definition poly_utils.h:144
force_inline poly_float max(poly_float left, poly_float right)
Returns the maximum of two poly_floats lane-by-lane.
Definition poly_utils.h:327
force_inline poly_float sqrt(poly_float value)
Computes the square root of each element in a poly_float.
Definition poly_utils.h:169
force_inline poly_float interpolate(poly_float from, poly_float to, mono_float t)
Performs a linear interpolation between two poly_floats using a scalar t in [0..1].
Definition poly_utils.h:182
force_inline poly_float ceil(poly_float value)
Ceils each lane in value.
Definition poly_utils.h:799
std::map< std::string, Value * > control_map
Maps parameter names to Value pointers representing synth control parameters.
Definition synth_types.h:214
A helper struct containing references to OpenGL context, shaders, and display scale.
Definition shaders.h:174
Represents a vector of floating-point values using SIMD instructions.
Definition poly_values.h:600
Provides various utility functions, classes, and constants for audio, math, and general-purpose opera...