Vital
|
A graphical interface component for editing a multiband compressor's thresholds and ratios. More...
#include <compressor_editor.h>
Public Member Functions | |
CompressorEditor () | |
Constructs a new CompressorEditor. | |
virtual | ~CompressorEditor () |
Destructor. | |
void | paintBackground (Graphics &g) override |
Draws the background of the editor. | |
void | resized () override |
Called when the component is resized. | |
void | mouseDown (const MouseEvent &e) override |
Handles mouse down events. | |
void | mouseDoubleClick (const MouseEvent &e) override |
Handles mouse double-click events. | |
void | mouseMove (const MouseEvent &e) override |
Handles mouse move events (primarily used for updating hover state). | |
void | mouseDrag (const MouseEvent &e) override |
Handles mouse drag events. | |
void | mouseUp (const MouseEvent &e) override |
Handles mouse up events. | |
void | mouseExit (const MouseEvent &e) override |
Handles mouse exit events. | |
void | parentHierarchyChanged () override |
Called when the component's parent hierarchy changes, used for initialization. | |
void | init (OpenGlWrapper &open_gl) override |
Initializes the OpenGL context and related objects. | |
void | render (OpenGlWrapper &open_gl, bool animate) override |
Renders the compressor visualization. | |
void | renderCompressor (OpenGlWrapper &open_gl, bool animate) |
Renders the compressor-specific elements. | |
void | destroy (OpenGlWrapper &open_gl) override |
Destroys and cleans up OpenGL-related objects. | |
void | setSizeRatio (float ratio) |
Sets the size ratio, scaling the display proportionally. | |
void | setAllValues (vital::control_map &controls) |
Sets all threshold and ratio values from a given control map. | |
void | setHighBandActive (bool active) |
Sets the activity state of the high band. | |
void | setLowBandActive (bool active) |
Sets the activity state of the low band. | |
void | setActive (bool active) |
Sets the active state of the entire compressor editor. | |
![]() | |
OpenGlComponent (String name="") | |
Constructs an OpenGlComponent. | |
virtual | ~OpenGlComponent () |
Destructor. | |
void | addRoundedCorners () |
Adds rounded corners to the component's edges. | |
void | addBottomRoundedCorners () |
Adds rounded corners only at the bottom of the component. | |
void | renderCorners (OpenGlWrapper &open_gl, bool animate, Colour color, float rounding) |
Renders the corner shapes using the given color and rounding amount. | |
void | renderCorners (OpenGlWrapper &open_gl, bool animate) |
Renders corners with default body color and rounding. | |
void | repaintBackground () |
Requests a repaint of the component's background on the OpenGL layer. | |
Colour | getBodyColor () const |
Retrieves the component's body color. | |
void | setParent (const SynthSection *parent) |
Sets a pointer to the parent SynthSection for skin value lookups. | |
float | findValue (Skin::ValueId value_id) |
Finds a float value from the skin associated with this component's parent. | |
void | setSkinValues (const Skin &skin) |
Applies the skin overrides to this component's colors. | |
void | setSkinOverride (Skin::SectionOverride skin_override) |
Sets a skin override to control the component's color scheme. | |
force_inline void | checkGlError () |
Checks for and asserts that there are no OpenGL errors. | |
void | setBackgroundColor (const Colour &color) |
Sets the background color of the component for painting operations. | |
![]() | |
virtual | ~SliderListener () |
virtual void | hoverStarted (SynthSlider *slider) |
virtual void | hoverEnded (SynthSlider *slider) |
virtual void | mouseDown (SynthSlider *slider) |
virtual void | mouseUp (SynthSlider *slider) |
virtual void | beginModulationEdit (SynthSlider *slider) |
virtual void | endModulationEdit (SynthSlider *slider) |
virtual void | menuFinished (SynthSlider *slider) |
virtual void | focusLost (SynthSlider *slider) |
virtual void | doubleClick (SynthSlider *slider) |
virtual void | modulationsChanged (const std::string &name) |
virtual void | modulationAmountChanged (SynthSlider *slider) |
virtual void | modulationRemoved (SynthSlider *slider) |
virtual void | guiChanged (SynthSlider *slider) |
Static Public Attributes | |
static constexpr float | kGrabRadius = 8.0f |
Grab radius in pixels for clickable points (thresholds, ratio handles). | |
static constexpr float | kMinDb = -80.0f |
Minimum decibel value displayed in the compressor editor. | |
static constexpr float | kMaxDb = 0.0f |
Maximum decibel value displayed in the compressor editor. | |
static constexpr float | kDbEditBuffer = 1.0f |
Decibel buffer around the min and max dB edit range. | |
static constexpr float | kMinEditDb = kMinDb + kDbEditBuffer |
Minimum editable dB value (slightly above kMinDb). | |
static constexpr float | kMaxEditDb = kMaxDb - kDbEditBuffer |
Maximum editable dB value (slightly below kMaxDb). | |
static constexpr float | kMinLowerRatio = -1.0f |
Minimum ratio value for the lower ratio segments. | |
static constexpr float | kMaxLowerRatio = 1.0f |
Maximum ratio value for the lower ratio segments. | |
static constexpr float | kMinUpperRatio = 0.0f |
Minimum ratio value for the upper ratio segments. | |
static constexpr float | kMaxUpperRatio = 1.0f |
Maximum ratio value for the upper ratio segments. | |
static constexpr float | kRatioEditMultiplier = 0.6f |
Multiplier applied to ratio edits for finer control. | |
static constexpr float | kCompressorAreaBuffer = 0.05f |
Buffer area around the compressor visualization. | |
static constexpr float | kBarWidth = 1.0f / 5.0f |
Width of the displayed bars relative to the component width. | |
static constexpr float | kInputLineRadius = 0.02f |
Radius for input line rendering in normalized coordinates. | |
static constexpr float | kMouseMultiplier = 1.0f |
General multiplier for mouse-drag edits. | |
static constexpr int | kMaxBands = 3 |
Maximum number of bands supported. | |
static constexpr int | kNumChannels = kMaxBands * 2 |
Number of channels (2 channels per band). | |
static constexpr int | kDbLineSections = 8 |
Number of dB line sections in the display. | |
static constexpr int | kExtraDbLines = 6 |
Extra dB lines to draw for extended resolution. | |
static constexpr int | kRatioDbLines = kDbLineSections + kExtraDbLines |
Total number of dB lines for ratio calculations. | |
static constexpr int | kTotalRatioLines = kRatioDbLines * kNumChannels |
Total number of ratio lines drawn for all bands. | |
Additional Inherited Members | |
![]() | |
static bool | setViewPort (Component *component, Rectangle< int > bounds, OpenGlWrapper &open_gl) |
Sets the OpenGL viewport to match a specified rectangle within a component. | |
static bool | setViewPort (Component *component, OpenGlWrapper &open_gl) |
Convenience overload that sets the viewport for the entire component's local bounds. | |
static void | setScissor (Component *component, OpenGlWrapper &open_gl) |
Sets the OpenGL scissor region to the entire component's local bounds. | |
static void | setScissorBounds (Component *component, Rectangle< int > bounds, OpenGlWrapper &open_gl) |
Sets the OpenGL scissor region to a specified rectangle within a component. | |
static std::unique_ptr< OpenGLShaderProgram::Uniform > | getUniform (const OpenGlWrapper &open_gl, const OpenGLShaderProgram &program, const char *name) |
Retrieves a uniform from the shader program if it exists. | |
static std::unique_ptr< OpenGLShaderProgram::Attribute > | getAttribute (const OpenGlWrapper &open_gl, const OpenGLShaderProgram &program, const char *name) |
Retrieves an attribute from the shader program if it exists. | |
static String | translateFragmentShader (const String &code) |
Translates a fragment shader code snippet to be compatible with the current GL version. | |
static String | translateVertexShader (const String &code) |
Translates a vertex shader code snippet to be compatible with the current GL version. | |
![]() | |
bool | setViewPort (OpenGlWrapper &open_gl) |
Sets the viewport for this component using the current OpenGlWrapper. | |
![]() | |
std::unique_ptr< OpenGlCorners > | corners_ |
Optional corners for rounded edges. | |
bool | only_bottom_corners_ |
Flag to round only the bottom corners. | |
Colour | background_color_ |
The background color of the component. | |
Colour | body_color_ |
The body color of the component. | |
const SynthSection * | parent_ |
Pointer to parent SynthSection for skin lookups. | |
Skin::SectionOverride | skin_override_ |
Skin override for custom appearance. | |
const vital::StatusOutput * | num_voices_readout_ |
StatusOutput for voice count lookups. | |
A graphical interface component for editing a multiband compressor's thresholds and ratios.
The CompressorEditor allows for the visualization and interactive editing of multiple compression bands (low, band, and high). It displays threshold lines, input/output levels, and ratio lines, and allows users to manipulate these values via mouse interaction. The component uses OpenGL for efficient rendering.
CompressorEditor::CompressorEditor | ( | ) |
Constructs a new CompressorEditor.
|
virtual |
Destructor.
|
overridevirtual |
Destroys and cleans up OpenGL-related objects.
open_gl | The OpenGlWrapper containing OpenGL context information. |
Reimplemented from OpenGlComponent.
|
overridevirtual |
Initializes the OpenGL context and related objects.
open_gl | The OpenGlWrapper containing OpenGL context information. |
Reimplemented from OpenGlComponent.
|
override |
Handles mouse double-click events.
e | The mouse event. |
|
override |
Handles mouse down events.
e | The mouse event. |
|
override |
Handles mouse drag events.
e | The mouse event. |
|
override |
Handles mouse exit events.
e | The mouse event. |
|
override |
Handles mouse move events (primarily used for updating hover state).
e | The mouse event. |
|
override |
Handles mouse up events.
e | The mouse event. |
|
overridevirtual |
Draws the background of the editor.
g | The JUCE graphics context to draw with. |
Reimplemented from OpenGlComponent.
|
overridevirtual |
Called when the component's parent hierarchy changes, used for initialization.
Reimplemented from OpenGlComponent.
|
overridevirtual |
Renders the compressor visualization.
open_gl | The OpenGlWrapper containing OpenGL context information. |
animate | If true, indicates that animation may be applied. |
Implements OpenGlComponent.
void CompressorEditor::renderCompressor | ( | OpenGlWrapper & | open_gl, |
bool | animate ) |
Renders the compressor-specific elements.
open_gl | The OpenGlWrapper containing OpenGL context information. |
animate | If true, indicates that animation may be applied. |
|
overridevirtual |
Called when the component is resized.
Reimplemented from OpenGlComponent.
|
inline |
Sets the active state of the entire compressor editor.
active | True to activate, false to deactivate. |
void CompressorEditor::setAllValues | ( | vital::control_map & | controls | ) |
Sets all threshold and ratio values from a given control map.
controls | A control map containing named parameters and their values. |
|
inline |
Sets the activity state of the high band.
active | True to activate the high band, false otherwise. |
|
inline |
Sets the activity state of the low band.
active | True to activate the low band, false otherwise. |
|
inline |
Sets the size ratio, scaling the display proportionally.
ratio | The new size ratio. |
|
staticconstexpr |
Width of the displayed bars relative to the component width.
|
staticconstexpr |
Buffer area around the compressor visualization.
|
staticconstexpr |
Decibel buffer around the min and max dB edit range.
|
staticconstexpr |
Number of dB line sections in the display.
|
staticconstexpr |
Extra dB lines to draw for extended resolution.
|
staticconstexpr |
Grab radius in pixels for clickable points (thresholds, ratio handles).
|
staticconstexpr |
Radius for input line rendering in normalized coordinates.
|
staticconstexpr |
Maximum number of bands supported.
|
staticconstexpr |
Maximum decibel value displayed in the compressor editor.
|
staticconstexpr |
Maximum editable dB value (slightly below kMaxDb).
|
staticconstexpr |
Maximum ratio value for the lower ratio segments.
|
staticconstexpr |
Maximum ratio value for the upper ratio segments.
|
staticconstexpr |
Minimum decibel value displayed in the compressor editor.
|
staticconstexpr |
Minimum editable dB value (slightly above kMinDb).
|
staticconstexpr |
Minimum ratio value for the lower ratio segments.
|
staticconstexpr |
Minimum ratio value for the upper ratio segments.
|
staticconstexpr |
General multiplier for mouse-drag edits.
|
staticconstexpr |
Number of channels (2 channels per band).
|
staticconstexpr |
Total number of dB lines for ratio calculations.
|
staticconstexpr |
Multiplier applied to ratio edits for finer control.
|
staticconstexpr |
Total number of ratio lines drawn for all bands.