ff_meters
Add meter components to visualise AudioBuffers
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Groups Pages
Classes | Functions
Ff_meters

Classes

class  foleys::LevelMeter
 
class  foleys::LevelMeterSource
 To get a meter GUI create a LevelMeterSource in your AudioProcessor or whatever instance processes an AudioBuffer. More...
 
class  foleys::LevelMeterLookAndFeel
 Convenience LookAndFeel which derives from LookAndFeel_V3 and LevelMeter::LookAndFeelMethods. More...
 
class  foleys::OutlineBuffer
 This class implements a circular buffer to store min and max values of anaudio signal. More...
 
class  foleys::StereoFieldBuffer< FloatType >
 This class implements a circular buffer to buffer audio samples. More...
 
class  foleys::StereoFieldComponent
 This class implements a circular buffer to buffer audio samples. More...
 

Functions

LevelMeter::MeterFlags foleys::operator| (LevelMeter::MeterFlags a, LevelMeter::MeterFlags b)
 

Detailed Description


Class Documentation

class foleys::LevelMeter
+ Inheritance diagram for foleys::LevelMeter:

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 (const MeterFlags type=HasBorder)
 
 ~LevelMeter () override
 
void setMeterFlags (const MeterFlags type)
 Allows to change the meter's configuration by setting a combination of MeterFlags. More...
 
void paint (juce::Graphics &) override
 
void resized () override
 
void visibilityChanged () override
 
void timerCallback () override
 
void setMeterSource (foleys::LevelMeterSource *source)
 Set a LevelMeterSource to display. More...
 
void setSelectedChannel (const int c)
 Set a specific channel to display. More...
 
