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

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

#include <Audio/AudioVU.hpp>

Inheritance diagram for AudioVU:
Collaboration diagram for AudioVU:

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

const uint8_t max
 

Private Attributes

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

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.

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, max]

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.
Examples
2.VU-Meter-OLED-USB-DAC.ino.

Definition at line 90 of file AudioVU.hpp.

◆ getMax()

uint8_t getMax ( ) const
inlineinherited

Get the maximum value that this VU meter can return.

Definition at line 30 of file VU.hpp.

Member Data Documentation

◆ ballistics

Definition at line 93 of file AudioVU.hpp.

◆ level

class AudioVU::Analyzer level
private

◆ gain

float gain
private

Definition at line 134 of file AudioVU.hpp.

◆ max

const uint8_t max
protectedinherited

Definition at line 33 of file VU.hpp.


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