To get a meter GUI create a LevelMeterSource in your AudioProcessor or whatever instance processes an AudioBuffer. More...
#include <LevelMeterSource.h>
Public Member Functions | |
| LevelMeterSource () | |
| ~LevelMeterSource () | |
| void | resize (const int channels, const int rmsWindow) |
| Resize the meters data containers. | |
| 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. | |
| void | decayIfNeeded () |
| This is called from the GUI. | |
| 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. | |
| void | setReductionLevel (const float reduction) |
| With the reduction level you can add an extra bar do indicate, by what amount the level was reduced. | |
| void | setMaxHoldMS (const juce::int64 millis) |
| Set the timeout, how long the peak line will be displayed, before it resets to the current peak. | |
| float | getReductionLevel (const int channel) const |
| Returns the reduction level. | |
| float | getMaxLevel (const int channel) const |
| This is the max level as displayed by the little line above the RMS bar. | |
| float | getMaxOverallLevel (const int channel) const |
| This is the max level as displayed under the bar as number. | |
| float | getRMSLevel (const int channel) const |
| This is the RMS level that the bar will indicate. | |
| bool | getClipFlag (const int channel) const |
| Returns the status of the clip flag. | |
| void | clearClipFlag (const int channel) |
| Reset the clip flag to reset the indicator in the meter. | |
| void | clearAllClipFlags () |
| void | clearMaxNum (const int channel) |
| Reset the max number to minus infinity. | |
| void | clearAllMaxNums () |
| Reset all max numbers. | |
| int | getNumChannels () const |
| Get the number of channels to be displayed. | |
| void | setSuspended (const bool shouldBeSuspended) |
| The measure can be suspended, e.g. | |
| bool | checkNewDataFlag () const |
| void | resetNewDataFlag () |
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.
| LevelMeterSource | ( | ) |
| ~LevelMeterSource | ( | ) |
| void resize | ( | const int | channels, |
| const int | rmsWindow | ||
| ) |
Resize the meters data containers.
Set the
| numChannels | to 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. |
| rmsWindow | is 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; |
| void measureBlock | ( | const juce::AudioBuffer< FloatType > & | buffer | ) |
Call this method to measure a block af levels to be displayed in the meters.
| void 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 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.
| channel | the channel index, that was reduced |
| reduction | the factor for the reduction applied to the channel, 1.0=no reduction, 0.0=block completely |
| void 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.
| reduction | the factor for the reduction applied to all channels, 1.0=no reduction, 0.0=muted completely |
| void setMaxHoldMS | ( | const juce::int64 | millis | ) |
Set the timeout, how long the peak line will be displayed, before it resets to the current peak.
| float getReductionLevel | ( | const int | channel | ) | const |
Returns the reduction level.
This value is not computed but can be set manually via
Referenced by drawMeterBars(), and drawMeterChannel().
| float getMaxLevel | ( | const int | channel | ) | const |
This is the max level as displayed by the little line above the RMS bar.
It is reset by
Referenced by drawMeterBars(), and drawMeterChannel().
| float getMaxOverallLevel | ( | const int | channel | ) | const |
This is the max level as displayed under the bar as number.
It will stay up until
Referenced by drawMeterBars(), and drawMeterChannel().
| float 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 getClipFlag | ( | const int | channel | ) | const |
Returns the status of the clip flag.
Referenced by drawMeterBars(), and drawMeterChannel().
| void clearClipFlag | ( | const int | channel | ) |
Reset the clip flag to reset the indicator in the meter.
| void clearAllClipFlags | ( | ) |
| void clearMaxNum | ( | const int | channel | ) |
Reset the max number to minus infinity.
| void clearAllMaxNums | ( | ) |
Reset all max numbers.
| int getNumChannels | ( | ) | const |
Get the number of channels to be displayed.
Referenced by drawMeterBars(), hitTestClipIndicator(), and hitTestMaxNumber().
| void setSuspended | ( | const bool | shouldBeSuspended | ) |
The measure can be suspended, e.g.
to save CPU when no meter is displayed. In this case, the
| bool checkNewDataFlag | ( | ) | const |
| void resetNewDataFlag | ( | ) |