Sound Meter 0.9.0
Fully resizing logarithmic JUCE meter module.
|
Class responsible for anything relating to the 'meter' and peak 'value' parts. More...
#include <sd_MeterLevel.h>
Public Member Functions | |
Level () | |
Constructor. More... | |
void | reset () |
Reset the meter (but not the peak hold). More... | |
void | setInputLevel (float newLevel) |
Set the level of the meter. More... | |
float | getInputLevel () |
Get's the meter's input level. More... | |
void | refreshMeterLevel () |
Calculate the actual meter level (ballistics included). More... | |
float | getMeterLevel () const noexcept |
Get the actual meter's level (including ballistics). More... | |
void | setMeterOptions (const Options &meterOptions) |
Set the meter's options. More... | |
bool | isPeakValueVisible () const noexcept |
Check if the peak 'value' part is visible. More... | |
void | resetPeakHold () |
Reset the peak hold level. More... | |
float | getPeakHoldLevel () const noexcept |
Get the current peak hold level. More... | |
void | setMinimalMode (bool minimalMode) |
Set the meter in 'minimal' mode. More... | |
void | setRefreshRate (float refreshRate_hz) |
Sets the meter's refresh rate. More... | |
float | getRefreshRate () const noexcept |
Get the meter's refresh (redraw) rate. More... | |
void | setDecay (float decay_ms) |
Set meter decay. More... | |
float | getDecay () const noexcept |
Get meter decay. More... | |
void | setMeterSegments (const std::vector< SegmentOptions > &segmentsOptions) |
Set the segments the meter is made out of. More... | |
void | setIsLabelStrip (bool isLabelStrip=false) noexcept |
Set whether this meter is a label strip. More... | |
void | setMeterBounds (const juce::Rectangle< int > &bounds) |
Set the bounds of the 'meter' part of the meter. More... | |
juce::Rectangle< int > | getValueBounds () const noexcept |
Get the bounds of the 'value' part of the meter. More... | |
juce::Rectangle< int > | getMeterBounds () const noexcept |
Get the bounds of the 'meter' part. More... | |
juce::Rectangle< int > | getLevelBounds () const noexcept |
Get the bounds of the 'level' part. More... | |
juce::Rectangle< int > | getDirtyBounds () |
Get the dirty part of the meter. More... | |
bool | isMouseOverValue (int y) |
Check if the mouse cursor is over the 'value' part of the meter. More... | |
bool | isMouseOverValue () const noexcept |
Check if the mouse cursor is over the 'value' part of the meter. More... | |
void | resetMouseOverValue () noexcept |
Reset 'mouse over' status of the 'value' part of the meter. More... | |
void | drawMeter (juce::Graphics &g, const MeterColours &meterColours) |
Draws the meter. More... | |
void | drawInactiveMeter (juce::Graphics &g, const MeterColours &meterColours) const |
Draw the 'meter' part in it's inactive (muted) state. More... | |
void | drawPeakValue (juce::Graphics &g, const MeterColours &meterColours) const |
Draw the peak 'value'. More... | |
Class responsible for anything relating to the 'meter' and peak 'value' parts.
This also includes the peak hold indicator and the tick-marks.
sd::SoundMeter::Level::Level | ( | ) |
Constructor.
References setMeterSegments().
void sd::SoundMeter::Level::reset | ( | ) |
Reset the meter (but not the peak hold).
References sd::SoundMeter::Constants::kMinLevel_db.
Referenced by sd::SoundMeter::MeterChannel::reset().
void sd::SoundMeter::Level::setInputLevel | ( | float | newLevel | ) |
Set the level of the meter.
Here the level is actually set from the audio engine. Beware: very likely called from the audio thread!
newLevel | The peak level from the audio engine (in amp). |
Referenced by sd::SoundMeter::MeterChannel::setInputLevel().
float sd::SoundMeter::Level::getInputLevel | ( | ) |
Get's the meter's input level.
Referenced by refreshMeterLevel().
void sd::SoundMeter::Level::refreshMeterLevel | ( | ) |
Calculate the actual meter level (ballistics included).
Calculate the meter's level including ballistics. Instant attack, but decayed release.
References getInputLevel(), and getPeakHoldLevel().
Referenced by sd::SoundMeter::MeterChannel::refresh().
|
noexcept |
Get the actual meter's level (including ballistics).
Get the decayed meter level. Instant attack, but decayed release.
void sd::SoundMeter::Level::setMeterOptions | ( | const Options & | meterOptions | ) |
Set the meter's options.
The options determine the appearance and functionality of the meter.
meterOptions | Meter options to use. |
Referenced by sd::SoundMeter::MeterChannel::setOptions().
|
noexcept |
Check if the peak 'value' part is visible.
The peak value will be shown below the meter (in db). It's the same level as the peak hold bar.
void sd::SoundMeter::Level::resetPeakHold | ( | ) |
Reset the peak hold level.
Referenced by sd::SoundMeter::MeterChannel::resetPeakHold().
|
noexcept |
Get the current peak hold level.
References sd::SoundMeter::Constants::kMinLevel_db.
Referenced by drawPeakValue(), and refreshMeterLevel().
void sd::SoundMeter::Level::setMinimalMode | ( | bool | minimalMode | ) |
Set the meter in 'minimal' mode.
In minimal mode, the meter is in it's cleanest state possible. This means no header, no tick-marks, no value, no faders and no indicator.
minimalMode | When set to true, 'minimal' mode will be enabled. |
References setMeterBounds().
Referenced by sd::SoundMeter::MeterChannel::setMinimalMode().
void sd::SoundMeter::Level::setRefreshRate | ( | float | refreshRate_hz | ) |
Sets the meter's refresh rate.
Set this to optimize the meter's decay rate.
refreshRate_hz | Refresh rate in Hz. |
References sd::SoundMeter::Options::refreshRate.
Referenced by sd::SoundMeter::MeterChannel::setRefreshRate().
|
noexcept |
Get the meter's refresh (redraw) rate.
References sd::SoundMeter::Options::refreshRate.
void sd::SoundMeter::Level::setDecay | ( | float | decay_ms | ) |
Set meter decay.
decay_ms | Meter decay in milliseconds. |
References sd::SoundMeter::Options::decayTime_ms.
Referenced by sd::SoundMeter::MeterChannel::setDecay().
|
noexcept |
Get meter decay.
References sd::SoundMeter::Options::decayTime_ms.
Referenced by sd::SoundMeter::MeterChannel::getDecay().
void sd::SoundMeter::Level::setMeterSegments | ( | const std::vector< SegmentOptions > & | segmentsOptions | ) |
Set the segments the meter is made out of.
All segments have a level range, a range within the meter and a colour (or gradient).
segmentsOptions | The segments options to create the segments with. |
Referenced by Level(), and sd::SoundMeter::MeterChannel::setMeterSegments().
|
noexcept |
Set whether this meter is a label strip.
A label strip only draws the value labels (at the tick-marks), but does not display any level.
isLabelStrip | when set, this meter behave like a label strip. |
void sd::SoundMeter::Level::setMeterBounds | ( | const juce::Rectangle< int > & | bounds | ) |
Set the bounds of the 'meter' part of the meter.
bounds | The bounds to use for the 'meter' part of the meter. |
References sd::SoundMeter::Constants::kDefaultHeaderHeight, and sd::SoundMeter::Options::valueEnabled.
Referenced by sd::SoundMeter::MeterChannel::resized(), and setMinimalMode().
|
noexcept |
Get the bounds of the 'value' part of the meter.
|
noexcept |
Get the bounds of the 'meter' part.
Referenced by sd::SoundMeter::MeterChannel::getLabelStripBounds(), and sd::SoundMeter::MeterChannel::refresh().
|
noexcept |
Get the bounds of the 'level' part.
Referenced by sd::SoundMeter::MeterChannel::resized().
juce::Rectangle< int > sd::SoundMeter::Level::getDirtyBounds | ( | ) |
Get the dirty part of the meter.
Referenced by sd::SoundMeter::MeterChannel::refresh().
bool sd::SoundMeter::Level::isMouseOverValue | ( | int | y | ) |
Check if the mouse cursor is over the 'value' part of the meter.
y | The y coordinate (relative to the meter bounds) to use to determine if the mouse if over the 'value' part of the meter. |
|
noexcept |
Check if the mouse cursor is over the 'value' part of the meter.
|
noexcept |
Reset 'mouse over' status of the 'value' part of the meter.
void sd::SoundMeter::Level::drawMeter | ( | juce::Graphics & | g, |
const MeterColours & | meterColours | ||
) |
Draws the meter.
[in,out] | g | The juce graphics context to use. |
meterColours | The colours to use to draw the meter. |
void sd::SoundMeter::Level::drawInactiveMeter | ( | juce::Graphics & | g, |
const MeterColours & | meterColours | ||
) | const |
Draw the 'meter' part in it's inactive (muted) state.
[in,out] | g | The juce graphics context to use. |
meterColours | The colours to use to draw the meter. |
References sd::SoundMeter::MeterColours::textColour.
void sd::SoundMeter::Level::drawPeakValue | ( | juce::Graphics & | g, |
const MeterColours & | meterColours | ||
) | const |
Draw the peak 'value'.
[in,out] | g | The juce graphics context to use. |
meterColours | The colours to use to draw the meter. |
References getPeakHoldLevel(), and sd::SoundMeter::MeterColours::textValueColour.