Control Surface main
MIDI Control Surface library for Arduino
Classes | Public Member Functions | Protected Attributes | Private Attributes | List of all members
AudioVU Class Reference

#include <Audio/AudioVU.hpp>

Detailed Description

A VU meter that reads from an Audio stream using the Analyzer class.

Examples
2.VU-Meter-OLED-USB-DAC.ino.

Definition at line 16 of file AudioVU.hpp.

+ Inheritance diagram for AudioVU:
+ Collaboration diagram for AudioVU:

Detecting changes

bool getDirty () const
 Check if the value was updated since the last time the dirty flag was cleared. More...
 
void clearDirty ()
 Clear the dirty flag. More...
 

Classes

class  Analyzer
 The AudioAnalyzePeak and AudioAnalyzeRMS classes don't implement a common interface, so we have to use our own RTTI wrapper to allow both classes to be used. More...
 

Public Member Functions

template<class T >
 AudioVU (T &level, float gain=1.0, uint8_t max=255)
 Create a new AudioVU object. More...
 
template<class T >
 AudioVU (T &level, MovingCoilBallistics ballistics, float gain=1.0, uint8_t max=255)
 Create a new AudioVU object. More...
 
uint8_t getValue () override
 Get the value of the VU meter. More...
 
float getFloatValue () override
 Get the value of the VU meter. More...
 
bool getOverload () override
 
void setGain (float gain)
 Set the gain for the VU meter. More...
 
uint8_t getMax () const
 Get the maximum value that this VU meter can return. More...
 

Protected Attributes

uint8_t max
 
bool alwaysDirty
 
bool dirty = true
 

Private Attributes

MovingCoilBallistics ballistics = MovingCoilBallistics::responsiveVU()
 
class AudioVU::Analyzer level
 
float gain
 

Constructor & Destructor Documentation

◆ AudioVU() [1/2]

AudioVU ( T &  level,
float  gain = 1.0,
uint8_t  max = 255 
)
inline

Create a new AudioVU object.

Parameters
levelThe Teensy Audio peak or RMS analyzer object.
Note that it is kept by reference, so it must outlive the AudioVU instance.
gainA multiplier to calibrate the VU meter.
maxThe max output, or the length of the output scale: getValue will output a number in [0, max].

Definition at line 32 of file AudioVU.hpp.

◆ AudioVU() [2/2]

AudioVU ( T &  level,
MovingCoilBallistics  ballistics,
float  gain = 1.0,
uint8_t  max = 255 
)
inline

Create a new AudioVU object.

Parameters
levelThe Teensy Audio peak or RMS analyzer object.
Note that it is kept by reference, so it must outlive the AudioVU instance.
ballisticsThe dynamic model to use for the VU meter.
gainA multiplier to calibrate the VU meter.
maxThe max output, or the length of the output scale: getValue will output a number in [0, max].

Definition at line 51 of file AudioVU.hpp.

Member Function Documentation

◆ getValue()

uint8_t getValue ( )
inlineoverridevirtual

Get the value of the VU meter.

Returns
A value in [0, getMax()]

Implements IVU.

Definition at line 60 of file AudioVU.hpp.

◆ getFloatValue()

float getFloatValue ( )
inlineoverridevirtual

Get the value of the VU meter.

Returns
A value in [0.0, 1.0]

Reimplemented from IVU.

Definition at line 70 of file AudioVU.hpp.

◆ getOverload()

bool getOverload ( )
inlineoverridevirtual
Note
This function will always return false for an AudioVU.

Implements IVU.

Definition at line 83 of file AudioVU.hpp.

◆ setGain()

void setGain ( float  gain)
inline

Set the gain for the VU meter.

Parameters
gainThe new gain.

Definition at line 91 of file AudioVU.hpp.

◆ getDirty()

bool getDirty ( ) const
inlineinherited

Check if the value was updated since the last time the dirty flag was cleared.

Definition at line 97 of file InterfaceMIDIInputElements.hpp.

◆ clearDirty()

void clearDirty ( )
inlineinherited

Clear the dirty flag.

Definition at line 99 of file InterfaceMIDIInputElements.hpp.

◆ getMax()

uint8_t getMax ( ) const
inlineinherited

Get the maximum value that this VU meter can return.

Definition at line 110 of file InterfaceMIDIInputElements.hpp.

Member Data Documentation

◆ ballistics

Definition at line 94 of file AudioVU.hpp.

◆ level

class AudioVU::Analyzer level
private

◆ gain

float gain
private

Definition at line 135 of file AudioVU.hpp.

◆ max

uint8_t max
protectedinherited

Definition at line 113 of file InterfaceMIDIInputElements.hpp.

◆ alwaysDirty

bool alwaysDirty
protectedinherited

Definition at line 114 of file InterfaceMIDIInputElements.hpp.

◆ dirty

bool dirty = true
protectedinherited

Definition at line 115 of file InterfaceMIDIInputElements.hpp.


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