Vital
Loading...
Searching...
No Matches
CompressorEditor Class Reference

A graphical interface component for editing a multiband compressor's thresholds and ratios. More...

#include <compressor_editor.h>

Inheritance diagram for CompressorEditor:
OpenGlComponent SynthSlider::SliderListener

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.
 
- Public Member Functions inherited from OpenGlComponent
 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.
 
- Public Member Functions inherited from SynthSlider::SliderListener
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 Public Member Functions inherited from OpenGlComponent
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.
 
- Protected Member Functions inherited from OpenGlComponent
bool setViewPort (OpenGlWrapper &open_gl)
 Sets the viewport for this component using the current OpenGlWrapper.
 
- Protected Attributes inherited from OpenGlComponent
std::unique_ptr< OpenGlCornerscorners_
 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 SynthSectionparent_
 Pointer to parent SynthSection for skin lookups.
 
Skin::SectionOverride skin_override_
 Skin override for custom appearance.
 
const vital::StatusOutputnum_voices_readout_
 StatusOutput for voice count lookups.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ CompressorEditor()

CompressorEditor::CompressorEditor ( )

Constructs a new CompressorEditor.

◆ ~CompressorEditor()

CompressorEditor::~CompressorEditor ( )
virtual

Destructor.

Member Function Documentation

◆ destroy()

void CompressorEditor::destroy ( OpenGlWrapper & open_gl)
overridevirtual

Destroys and cleans up OpenGL-related objects.

Parameters
open_glThe OpenGlWrapper containing OpenGL context information.

Reimplemented from OpenGlComponent.

◆ init()

void CompressorEditor::init ( OpenGlWrapper & open_gl)
overridevirtual

Initializes the OpenGL context and related objects.

Parameters
open_glThe OpenGlWrapper containing OpenGL context information.

Reimplemented from OpenGlComponent.

◆ mouseDoubleClick()

void CompressorEditor::mouseDoubleClick ( const MouseEvent & e)
override

Handles mouse double-click events.

Parameters
eThe mouse event.

◆ mouseDown()

void CompressorEditor::mouseDown ( const MouseEvent & e)
override

Handles mouse down events.

Parameters
eThe mouse event.

◆ mouseDrag()

void CompressorEditor::mouseDrag ( const MouseEvent & e)
override

Handles mouse drag events.

Parameters
eThe mouse event.

◆ mouseExit()

void CompressorEditor::mouseExit ( const MouseEvent & e)
override

Handles mouse exit events.

Parameters
eThe mouse event.

◆ mouseMove()

void CompressorEditor::mouseMove ( const MouseEvent & e)
override

Handles mouse move events (primarily used for updating hover state).

Parameters
eThe mouse event.

◆ mouseUp()

void CompressorEditor::mouseUp ( const MouseEvent & e)
override

Handles mouse up events.

Parameters
eThe mouse event.

◆ paintBackground()

void CompressorEditor::paintBackground ( Graphics & g)
overridevirtual

Draws the background of the editor.

Parameters
gThe JUCE graphics context to draw with.

Reimplemented from OpenGlComponent.

◆ parentHierarchyChanged()

void CompressorEditor::parentHierarchyChanged ( )
overridevirtual

Called when the component's parent hierarchy changes, used for initialization.

Reimplemented from OpenGlComponent.

◆ render()

void CompressorEditor::render ( OpenGlWrapper & open_gl,
bool animate )
overridevirtual

Renders the compressor visualization.

Parameters
open_glThe OpenGlWrapper containing OpenGL context information.
animateIf true, indicates that animation may be applied.

Implements OpenGlComponent.

◆ renderCompressor()

void CompressorEditor::renderCompressor ( OpenGlWrapper & open_gl,
bool animate )

Renders the compressor-specific elements.

Parameters
open_glThe OpenGlWrapper containing OpenGL context information.
animateIf true, indicates that animation may be applied.

◆ resized()

void CompressorEditor::resized ( )
overridevirtual

Called when the component is resized.

Reimplemented from OpenGlComponent.

◆ setActive()

void CompressorEditor::setActive ( bool active)
inline

Sets the active state of the entire compressor editor.

Parameters
activeTrue to activate, false to deactivate.

◆ setAllValues()

