Control Surface  1.2.0
MIDI Control Surface library for Arduino
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
VU Class Reference

A class for MIDI input elements that represent Mackie Control Universal VU meters. More...

#include <MIDI_Inputs/MCU/VU.hpp>

+ Inheritance diagram for VU:
+ Collaboration diagram for VU:

Public Member Functions

 VU (uint8_t track, const MIDIChannelCN &channelCN, unsigned int decayTime=VUDecay::Default)
 Construct a new VU object. More...
 
 VU (uint8_t track, unsigned int decayTime=VUDecay::Default)
 Construct a new VU object. More...
 
void begin () override
 Initialize. More...
 
void reset () override
 Reset all values to zero. More...
 
uint8_t getValue () override
 Return the VU meter value as an integer in [0, 12]. More...
 
bool getOverload () override
 Return the overload status. More...
 
void update () override
 Update is called periodically, it decays the meter if the time is right. More...
 
bool updateWith (const ChannelMessageMatcher &midimsg)
 Receive a new MIDI message and update the internal state. More...
 
virtual float getFloatValue ()
 Get the VU meter value as a floating point number. More...
 
uint8_t getMax () const
 Get the maximum value that this VU meter can return. More...
 

Static Public Member Functions

static void beginAll ()
 
static void resetAll ()
 Reset all MIDIInputElementChannelPressure elements to their initial state. More...
 
static void updateAll ()
 Update all MIDIInputElementChannelPressure elements. More...
 
static void updateAllWith (const ChannelMessageMatcher &midimsg)
 Update all MIDIInputElementChannelPressure elements with a new MIDI message. More...
 

Public Attributes

VUEmptyCallback callback
 

Protected Attributes

const MIDIAddress address
 
MIDIInputElementChannelPressurenext
 
MIDIInputElementChannelPressureprevious
 
const uint8_t max
 

Private Member Functions

uint8_t getValue (uint8_t index) const
 Get the VU meter value from the raw value. More...
 
bool getOverload (uint8_t index) const
 Get the overload status value from the raw value. More...
 
bool updateImpl (const ChannelMessageMatcher &midimsg, const MIDIAddress &target) override
 Called when an incoming MIDI message matches this element. More...
 
MIDIAddress getTarget (const ChannelMessageMatcher &midimsg) const override
 The address of the VU meter is the high nibble of the first (and only) data byte. More...
 
void decay ()
 
virtual uint8_t getSelection () const
 Get the active bank selection. More...
 
virtual setting_t getBankIndex (const MIDIAddress &target) const
 Get the bank index from a MIDI address. More...
 
void setValue (uint8_t index, uint8_t newValue)
 Set the VU meter value. More...
 
void setOverload (uint8_t index)
 Set the overload status. More...
 
void clearOverload (uint8_t index)
 Clear the overload status. More...
 
void moveDown ()
 Move down this element in the linked list of elements. More...
 
virtual bool match (const MIDIAddress &target) const
 Check if the address of the incoming MIDI message matches an address of this element. More...
 

Private Attributes

Array< uint8_t, NumValues > values
 
unsigned int decayTime
 
unsigned long prevDecayTime
 

Static Private Attributes

static DoublyLinkedList< MIDIInputElementChannelPressureelements
 

Detailed Description

A class for MIDI input elements that represent Mackie Control Universal VU meters.


This version cannot be banked.

Examples
VU-Meter-Bridge.ino.

Definition at line 221 of file VU.hpp.

Constructor & Destructor Documentation

◆ VU() [1/2]

VU ( uint8_t  track,
const MIDIChannelCN channelCN,
unsigned int  decayTime = VUDecay::Default 
)
inline

Construct a new VU object.

Parameters
trackThe track of the VU meter. [1, 8]
channelCNThe MIDI channel [CHANNEL_1, CHANNEL_16] and optional Cable Number [CABLE_1, CABLE_16].
decayTimeThe time in milliseconds it takes for the value to decay one step.
The MCU protocol uses 300 ms per division, and two steps per division, so the default is 150 ms per step.
Some software doesn't work if the VU meter decays automatically, in that case, you can set the decay time to zero to disable the decay.

Definition at line 240 of file VU.hpp.

◆ VU() [2/2]

VU ( uint8_t  track,
unsigned int  decayTime = VUDecay::Default 
)
inline

Construct a new VU object.

Parameters
trackThe track of the VU meter. [1, 8]
decayTimeThe time in milliseconds it takes for the value to decay one step.
The MCU protocol uses 300 ms per division, and two steps per division, so the default is 150 ms per step.
Some software doesn't work if the VU meter decays automatically, in that case, you can set the decay time to zero to disable the decay.

Definition at line 263 of file VU.hpp.

Member Function Documentation

◆ begin()

void begin ( )
inlineoverridevirtualinherited

Initialize.

Reimplemented from MIDIInputElement.

Definition at line 87 of file VU.hpp.

◆ reset()

void reset ( )
inlineoverridevirtualinherited

Reset all values to zero.

Reimplemented from MIDIInputElement.

Definition at line 89 of file VU.hpp.

◆ getValue() [1/2]

uint8_t getValue ( )
inlineoverridevirtualinherited

Return the VU meter value as an integer in [0, 12].

Implements IVU.

Definition at line 95 of file VU.hpp.

◆ getValue() [2/2]

uint8_t getValue ( uint8_t  index) const
inlineprivateinherited

Get the VU meter value from the raw value.

Definition at line 160 of file VU.hpp.

◆ getOverload() [1/2]

bool getOverload ( )
inlineoverridevirtualinherited

Return the overload status.

Implements IVU.

Definition at line 97 of file VU.hpp.

◆ getOverload() [2/2]

bool getOverload ( uint8_t  index) const
inlineprivateinherited

Get the overload status value from the raw value.

Definition at line 162 of file VU.hpp.

◆ update()

void update ( )
inlineoverridevirtualinherited

Update is called periodically, it decays the meter if the time is right.

Reimplemented from MIDIInputElement.

Definition at line 100 of file VU.hpp.

◆ updateImpl()

bool updateImpl ( const ChannelMessageMatcher midimsg,
const MIDIAddress target 
)
inlineoverrideprivatevirtualinherited

Called when an incoming MIDI message matches this element.

Implements MIDIInputElement.

Definition at line 110 of file VU.hpp.

◆ getTarget()

MIDIAddress getTarget ( const ChannelMessageMatcher midimsg) const
inlineoverrideprivatevirtualinherited

The address of the VU meter is the high nibble of the first (and only) data byte.

Reimplemented from MIDIInputElementChannelPressure.

Definition at line 126 of file VU.hpp.

◆ decay()

void decay ( )
inlineprivateinherited

Definition at line 134 of file VU.hpp.

◆ getSelection()

virtual uint8_t getSelection ( ) const
inlineprivatevirtualinherited

Get the active bank selection.

Definition at line 141 of file VU.hpp.

◆ getBankIndex()

virtual setting_t getBankIndex ( const MIDIAddress target) const
inlineprivatevirtualinherited

Get the bank index from a MIDI address.

Definition at line 144 of file VU.hpp.

◆ setValue()

void setValue ( uint8_t  index,
uint8_t  newValue 
)
inlineprivateinherited

Set the VU meter value.

Definition at line 150 of file VU.hpp.

◆ setOverload()

void setOverload ( uint8_t  index)
inlineprivateinherited

Set the overload status.

Definition at line 156 of file VU.hpp.

◆ clearOverload()

void clearOverload ( uint8_t  index)
inlineprivateinherited

Clear the overload status.

Definition at line 158 of file VU.hpp.

◆ beginAll()

static void beginAll ( )
inlinestaticinherited

Definition at line 44 of file MIDIInputElementChannelPressure.hpp.

◆ resetAll()

static void resetAll ( )
inlinestaticinherited

Reset all MIDIInputElementChannelPressure elements to their initial state.

See also
MIDIInputElementChannelPressure::reset

Definition at line 56 of file MIDIInputElementChannelPressure.hpp.

◆ updateAll()

static void updateAll ( )
inlinestaticinherited

Update all MIDIInputElementChannelPressure elements.

Definition at line 65 of file MIDIInputElementChannelPressure.hpp.

◆ updateAllWith()

static void updateAllWith ( const ChannelMessageMatcher midimsg)
inlinestaticinherited

Update all MIDIInputElementChannelPressure elements with a new MIDI message.

See also
MIDIInputElementChannelPressure::updateWith

Definition at line 77 of file MIDIInputElementChannelPressure.hpp.

◆ moveDown()

void moveDown ( )
inlineprivateinherited

Move down this element in the linked list of elements.

This means that the element will be checked earlier on the next iteration.

Definition at line 105 of file MIDIInputElementChannelPressure.hpp.

◆ updateWith()

bool updateWith ( const ChannelMessageMatcher midimsg)
inlineinherited

Receive a new MIDI message and update the internal state.

Definition at line 39 of file MIDIInputElement.hpp.

◆ match()

virtual bool match ( const MIDIAddress target) const
inlineprivatevirtualinherited

Check if the address of the incoming MIDI message matches an address of this element.

Note
This base version of the function is only valid for non-Bankable MIDI input elements, it only matches if the address is equal to the address of this element.