void setFixedNumChannels (const 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. More...
 
void setRefreshRateHz (const int newRefreshRate)
 
void clearClipIndicator (const int channel=-1)
 Unset the clip indicator flag for a channel. More...
 
void clearMaxLevelDisplay (const int channel=-1)
 Set the max level display back to -inf for a channel. More...
 
void mouseDown (const juce::MouseEvent &event) 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. More...
 
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. More...
 

Member Enumeration Documentation

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.

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

foleys::LevelMeter::LevelMeter ( const MeterFlags  type = HasBorder)
foleys::LevelMeter::~LevelMeter ( )
override

Member Function Documentation

void foleys::LevelMeter::setMeterFlags ( const MeterFlags  type)

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

void foleys::LevelMeter::paint ( juce::Graphics &  g)
override
void foleys::LevelMeter::resized ( )
override
void foleys::LevelMeter::visibilityChanged ( )
override
void foleys::LevelMeter::timerCallback ( )
override
void foleys::LevelMeter::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.

void foleys::LevelMeter::setSelectedChannel ( const int  c)

Set a specific channel to display.

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

void foleys::LevelMeter::setFixedNumChannels ( const 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 foleys::LevelMeter::setRefreshRateHz ( const int  newRefreshRate)
void foleys::LevelMeter::clearClipIndicator ( const int  channel = -1)

Unset the clip indicator flag for a channel.

Use -1 to reset all clip indicators.

Referenced by LevelMeter().

void foleys::LevelMeter::clearMaxLevelDisplay ( const int  channel = -1)

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

Use -1 to reset all max levels.

Referenced by LevelMeter().

void foleys::LevelMeter::mouseDown ( const juce::MouseEvent &  event)
override
void foleys::LevelMeter::addListener ( foleys::LevelMeter::Listener listener)
void foleys::LevelMeter::removeListener ( foleys::LevelMeter::Listener listener)

Member Data Documentation

std::function<void(foleys::LevelMeter& meter, int channel, juce::ModifierKeys mods)> foleys::LevelMeter::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().

std::function<void(foleys::LevelMeter& meter, int channel, juce::ModifierKeys mods)> foleys::LevelMeter::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().

class foleys::LevelMeterSource

To get a meter GUI create a LevelMeterSource in your AudioProcessor or whatever instance processes an AudioBuffer.

Then call LevelMeterSource::measureBlock (AudioBuffer<float>& buf) to create the readings.

Public Member Functions

 LevelMeterSource ()
 
 ~LevelMeterSource ()
 
void resize (const int channels, const int rmsWindow)
 Resize the meters data containers. More...
 
template<typename FloatType >
void measureBlock (const juce::AudioBuffer< FloatType > &buffer)
 Call this method to measure a block af levels to be displayed in the meters. More...
 
void decayIfNeeded ()
 This is called from the GUI. More...
 
void setReductionLevel (const int channel, const float reduction)
 With the reduction level you can add an extra bar do indicate, by what amount the level was reduced. More...
 
void setReductionLevel (const float reduction)
 With the reduction level you can add an extra bar do indicate, by what amount the level was reduced. More...
 
void setMaxHoldMS (const juce::int64 millis)
 Set the timeout, how long the peak line will be displayed, before it resets to the current peak. More...
 
float getReductionLevel (const int channel) const
 Returns the reduction level. More...
 
float getMaxLevel (const int channel) const
 This is the max level as displayed by the little line above the RMS bar. More...
 
float getMaxOverallLevel (const int channel) const
 This is the max level as displayed under the bar as number. More...
 
float getRMSLevel (const int channel) const
 This is the RMS level that the bar will indicate. More...
 
bool getClipFlag (const int channel) const
 Returns the status of the clip flag. More...
 
void clearClipFlag (const int channel)
 Reset the clip flag to reset the indicator in the meter. More...
 
void clearAllClipFlags ()
 
void clearMaxNum (const int channel)
 Reset the max number to minus infinity. More...
 
void clearAllMaxNums ()
 Reset all max numbers. More...
 
int getNumChannels () const
 Get the number of channels to be displayed. More...
 
void setSuspended (const bool shouldBeSuspended)
 The measure can be suspended, e.g. More...
 
bool checkNewDataFlag () const
 
void resetNewDataFlag ()
 

Constructor & Destructor Documentation

foleys::LevelMeterSource::LevelMeterSource ( )
foleys::LevelMeterSource::~LevelMeterSource ( )

Member Function Documentation

void foleys::LevelMeterSource::resize ( const int  channels,
const int  rmsWindow 
)

Resize the meters data containers.

Set the

Parameters
numChannelsto the number of channels. If you don't do this in prepareToPlay, it will be done when calling measureBlock, but a few bytes will be allocated on the audio thread, so be aware.
rmsWindowis the number of rms values to gather. Keep that aligned with the sampleRate and the blocksize to get reproducable results. e.g. rmsWindow = msecs * 0.001f * sampleRate / blockSize; : don't call this when measureBlock is processing
template<typename FloatType >
void foleys::LevelMeterSource::measureBlock ( const juce::AudioBuffer< FloatType > &  buffer)

Call this method to measure a block af levels to be displayed in the meters.

void foleys::LevelMeterSource::decayIfNeeded ( )

This is called from the GUI.

If processing was stalled, this will pump zeroes into the buffer, until the readings return to zero.

void foleys::LevelMeterSource::setReductionLevel ( const int  channel,
const float  reduction 
)

With the reduction level you can add an extra bar do indicate, by what amount the level was reduced.

This will be printed on top of the bar with half the width.

Parameters
channelthe channel index, that was reduced
reductionthe factor for the reduction applied to the channel, 1.0=no reduction, 0.0=block completely
void foleys::LevelMeterSource::setReductionLevel ( const float  reduction)

With the reduction level you can add an extra bar do indicate, by what amount the level was reduced.

This will be printed on top of the bar with half the width.

Parameters
reductionthe factor for the reduction applied to all channels, 1.0=no reduction, 0.0=muted completely
void foleys::LevelMeterSource::setMaxHoldMS ( const juce::int64  millis)

Set the timeout, how long the peak line will be displayed, before it resets to the current peak.

float foleys::LevelMeterSource::getReductionLevel ( const int  channel) const

Returns the reduction level.

This value is not computed but can be set manually via

See Also
setReductionLevel.

Referenced by drawMeterBars(), and drawMeterChannel().

float foleys::LevelMeterSource::getMaxLevel ( const int  channel) const

This is the max level as displayed by the little line above the RMS bar.

It is reset by

See Also
setMaxHoldMS.

Referenced by drawMeterBars(), and drawMeterChannel().

float foleys::LevelMeterSource::getMaxOverallLevel ( const int  channel) const

This is the max level as displayed under the bar as number.

It will stay up until

See Also
clearMaxNum was called.

Referenced by drawMeterBars(), and drawMeterChannel().

float foleys::LevelMeterSource::getRMSLevel ( const int  channel) const

This is the RMS level that the bar will indicate.

It is summed over rmsWindow number of blocks/measureBlock calls.

Referenced by drawMeterBars(), and drawMeterChannel().

bool foleys::LevelMeterSource::getClipFlag ( const int  channel) const

Returns the status of the clip flag.

Referenced by drawMeterBars(), and drawMeterChannel().

void foleys::LevelMeterSource::clearClipFlag ( const int  channel)

Reset the clip flag to reset the indicator in the meter.

void foleys::LevelMeterSource::clearAllClipFlags ( )
void foleys::LevelMeterSource::clearMaxNum ( const int  channel)

Reset the max number to minus infinity.

void foleys::LevelMeterSource::clearAllMaxNums ( )

Reset all max numbers.

int foleys::LevelMeterSource::getNumChannels ( ) const

Get the number of channels to be displayed.

Referenced by drawMeterBars(), hitTestClipIndicator(), and hitTestMaxNumber().

void foleys::LevelMeterSource::setSuspended ( const bool  shouldBeSuspended)

The measure can be suspended, e.g.

to save CPU when no meter is displayed. In this case, the

See Also
measureBlock will return immediately
bool foleys::LevelMeterSource::checkNewDataFlag ( ) const
void foleys::LevelMeterSource::resetNewDataFlag ( )
class foleys::LevelMeterLookAndFeel

Convenience LookAndFeel which derives from LookAndFeel_V3 and LevelMeter::LookAndFeelMethods.

This is the shortcut, to get a component going without inheriting any LookAndFeel class. If you write your own LookAndFeel, you can include ff_meters_LookAndFeelMethods.h inside your LookAndFeel:

class MyLookAndFeel : public LookAndFeel_V4, LevelMeter::LookAndFeelMethods
{
public:
// ...
};
+ Inheritance diagram for foleys::LevelMeterLookAndFeel:

Public Member Functions

 LevelMeterLookAndFeel ()
 
virtual ~LevelMeterLookAndFeel () override
 
void setupDefaultMeterColours () override
 Define your default colours in this callback. More...
 
void updateMeterGradients () override
 Call this to create the cached ColourGradients after changing colours of the meter gradients. More...
 
juce::Rectangle< float > getMeterInnerBounds (const juce::Rectangle< float > bounds, const foleys::LevelMeter::MeterFlags meterType) const override
 Override this to change the inner rectangle in case you want to paint a border e.g. More...
 
juce::Rectangle< float > getMeterBounds (const juce::Rectangle< float > bounds, const foleys::LevelMeter::MeterFlags meterType, const int numChannels, const int channel) const override
 Override this callback to define the placement of a meter channel. More...
 
juce::Rectangle< float > getMeterBarBounds (const juce::Rectangle< float > bounds, const foleys::LevelMeter::MeterFlags meterType) const override
 Override this callback to define the placement of the actual meter bar. More...
 
juce::Rectangle< float > getMeterTickmarksBounds (const juce::Rectangle< float > bounds, const foleys::LevelMeter::MeterFlags meterType) const override
 Override this callback to define the placement of the tickmarks. More...
 
juce::Rectangle< float > getMeterClipIndicatorBounds (const juce::Rectangle< float > bounds, const foleys::LevelMeter::MeterFlags meterType) const override
 Override this callback to define the placement of the clip indicator light. More...
 
juce::Rectangle< float > getMeterMaxNumberBounds (const juce::Rectangle< float > bounds, const foleys::LevelMeter::MeterFlags meterType) const override
 Override this callback to define the placement of the max level. More...
 
juce::Rectangle< float > drawBackground (juce::Graphics &g, const foleys::LevelMeter::MeterFlags meterType, const juce::Rectangle< float > bounds) override
 Override this to draw background and if wanted a frame. More...
 
void drawMeterBars (juce::Graphics &g, const foleys::LevelMeter::MeterFlags meterType, const juce::Rectangle< float > bounds, const foleys::LevelMeterSource *source, const int fixedNumChannels=-1, const int selectedChannel=-1) override
 This is called to draw the actual numbers and bars on top of the static background. More...
 
void drawMeterBarsBackground (juce::Graphics &g, const foleys::LevelMeter::MeterFlags meterType, const juce::Rectangle< float > bounds, const int numChannels, const int fixedNumChannels) override
 This draws the static background of the whole level meter group with all channels. More...
 
void drawMeterChannel (juce::Graphics &g, const foleys::LevelMeter::MeterFlags meterType, const juce::Rectangle< float > bounds, const foleys::LevelMeterSource *source, const int selectedChannel) override
 This draws a group of informations representing one channel. More...
 
void drawMeterChannelBackground (juce::Graphics &g, const foleys::LevelMeter::MeterFlags meterType, const juce::Rectangle< float > bounds) override
 This draws the static backgrounds representing one channel. More...
 
void drawMeterBar (juce::Graphics &g, const foleys::LevelMeter::MeterFlags meterType, const juce::Rectangle< float > bounds, const float rms, const float peak) override
 This callback draws the actual level bar. More...
 
void drawMeterReduction (juce::Graphics &g, const foleys::LevelMeter::MeterFlags meterType, const juce::Rectangle< float > bounds, const float reduction) override
 This callback draws an reduction from top. More...
 
void drawMeterBarBackground (juce::Graphics &g, const foleys::LevelMeter::MeterFlags meterType, const juce::Rectangle< float > bounds) override
 This draws the background for the actual level bar. More...
 
void drawTickMarks (juce::Graphics &g, const foleys::LevelMeter::MeterFlags meterType, const juce::Rectangle< float > bounds) override
 This draws the tickmarks for the level scale. More...
 
void drawClipIndicator (juce::Graphics &g, const foleys::LevelMeter::MeterFlags meterType, const juce::Rectangle< float > bounds, const bool hasClipped) override
 This callback draws the clip indicator. More...
 
void drawClipIndicatorBackground (juce::Graphics &g, const foleys::LevelMeter::MeterFlags meterType, const juce::Rectangle< float > bounds) override
 This draws the background for the clip indicator LED. More...
 
void drawMaxNumber (juce::Graphics &g, const foleys::LevelMeter::MeterFlags meterType, const juce::Rectangle< float > bounds, const float maxGain) override
 This callback draws the number of maximum level. More...
 
void drawMaxNumberBackground (juce::Graphics &g, const foleys::LevelMeter::MeterFlags meterType, const juce::Rectangle< float > bounds) override
 This draws the background for the maximum level display. More...
 
int hitTestClipIndicator (const juce::Point< int > position, const foleys::LevelMeter::MeterFlags meterType, const juce::Rectangle< float > bounds, const foleys::LevelMeterSource *source) const override
 This is called by the frontend to check, if the clip indicator was clicked (e.g. More...
 
int hitTestMaxNumber (const juce::Point< int > position, const foleys::LevelMeter::MeterFlags meterType, const juce::Rectangle< float > bounds, const foleys::LevelMeterSource *source) const override
 This is called by the frontend to check, if the maximum level number was clicked (e.g. More...
 
- Public Member Functions inherited from foleys::LevelMeter::LookAndFeelMethods
virtual ~LookAndFeelMethods ()
 
- Public Member Functions inherited from foleys::StereoFieldComponent::LookAndFeelMethods
virtual ~LookAndFeelMethods ()
 
virtual void drawStereoField (juce::Graphics &g, const juce::Rectangle< float > bounds, const StereoFieldBuffer< float > &, const int leftIdx=0, const int rightIdx=1)=0
 

Constructor & Destructor Documentation

foleys::LevelMeterLookAndFeel::LevelMeterLookAndFeel ( )
virtual foleys::LevelMeterLookAndFeel::~LevelMeterLookAndFeel ( )
overridevirtual

Member Function Documentation

void foleys::LevelMeterLookAndFeel::setupDefaultMeterColours ( )
overridevirtual

Define your default colours in this callback.

Implements foleys::LevelMeter::LookAndFeelMethods.

Referenced by LevelMeterLookAndFeel().

void foleys::LevelMeterLookAndFeel::updateMeterGradients ( )
overridevirtual

Call this to create the cached ColourGradients after changing colours of the meter gradients.

Implements foleys::LevelMeter::LookAndFeelMethods.

juce::Rectangle<float> foleys::LevelMeterLookAndFeel::getMeterInnerBounds ( const juce::Rectangle< float >  bounds,
const foleys::LevelMeter::MeterFlags  meterType 
) const
overridevirtual

Override this to change the inner rectangle in case you want to paint a border e.g.

Implements foleys::LevelMeter::LookAndFeelMethods.

juce::Rectangle<float> foleys::LevelMeterLookAndFeel::getMeterBounds ( const juce::Rectangle< float >  bounds,
const foleys::LevelMeter::MeterFlags  meterType,
const int  numChannels,
const int  channel 
) const
overridevirtual

Override this callback to define the placement of a meter channel.

Implements foleys::LevelMeter::LookAndFeelMethods.

juce::Rectangle<float> foleys::LevelMeterLookAndFeel::getMeterBarBounds ( const juce::Rectangle< float >  bounds,
const foleys::LevelMeter::MeterFlags  meterType 
) const
overridevirtual

Override this callback to define the placement of the actual meter bar.

Implements foleys::LevelMeter::LookAndFeelMethods.

juce::Rectangle<float> foleys::LevelMeterLookAndFeel::getMeterTickmarksBounds ( const juce::Rectangle< float >  bounds,
const foleys::LevelMeter::MeterFlags  meterType 
) const
overridevirtual

Override this callback to define the placement of the tickmarks.

To disable this feature return an empty rectangle.

Implements foleys::LevelMeter::LookAndFeelMethods.

juce::Rectangle<float> foleys::LevelMeterLookAndFeel::getMeterClipIndicatorBounds ( const juce::Rectangle< float >  bounds,
const foleys::LevelMeter::MeterFlags  meterType 
) const
overridevirtual

Override this callback to define the placement of the clip indicator light.

To disable this feature return an empty rectangle.

Implements foleys::LevelMeter::LookAndFeelMethods.

juce::Rectangle<float> foleys::LevelMeterLookAndFeel::getMeterMaxNumberBounds ( const juce::Rectangle< float >  bounds,
const foleys::LevelMeter::MeterFlags  meterType 
) const
overridevirtual

Override this callback to define the placement of the max level.

To disable this feature return an empty rectangle.

Implements foleys::LevelMeter::LookAndFeelMethods.

juce::Rectangle<float> foleys::LevelMeterLookAndFeel::drawBackground ( juce::Graphics &  ,
const foleys::LevelMeter::MeterFlags  meterType,
const juce::Rectangle< float >  bounds 
)
overridevirtual

Override this to draw background and if wanted a frame.

If the frame takes space away, it should return the reduced bounds

Implements foleys::LevelMeter::LookAndFeelMethods.

void foleys::LevelMeterLookAndFeel::drawMeterBars ( juce::Graphics &  ,
const foleys::LevelMeter::MeterFlags  meterType,
const juce::Rectangle< float >  bounds,
const foleys::LevelMeterSource source,
const int  fixedNumChannels = -1,
const int  selectedChannel = -1 
)
overridevirtual

This is called to draw the actual numbers and bars on top of the static background.

Implements foleys::LevelMeter::LookAndFeelMethods.

void foleys::LevelMeterLookAndFeel::drawMeterBarsBackground ( juce::Graphics &  ,
const foleys::LevelMeter::MeterFlags  meterType,
const juce::Rectangle< float >  bounds,
const int  numChannels,
const int  fixedNumChannels 
)
overridevirtual

This draws the static background of the whole level meter group with all channels.

Implements foleys::LevelMeter::LookAndFeelMethods.

void foleys::LevelMeterLookAndFeel::drawMeterChannel ( juce::Graphics &  ,
const foleys::LevelMeter::MeterFlags  meterType,
const juce::Rectangle< float >  bounds,
const foleys::LevelMeterSource source,
const int  selectedChannel 
)
overridevirtual

This draws a group of informations representing one channel.

Implements foleys::LevelMeter::LookAndFeelMethods.

void foleys::LevelMeterLookAndFeel::drawMeterChannelBackground ( juce::Graphics &  ,
const foleys::LevelMeter::MeterFlags  meterType,
const juce::Rectangle< float >  bounds 
)
overridevirtual

This draws the static backgrounds representing one channel.

Implements foleys::LevelMeter::LookAndFeelMethods.

void foleys::LevelMeterLookAndFeel::drawMeterBar ( juce::Graphics &  ,
const foleys::LevelMeter::MeterFlags  meterType,
const juce::Rectangle< float >  bounds,
const float  rms,
const float  peak 
)
overridevirtual

This callback draws the actual level bar.

The background has an extra callback

Implements foleys::LevelMeter::LookAndFeelMethods.

void foleys::LevelMeterLookAndFeel::drawMeterReduction ( juce::Graphics &  g,
const foleys::LevelMeter::MeterFlags  meterType,
const juce::Rectangle< float >  bounds,
const float  reduction 
)
overridevirtual

This callback draws an reduction from top.

Only triggered, if a reduction < 1.0 is set in the LevelMeterSource

Implements foleys::LevelMeter::LookAndFeelMethods.

void foleys::LevelMeterLookAndFeel::drawMeterBarBackground ( juce::Graphics &  ,
const foleys::LevelMeter::MeterFlags  meterType,
const juce::Rectangle< float >  bounds 
)
overridevirtual

This draws the background for the actual level bar.

Implements foleys::LevelMeter::LookAndFeelMethods.

void foleys::LevelMeterLookAndFeel::drawTickMarks ( juce::Graphics &  ,
const foleys::LevelMeter::MeterFlags  meterType,
const juce::Rectangle< float >  bounds 
)
overridevirtual

This draws the tickmarks for the level scale.

It is painted on the static background

Implements foleys::LevelMeter::LookAndFeelMethods.

void foleys::LevelMeterLookAndFeel::drawClipIndicator ( juce::Graphics &  ,
const foleys::LevelMeter::MeterFlags  meterType,
const juce::Rectangle< float >  bounds,
const bool  hasClipped 
)
overridevirtual

This callback draws the clip indicator.

The background has an extra callback

Implements foleys::LevelMeter::LookAndFeelMethods.

void foleys::LevelMeterLookAndFeel::drawClipIndicatorBackground ( juce::Graphics &  ,
const foleys::LevelMeter::MeterFlags  meterType,
const juce::Rectangle< float >  bounds 
)
overridevirtual

This draws the background for the clip indicator LED.

Implements foleys::LevelMeter::LookAndFeelMethods.

void foleys::LevelMeterLookAndFeel::drawMaxNumber ( juce::Graphics &  ,
const foleys::LevelMeter::MeterFlags  meterType,
const juce::Rectangle< float >  bounds,
const float  maxGain 
)
overridevirtual

This callback draws the number of maximum level.

The background has an extra callback

Implements foleys::LevelMeter::LookAndFeelMethods.

void foleys::LevelMeterLookAndFeel::drawMaxNumberBackground ( juce::Graphics &  ,
const foleys::LevelMeter::MeterFlags  meterType,
const juce::Rectangle< float >  bounds 
)
overridevirtual

This draws the background for the maximum level display.

Implements foleys::LevelMeter::LookAndFeelMethods.

int foleys::LevelMeterLookAndFeel::hitTestClipIndicator ( const juce::Point< int >  position,
const foleys::LevelMeter::MeterFlags  meterType,
const juce::Rectangle< float >  bounds,
const foleys::LevelMeterSource source 
) const
overridevirtual

This is called by the frontend to check, if the clip indicator was clicked (e.g.

for reset)

Implements foleys::LevelMeter::LookAndFeelMethods.

int foleys::LevelMeterLookAndFeel::hitTestMaxNumber ( const juce::Point< int >  position,
const foleys::LevelMeter::MeterFlags  meterType,
const juce::Rectangle< float >  bounds,
const foleys::LevelMeterSource source 
) const
overridevirtual

This is called by the frontend to check, if the maximum level number was clicked (e.g.

for reset)

Implements foleys::LevelMeter::LookAndFeelMethods.

class foleys::OutlineBuffer

This class implements a circular buffer to store min and max values of anaudio signal.

The block size can be specified. At any time the UI can request an outline of the last n blocks as Path to fill or stroke

Public Member Functions

 OutlineBuffer ()
 
void setSize (const int numChannels, const int numBlocks)
 
void setSamplesPerBlock (const int numSamples)
 
void pushBlock (const juce::AudioBuffer< float > &buffer, const int numSamples)
 Push a block of audio samples into the outline buffer. More...
 
void getChannelOutline (juce::Path &path, const juce::Rectangle< float > bounds, const int channel, const int numSamples) const
 Returns the outline of a specific channel inside the bounds. More...
 
void getChannelOutline (juce::Path &path, const juce::Rectangle< float > bounds, const int numSamples) const
 This returns the outlines of each channel, splitting the bounds into equal sized rows. More...
 

Constructor & Destructor Documentation

foleys::OutlineBuffer::OutlineBuffer ( )

Member Function Documentation

void foleys::OutlineBuffer::setSize ( const int  numChannels,
const int  numBlocks 
)
Parameters
numChannelsis the number of channels the buffer will store
numBlocksis the number of values the buffer will store. Allow a little safety buffer, so you don't write into the part, where it is currently read
void foleys::OutlineBuffer::setSamplesPerBlock ( const int  numSamples)
Parameters
numSamplessets the size of each analysed block
void foleys::OutlineBuffer::pushBlock ( const juce::AudioBuffer< float > &  buffer,
const int  numSamples 
)

Push a block of audio samples into the outline buffer.

void foleys::OutlineBuffer::getChannelOutline ( juce::Path &  path,
const juce::Rectangle< float >  bounds,
const int  channel,
const int  numSamples 
) const

Returns the outline of a specific channel inside the bounds.

Parameters
pathis a Path to be populated
boundsthe rectangle to paint within. The result is not clipped, if samples are exceeding 1.0, it may paint outside
channelthe index of the channel to paint
numSamplesis the number of sample blocks
Returns
a path with a single channel outline (min to max)

Referenced by getChannelOutline().

void foleys::OutlineBuffer::getChannelOutline ( juce::Path &  path,
const juce::Rectangle< float >  bounds,
const int  numSamples 
) const

This returns the outlines of each channel, splitting the bounds into equal sized rows.

Parameters
pathis a Path to be populated
boundsthe rectangle to paint within. The result is not clipped, if samples are exceeding 1.0, it may paint outside
numSamplesis the number of sample blocks
Returns
a path with a single channel outline (min to max)

References getChannelOutline().

class foleys::StereoFieldBuffer

template<typename FloatType>
class foleys::StereoFieldBuffer< FloatType >

This class implements a circular buffer to buffer audio samples.

At any time the GUI can ask for a stereo field visualisation of two neightbouring channels.

Public Member Functions

 StereoFieldBuffer ()
 
void setBufferSize (int newNumChannels, int newNumSamples)
 
void pushSampleBlock (juce::AudioBuffer< FloatType > buffer, int numSamples)
 
void resetMaxValues ()
 
juce::Path getOscilloscope (const int numSamples, const juce::Rectangle< FloatType > bounds, int leftIdx, int rightIdx) const
 
void getDirections (std::vector< FloatType > &directions, int numSamples, int leftIdx, int rightIdx)
 

Constructor & Destructor Documentation

template<typename FloatType>
foleys::StereoFieldBuffer< FloatType >::StereoFieldBuffer ( )

Member Function Documentation

template<typename FloatType>
void foleys::StereoFieldBuffer< FloatType >::setBufferSize ( int  newNumChannels,
int  newNumSamples 
)
template<typename FloatType>
void foleys::StereoFieldBuffer< FloatType >::pushSampleBlock ( juce::AudioBuffer< FloatType >  buffer,
int  numSamples 
)
template<typename FloatType>
void foleys::StereoFieldBuffer< FloatType >::resetMaxValues ( )
template<typename FloatType>
juce::Path foleys::StereoFieldBuffer< FloatType >::getOscilloscope ( const int  numSamples,
const juce::Rectangle< FloatType >  bounds,
int  leftIdx,
int  rightIdx 
) const
template<typename FloatType>
void foleys::StereoFieldBuffer< FloatType >::getDirections ( std::vector< FloatType > &  directions,
int  numSamples,
int  leftIdx,
int  rightIdx 
)
class foleys::StereoFieldComponent

This class implements a circular buffer to buffer audio samples.

At any time the GUI can ask for a stereo field visualisation of two neightbouring channels.

+ Inheritance diagram for foleys::StereoFieldComponent:

Public Types

enum  { GonioMeter = 0, StereoField }
 
enum  ColourIds {
  backgroundColour = 0x2200101, borderColour, outlineColour, gonioColour,
  currentValuesColour, maxValuesColour
}
 

Public Member Functions

 StereoFieldComponent (StereoFieldBuffer< float > &stereo)
 
void paint (juce::Graphics &g) override
 

Member Enumeration Documentation

anonymous enum
Enumerator
GonioMeter 
StereoField 
Enumerator
backgroundColour 

Colour for the numbers etc.

borderColour 

Colour for the numbers etc.

outlineColour 

Colour for the numbers etc.

gonioColour 

Colour for the numbers etc.

currentValuesColour 

Colour for the numbers etc.

maxValuesColour 

Colour for the numbers etc.

Constructor & Destructor Documentation

foleys::StereoFieldComponent::StereoFieldComponent ( StereoFieldBuffer< float > &  stereo)

Member Function Documentation

void foleys::StereoFieldComponent::paint ( juce::Graphics &  g)
override

References GonioMeter, and StereoField.

Function Documentation

LevelMeter::MeterFlags foleys::operator| ( LevelMeter::MeterFlags  a,
LevelMeter::MeterFlags  b 
)