void CompressorEditor::setAllValues ( vital::control_map & controls)

Sets all threshold and ratio values from a given control map.

Parameters
controlsA control map containing named parameters and their values.

◆ setHighBandActive()

void CompressorEditor::setHighBandActive ( bool active)
inline

Sets the activity state of the high band.

Parameters
activeTrue to activate the high band, false otherwise.

◆ setLowBandActive()

void CompressorEditor::setLowBandActive ( bool active)
inline

Sets the activity state of the low band.

Parameters
activeTrue to activate the low band, false otherwise.

◆ setSizeRatio()

void CompressorEditor::setSizeRatio ( float ratio)
inline

Sets the size ratio, scaling the display proportionally.

Parameters
ratioThe new size ratio.

Member Data Documentation

◆ kBarWidth

float CompressorEditor::kBarWidth = 1.0f / 5.0f
staticconstexpr

Width of the displayed bars relative to the component width.

◆ kCompressorAreaBuffer

float CompressorEditor::kCompressorAreaBuffer = 0.05f
staticconstexpr

Buffer area around the compressor visualization.

◆ kDbEditBuffer

float CompressorEditor::kDbEditBuffer = 1.0f
staticconstexpr

Decibel buffer around the min and max dB edit range.

◆ kDbLineSections

int CompressorEditor::kDbLineSections = 8
staticconstexpr

Number of dB line sections in the display.

◆ kExtraDbLines

int CompressorEditor::kExtraDbLines = 6
staticconstexpr

Extra dB lines to draw for extended resolution.

◆ kGrabRadius

float CompressorEditor::kGrabRadius = 8.0f
staticconstexpr

Grab radius in pixels for clickable points (thresholds, ratio handles).

◆ kInputLineRadius

float CompressorEditor::kInputLineRadius = 0.02f
staticconstexpr

Radius for input line rendering in normalized coordinates.

◆ kMaxBands

int CompressorEditor::kMaxBands = 3
staticconstexpr

Maximum number of bands supported.

◆ kMaxDb

float CompressorEditor::kMaxDb = 0.0f
staticconstexpr

Maximum decibel value displayed in the compressor editor.

◆ kMaxEditDb

float CompressorEditor::kMaxEditDb = kMaxDb - kDbEditBuffer
staticconstexpr

Maximum editable dB value (slightly below kMaxDb).

◆ kMaxLowerRatio

float CompressorEditor::kMaxLowerRatio = 1.0f
staticconstexpr

Maximum ratio value for the lower ratio segments.

◆ kMaxUpperRatio

float CompressorEditor::kMaxUpperRatio = 1.0f
staticconstexpr

Maximum ratio value for the upper ratio segments.

◆ kMinDb

float CompressorEditor::kMinDb = -80.0f
staticconstexpr

Minimum decibel value displayed in the compressor editor.

◆ kMinEditDb

float CompressorEditor::kMinEditDb = kMinDb + kDbEditBuffer
staticconstexpr

Minimum editable dB value (slightly above kMinDb).

◆ kMinLowerRatio

float CompressorEditor::kMinLowerRatio = -1.0f
staticconstexpr

Minimum ratio value for the lower ratio segments.

◆ kMinUpperRatio

float CompressorEditor::kMinUpperRatio = 0.0f
staticconstexpr

Minimum ratio value for the upper ratio segments.

◆ kMouseMultiplier

float CompressorEditor::kMouseMultiplier = 1.0f
staticconstexpr

General multiplier for mouse-drag edits.

◆ kNumChannels

int CompressorEditor::kNumChannels = kMaxBands * 2
staticconstexpr

Number of channels (2 channels per band).

◆ kRatioDbLines

int CompressorEditor::kRatioDbLines = kDbLineSections + kExtraDbLines
staticconstexpr

Total number of dB lines for ratio calculations.

◆ kRatioEditMultiplier

float CompressorEditor::kRatioEditMultiplier = 0.6f
staticconstexpr

Multiplier applied to ratio edits for finer control.

◆ kTotalRatioLines

int CompressorEditor::kTotalRatioLines = kRatioDbLines * kNumChannels
staticconstexpr

Total number of ratio lines drawn for all bands.


The documentation for this class was generated from the following files: