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

A visual component to display a peak meter using OpenGL. More...

#include <peak_meter_viewer.h>

Inheritance diagram for PeakMeterViewer:
OpenGlComponent

Public Member Functions

 PeakMeterViewer (bool left)
 Constructs a PeakMeterViewer.
 
virtual ~PeakMeterViewer ()
 Destructor.
 
void resized () override
 Called when the component is resized. Initializes status outputs if needed.
 
void init (OpenGlWrapper &open_gl) override
 Initializes the OpenGL buffers and shader for drawing the meter.
 
void render (OpenGlWrapper &open_gl, bool animate) override
 Renders the peak meter using OpenGL.
 
void draw (OpenGlWrapper &open_gl)
 Draws the peak meter quads according to current peak and memory values.
 
void destroy (OpenGlWrapper &open_gl) override
 Releases any OpenGL resources associated with this component.
 
void paintBackground (Graphics &g) override
 Paints a background for the meter, showing ranges or thresholds.
 
- Public Member Functions inherited from OpenGlComponent
 OpenGlComponent (String name="")
 Constructs an OpenGlComponent.
 
virtual ~OpenGlComponent ()
 Destructor.
 
virtual void parentHierarchyChanged () override
 Called when the component's parent hierarchy changes.
 
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.
 

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 visual component to display a peak meter using OpenGL.

The PeakMeterViewer class shows a peak meter (such as levels of audio signals) in a graphical form. It uses two sets of vertices: one for the current peak and one for a peak memory reading. The meter is displayed as a vertical bar that moves based on the dB values of the signal.

Constructor & Destructor Documentation

◆ PeakMeterViewer()

PeakMeterViewer::PeakMeterViewer ( bool left)

Constructs a PeakMeterViewer.

Parameters
leftIf true, displays the left channel of the peak meter, else the right channel.

◆ ~PeakMeterViewer()

PeakMeterViewer::~PeakMeterViewer ( )
virtual

Destructor.

Member Function Documentation

◆ destroy()

void PeakMeterViewer::destroy ( OpenGlWrapper & open_gl)
overridevirtual

Releases any OpenGL resources associated with this component.

Parameters
open_glThe OpenGlWrapper with the current OpenGL context.

Reimplemented from OpenGlComponent.

◆ draw()

void PeakMeterViewer::draw ( OpenGlWrapper & open_gl)

Draws the peak meter quads according to current peak and memory values.

Parameters
open_glThe OpenGlWrapper with the current OpenGL context.

◆ init()

void PeakMeterViewer::init ( OpenGlWrapper & open_gl)
overridevirtual

Initializes the OpenGL buffers and shader for drawing the meter.

Parameters
open_glThe OpenGlWrapper with the current OpenGL context.

Reimplemented from OpenGlComponent.

◆ paintBackground()

void PeakMeterViewer::paintBackground ( Graphics & g)
overridevirtual

Paints a background for the meter, showing ranges or thresholds.

Parameters
gThe JUCE Graphics context.

Reimplemented from OpenGlComponent.

◆ render()

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

Renders the peak meter using OpenGL.

Parameters
open_glThe OpenGlWrapper providing the current OpenGL context.
animateIf true, any animations or transitions may be applied.

Implements OpenGlComponent.

◆ resized()

void PeakMeterViewer::resized ( )
overridevirtual

Called when the component is resized. Initializes status outputs if needed.

Reimplemented from OpenGlComponent.


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