Video display and composing engine for JUCE
Loading...
Searching...
No Matches
LevelMeter Class Reference

#include <LevelMeter.h>

Inherits Component, and Timer.

Classes

class  Listener
 DEPRECATED: Instead of using the Listener, use the new lambdas: More...
 
class  LookAndFeelMethods
 These methods define a interface for the LookAndFeel class of juce. More...
 

Public Types

enum  MeterFlags {
  Default = 0x0000 , Horizontal = 0x0001 , Vintage = 0x0002 , SingleChannel = 0x0004 ,
  HasBorder = 0x0008 , Reduction = 0x0010 , Minimal = 0x0020 , MaxNumber = 0x0040
}
 
enum  ColourIds {
  lmTextColour = 0x2200001 , lmTextDeactiveColour , lmTextClipColour , lmTicksColour ,
  lmOutlineColour , lmBackgroundColour , lmBackgroundClipColour , lmMeterForegroundColour ,
  lmMeterOutlineColour , lmMeterBackgroundColour , lmMeterMaxNormalColour , lmMeterMaxWarnColour ,
  lmMeterMaxOverColour , lmMeterGradientLowColour , lmMeterGradientMidColour , lmMeterGradientMaxColour ,
  lmMeterReductionColour
}
 

Public Member Functions

 LevelMeter (MeterFlags type=HasBorder)
 
 ~LevelMeter () override
 
void setMeterFlags (MeterFlags type)
 Allows to change the meter's configuration by setting a combination of MeterFlags.
 
void paint (juce::Graphics &) override
 
void resized () override
 
void visibilityChanged () override
 
void timerCallback () override
 
void setMeterSource (foleys::LevelMeterSource *source)
 Set a LevelMeterSource to display.
 
void setSelectedChannel (int c)
 Set a specific channel to display.
 
void setFixedNumChannels (int numChannels)
 If you don't know, how many channels will be in the processblock, you can set this number to avoid stretching the width of the channels.
 
void setRefreshRateHz (int newRefreshRate)
 
void clearClipIndicator (int channel=-1)
 Unset the clip indicator flag for a channel.
 
void clearMaxLevelDisplay (int channel=-1)
 Set the max level display back to -inf for a channel.
 
void mouseDown (const juce::MouseEvent &event) override
 
void parentHierarchyChanged () override
 
void lookAndFeelChanged () override
 
void addListener (foleys::LevelMeter::Listener *)
 
void removeListener (foleys::LevelMeter::Listener *)
 

Public Attributes

std::function< void(foleys::LevelMeter &meter, int channel, juce::ModifierKeys mods)> onClipLightClicked
 This lambda is called when the user clicks on a clip light.
 
std::function< void(foleys::LevelMeter &meter, int channel, juce::ModifierKeys mods)> onMaxLevelClicked
 This lambda is called when the user clicks on a max level display.
 

Member Enumeration Documentation

◆ MeterFlags

enum MeterFlags
Enumerator
Default 

Default is showing all channels in the LevelMeterSource without a border.

Horizontal 

Displays the level bars horizontally.

Vintage 

Switches to a special mode of old school meters (to come)

SingleChannel 

Display only one channel meter.

See also
setSelectedChannel
HasBorder 

Displays a rounded border around the meter.

This is used with the default constructor

Reduction 

This turns the bar into a reduction bar.

The additional reduction bar is automatically added, as soon a reduction value < 1.0 is set in the LevelMeterSource.

See also
LevelMeterSource::setReductionLevel
Minimal 

For a stereo meter, this tries to save space by showing only one line tickmarks in the middle and no max numbers.

MaxNumber 

To add level meter to Minimal, set this flag.

◆ ColourIds

enum ColourIds
Enumerator
lmTextColour 

Colour for the numbers etc.

lmTextDeactiveColour 

Unused, will eventually be removed.

lmTextClipColour 

Colour to print the max number if it has clipped.

lmTicksColour 

Colour for the tick marks.

lmOutlineColour 

Colour for the frame around all.

lmBackgroundColour 

Background colour.

lmBackgroundClipColour 

This is the colour of the clip indicator if it has clipped.

lmMeterForegroundColour 

Unused, will eventually be removed.

lmMeterOutlineColour 

Colour for the outlines of meter bars etc.

lmMeterBackgroundColour 

Background colour for the actual meter bar and the max number.

lmMeterMaxNormalColour 

Text colour for the max number, if under warn threshold.

lmMeterMaxWarnColour 

Text colour for the max number, if between warn threshold and clip threshold.

lmMeterMaxOverColour 

Text colour for the max number, if above the clip threshold.

lmMeterGradientLowColour 

Colour for the meter bar under the warn threshold.

lmMeterGradientMidColour 

Colour for the meter bar in the warn area.

lmMeterGradientMaxColour 

Colour for the meter bar at the clip threshold.

lmMeterReductionColour 

Colour for the reduction meter displayed within the meter.

Constructor & Destructor Documentation

◆ LevelMeter()

◆ ~LevelMeter()

~LevelMeter ( )
override

Member Function Documentation

◆ setMeterFlags()

void setMeterFlags ( MeterFlags  type)

Allows to change the meter's configuration by setting a combination of MeterFlags.

◆ paint()

◆ resized()

void resized ( )
override

◆ visibilityChanged()

void visibilityChanged ( )
override

◆ timerCallback()

void timerCallback ( )
override

◆ setMeterSource()

void setMeterSource ( foleys::LevelMeterSource source)

Set a LevelMeterSource to display.

This separation is used, so the source can work in the processing and the GUI can display the values.

◆ setSelectedChannel()

void setSelectedChannel ( int  c)

Set a specific channel to display.

This is only useful, if MeterFlags::SingleChannel is set.

◆ setFixedNumChannels()

void setFixedNumChannels ( int  numChannels)

If you don't know, how many channels will be in the processblock, you can set this number to avoid stretching the width of the channels.

◆ setRefreshRateHz()

void setRefreshRateHz ( int  newRefreshRate)

◆ clearClipIndicator()

void clearClipIndicator ( int  channel = -1)

Unset the clip indicator flag for a channel.

Use -1 to reset all clip indicators.

Referenced by LevelMeter::LevelMeter().

◆ clearMaxLevelDisplay()

void clearMaxLevelDisplay ( int  channel = -1)

Set the max level display back to -inf for a channel.

Use -1 to reset all max levels.

Referenced by LevelMeter::LevelMeter().

◆ mouseDown()

◆ parentHierarchyChanged()

void parentHierarchyChanged ( )
override

◆ lookAndFeelChanged()

void lookAndFeelChanged ( )
override

◆ addListener()

void addListener ( foleys::LevelMeter::Listener listener)

◆ removeListener()

void removeListener ( foleys::LevelMeter::Listener listener)

Member Data Documentation

◆ onClipLightClicked

std::function<void(foleys::LevelMeter& meter, int channel, juce::ModifierKeys mods)> onClipLightClicked

This lambda is called when the user clicks on a clip light.

It is initially set to clear all clip lights and max level numbers.

Referenced by LevelMeter::LevelMeter(), and LevelMeter::mouseDown().

◆ onMaxLevelClicked

std::function<void(foleys::LevelMeter& meter, int channel, juce::ModifierKeys mods)> onMaxLevelClicked

This lambda is called when the user clicks on a max level display.

It is initially set to clear all clip lights and max level numbers.

Referenced by LevelMeter::LevelMeter(), and LevelMeter::mouseDown().


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