Reimplemented in GenericNoteCCRange< MIDIInputElementCC, RangeLen, BankSize, NoteCCFastLEDCallback< DefaultColorMapper > >, GenericNoteCCRange< MIDIInputElementNote, 1, BankSize, NoteCCLEDPWM< 1 > >, GenericNoteCCRange< MIDIInputElementNote, 1, BankSize, NoteCCFastLEDCallback< DefaultColorMapper > >, GenericNoteCCRange< MIDIInputElementNote, RangeLen, BankSize, NoteCCFastLEDCallback< DefaultColorMapper > >, GenericNoteCCRange< MIDIInputElementCC, 1, BankSize, NoteCCLED< 1 > >, GenericNoteCCRange< MIDIInputElementCC, 1, BankSize, NoteCCFastLEDCallback< DefaultColorMapper > >, GenericNoteCCRange< MIDIInputElementCC, RangeLen, BankSize, NoteCCLEDPWM< RangeLen > >, GenericNoteCCRange< MIDIInputElementNote, RangeLen, BankSize, NoteCCLED< RangeLen > >, GenericNoteCCRange< MIDIInputElementNote, 1, BankSize, NoteCCLEDBarCallback< NumLEDs > >, GenericNoteCCRange< MIDIInputElementCC, 1, BankSize, NoteCCLEDPWM< 1 > >, GenericNoteCCRange< MIDIInputElementNote, RangeLen, BankSize, NoteCCLEDPWM< RangeLen > >, GenericNoteCCRange< MIDIInputElementNote, 1, BankSize, NoteCCLED< 1 > >, GenericNoteCCRange< MIDIInputElementCC, 1, BankSize, NoteCCLEDBarCallback< NumLEDs > >, GenericNoteCCRange< MIDIInputElementCC, RangeLen, BankSize, NoteCCLED< RangeLen > >, GenericNoteCCRange< MIDIInputElementCC, 1, NoteCCLED< 1 > >, GenericNoteCCRange< MIDIInputElementNote, RangeLen, NoteCCFastLEDCallback< DefaultColorMapper > >, GenericNoteCCRange< MIDIInputElementNote, 1, NoteCCLED< 1 > >, GenericNoteCCRange< MIDIInputElementNote, RangeLen, NoteCCLED< RangeLen > >, GenericNoteCCRange< MIDIInputElementCC, 1, NoteCCFastLEDCallback< DefaultColorMapper > >, GenericNoteCCRange< MIDIInputElementNote, 1, NoteCCLEDPWM< 1 > >, GenericNoteCCRange< MIDIInputElementCC, 1, NoteCCLEDPWM< 1 > >, GenericNoteCCRange< MIDIInputElementCC, RangeLen, NoteCCLED< RangeLen > >, GenericNoteCCRange< MIDIInputElementNote, 1, NoteCCFastLEDCallback< DefaultColorMapper > >, GenericNoteCCRange< MIDIInputElementCC, 1, NoteCCLEDBarCallback< NumLEDs > >, GenericNoteCCRange< MIDIInputElementNote, RangeLen, NoteCCLEDPWM< RangeLen > >, GenericNoteCCRange< MIDIInputElementNote, 1, NoteCCLEDBarCallback< NumLEDs > >, GenericNoteCCRange< MIDIInputElementCC, RangeLen, NoteCCLEDPWM< RangeLen > >, GenericNoteCCRange< MIDIInputElementCC, RangeLen, NoteCCFastLEDCallback< DefaultColorMapper > >, GenericVU< NumBanks, Callback >, GenericVU< NumBanks >, GenericVU< NumBanks, VULEDsCallback< NumLEDs > >, GenericVPotRing< NumBanks, Callback >, GenericVPotRing< NumBanks >, GenericVPotRing< NumBanks, VPotRingLEDsCallback >, SevenSegmentDisplay< LENGTH >, SevenSegmentDisplay< AssignmentDisplayLength >, and SevenSegmentDisplay< TimeDisplayLength >.

Definition at line 78 of file MIDIInputElement.hpp.

◆ getFloatValue()

virtual float getFloatValue ( )
inlinevirtualinherited

Get the VU meter value as a floating point number.

Reimplemented in AudioVU.

Definition at line 28 of file VU.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

◆ values

Array<uint8_t, NumValues> values
privateinherited

Definition at line 165 of file VU.hpp.

◆ decayTime

unsigned int decayTime
privateinherited

Definition at line 166 of file VU.hpp.

◆ prevDecayTime

unsigned long prevDecayTime
privateinherited

Definition at line 167 of file VU.hpp.

◆ callback

VUEmptyCallback callback
inherited

Definition at line 170 of file VU.hpp.

◆ elements

DoublyLinkedList< MIDIInputElementChannelPressure > elements
staticprivateinherited

Definition at line 110 of file MIDIInputElementChannelPressure.hpp.

◆ address

const MIDIAddress address
protectedinherited

Definition at line 83 of file MIDIInputElement.hpp.

◆ next

MIDIInputElementChannelPressure * next
protectedinherited

Definition at line 323 of file LinkedList.hpp.

◆ previous

MIDIInputElementChannelPressure * previous
protectedinherited

Definition at line 324 of file LinkedList.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: