This is an old version of the documentation. View the latest version here.
Control Surface  1.0.0
MIDI Control Surface library for Arduino
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
MCU::VU_Base< NumValues, Callback > Class Template Reference

A MIDI input element that represents a Mackie Control Universal VU meter. More...

#include <VU.hpp>

Inheritance diagram for MCU::VU_Base< NumValues, Callback >:
Collaboration diagram for MCU::VU_Base< NumValues, Callback >:

Public Member Functions

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

Callback callback
 

Protected Member Functions

 VU_Base (uint8_t track, const MIDICNChannel &channelCN, unsigned int decayTime, const Callback &callback)
 

Protected Attributes

const MIDICNChannelAddress address
 
MIDIInputElementChannelPressurenext
 
MIDIInputElementChannelPressureprevious
 
const uint8_t max
 

Private Member Functions

bool updateImpl (const ChannelMessageMatcher &midimsg, const MIDICNChannelAddress &target) override
 Called when an incoming MIDI message matches this element. More...
 
MIDICNChannelAddress 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 MIDICNChannelAddress &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...
 
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...
 
void moveDown ()
 Move down this element in the linked list of elements. More...
 
virtual bool match (const MIDICNChannelAddress &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 = 0
 

Static Private Attributes

static DoublyLinkedList< MIDIInputElementChannelPressureelements
 

Detailed Description

template<uint8_t NumValues, class Callback>
class MCU::VU_Base< NumValues, Callback >

A MIDI input element that represents a Mackie Control Universal VU meter.


This is a base class to both the Bankable and non-Bankable version.

In the Mackie Control Universal protocol, VU meters are updated using Channel Pressure events.
Each device (cable number) has eight VU meters for the eight tracks. Only MIDI channel 1 is used in the original protocol.

The format of the MIDI message is as follows:
| 1101 cccc | 0hhh llll |

If the level is 0x0, the meter is at 0%, if it's 0xC, the meter is at 100%.
0xD is an invalid value.
0xE sets the overload indicator, and 0xF clears the overload indicator.

Definition at line 78 of file VU.hpp.

Constructor & Destructor Documentation

◆ VU_Base()

template<uint8_t NumValues, class Callback>
MCU::VU_Base< NumValues, Callback >::VU_Base ( uint8_t  track,
const MIDICNChannel channelCN,
unsigned int  decayTime,
const Callback &  callback 
)
inlineprotected

Definition at line 80 of file VU.hpp.

Member Function Documentation

◆ begin()

template<uint8_t NumValues, class Callback>
void MCU::VU_Base< NumValues, Callback >::begin ( )
inlineoverridevirtual

Initialize.

Reimplemented from MIDIInputElement.

Definition at line 87 of file VU.hpp.

◆ reset()

template<uint8_t NumValues, class Callback>
void MCU::VU_Base< NumValues, Callback >::reset ( )
inlineoverridevirtual

Reset all values to zero.

Reimplemented from MIDIInputElement.

Definition at line 89 of file VU.hpp.

◆ getValue() [1/2]

template<uint8_t NumValues, class Callback>
uint8_t MCU::VU_Base< NumValues, Callback >::getValue ( )
inlineoverridevirtual

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

Implements IVU.

Definition at line 95 of file VU.hpp.

◆ getOverload() [1/2]

template<uint8_t NumValues, class Callback>
bool MCU::VU_Base< NumValues, Callback >::getOverload ( )
inlineoverridevirtual

Return the overload status.

Implements IVU.

Definition at line 97 of file VU.hpp.

◆ update()

template<uint8_t NumValues, class Callback>
void MCU::VU_Base< NumValues, Callback >::update ( )
inlineoverridevirtual

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()

template<uint8_t NumValues, class Callback>
bool MCU::VU_Base< NumValues, Callback >::updateImpl ( const ChannelMessageMatcher midimsg,
const MIDICNChannelAddress target 
)
inlineoverrideprivatevirtual

Called when an incoming MIDI message matches this element.

Implements MIDIInputElement.

Definition at line 110 of file VU.hpp.

◆ getTarget()

template<uint8_t NumValues, class Callback>
MIDICNChannelAddress MCU::VU_Base< NumValues, Callback >::getTarget ( const ChannelMessageMatcher midimsg) const
inlineoverrideprivatevirtual

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

Reimplemented from MIDIInputElement.

Definition at line 127 of file VU.hpp.

◆ decay()

template<uint8_t NumValues, class Callback>
void MCU::VU_Base< NumValues, Callback >::decay ( )
inlineprivate

Definition at line 135 of file VU.hpp.

◆ getSelection()

template<uint8_t NumValues, class Callback>
virtual uint8_t MCU::VU_Base< NumValues, Callback >::getSelection ( ) const
inlineprivatevirtual

◆ getBankIndex()

template<uint8_t NumValues, class Callback>
virtual setting_t MCU::VU_Base< NumValues, Callback >::getBankIndex ( const MIDICNChannelAddress target) const
inlineprivatevirtual

◆ setValue()

template<uint8_t NumValues, class Callback>
void MCU::VU_Base< NumValues, Callback >::setValue ( uint8_t  index,
uint8_t  newValue 
)
inlineprivate

Set the VU meter value.

Definition at line 151 of file VU.hpp.

◆ setOverload()

template<uint8_t NumValues, class Callback>
void MCU::VU_Base< NumValues, Callback >::setOverload ( uint8_t  index)
inlineprivate

Set the overload status.

Definition at line 157 of file VU.hpp.

◆ clearOverload()

template<uint8_t NumValues, class Callback>
void MCU::VU_Base< NumValues, Callback >::clearOverload ( uint8_t  index)
inlineprivate

Clear the overload status.

Definition at line 159 of file VU.hpp.

◆ getValue() [2/2]

template<uint8_t NumValues, class Callback>
uint8_t MCU::VU_Base< NumValues, Callback >::getValue ( uint8_t  index) const
inlineprivate

Get the VU meter value from the raw value.

Definition at line 161 of file VU.hpp.

◆ getOverload() [2/2]

template<uint8_t NumValues, class Callback>
bool MCU::VU_Base< NumValues, Callback >::getOverload ( uint8_t  index) const
inlineprivate

Get the overload status value from the raw value.

Definition at line 163 of file VU.hpp.

◆ beginAll()

static void MIDIInputElementChannelPressure::beginAll ( )
inlinestaticinherited

Definition at line 38 of file MIDIInputElementChannelPressure.hpp.

◆ resetAll()

static void MIDIInputElementChannelPressure::resetAll ( )
inlinestaticinherited

Reset all MIDIInputElementChannelPressure elements to their initial state.

See also
MIDIInputElementChannelPressure::reset

Definition at line 50 of file MIDIInputElementChannelPressure.hpp.

◆ updateAll()

static void MIDIInputElementChannelPressure::updateAll ( )
inlinestaticinherited

Update all MIDIInputElementChannelPressure elements.

Definition at line 59 of file MIDIInputElementChannelPressure.hpp.

◆ updateAllWith()

static void MIDIInputElementChannelPressure::updateAllWith ( const ChannelMessageMatcher midimsg)
inlinestaticinherited

Update all MIDIInputElementChannelPressure elements with a new MIDI message.

See also
MIDIInputElementChannelPressure::updateWith

Definition at line 71 of file MIDIInputElementChannelPressure.hpp.

◆ moveDown()

void MIDIInputElementChannelPressure::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 96 of file MIDIInputElementChannelPressure.hpp.

◆ updateWith()

bool MIDIInputElement::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 MIDIInputElement::match ( const MIDICNChannelAddress 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 MCU::Bankable::GenericVU< NumBanks, Callback >, MCU::Bankable::GenericVU< NumBanks >, MCU::Bankable::GenericVU< NumBanks, VULEDsCallback< NumLEDs > >, MCU::Bankable::GenericVPotRing< NumBanks, Callback >, MCU::Bankable::GenericVPotRing< NumBanks >, MCU::Bankable::GenericVPotRing< NumBanks, VPotRingLEDsCallback >, Bankable::GenericNoteCCRange< MIDIInputElementNote, 1, BankSize, NoteCCFastLED< ColorMapper > >, Bankable::GenericNoteCCRange< MIDIInputElementCC, 1, NumBanks >, Bankable::GenericNoteCCRange< MIDIInputElementNote, RangeLen, BankSize, NoteCCFastLED< ColorMapper > >, Bankable::GenericNoteCCRange< MIDIInputElementCC, RangeLen, BankSize, NoteCCFastLED< ColorMapper > >, Bankable::GenericNoteCCRange< MIDIInputElementCC, 1, BankSize, NoteCCLED< 1 > >, Bankable::GenericNoteCCRange< MIDIInputElementNote, RangeLen, BankSize, NoteCCLED< RangeLen > >, Bankable::GenericNoteCCRange< MIDIInputElementNote, RangeLen, NumBanks >, Bankable::GenericNoteCCRange< MIDIInputElementNote, 1, NumBanks >, Bankable::GenericNoteCCRange< MIDIInputElementNote, 1, BankSize, NoteCCLEDBarCallback< NumLEDs > >, Bankable::GenericNoteCCRange< MIDIInputElementNote, 1, BankSize, NoteCCLED< 1 > >, Bankable::GenericNoteCCRange< MIDIInputElementCC, 1, BankSize, NoteCCFastLED< ColorMapper > >, Bankable::GenericNoteCCRange< MIDIInputElementCC, 1, BankSize, NoteCCLEDBarCallback< NumLEDs > >, Bankable::GenericNoteCCRange< MIDIInputElementCC, RangeLen, BankSize, NoteCCLED< RangeLen > >, Bankable::GenericNoteCCRange< MIDIInputElementCC, RangeLen, NumBanks >, GenericNoteCCRange< MIDIInputElementCC, RangeLen, NoteCCFastLED< ColorMapper > >, GenericNoteCCRange< MIDIInputElementCC, 1, NoteCCLED< 1 > >, GenericNoteCCRange< MIDIInputElementNote, RangeLen >, GenericNoteCCRange< MIDIInputElementNote, 1, NoteCCLED< 1 > >, GenericNoteCCRange< MIDIInputElementNote, 1, NoteCCFastLED< ColorMapper > >, GenericNoteCCRange< MIDIInputElementNote, RangeLen, NoteCCLED< RangeLen > >, GenericNoteCCRange< MIDIInputElementNote, RangeLen, NoteCCFastLED< ColorMapper > >, GenericNoteCCRange< MIDIInputElementCC, 1 >, GenericNoteCCRange< MIDIInputElementCC, 1, NoteCCLEDBarCallback< NumLEDs > >, GenericNoteCCRange< MIDIInputElementCC, RangeLen, NoteCCLED< RangeLen > >, GenericNoteCCRange< MIDIInputElementNote, 1, NoteCCLEDBarCallback< NumLEDs > >, GenericNoteCCRange< MIDIInputElementNote, 1 >, GenericNoteCCRange< MIDIInputElementCC, RangeLen >, GenericNoteCCRange< MIDIInputElementCC, 1, NoteCCFastLED< ColorMapper > >, MCU::SevenSegmentDisplay< LENGTH >, MCU::SevenSegmentDisplay< AssignmentDisplayLength >, and MCU::SevenSegmentDisplay< TimeDisplayLength >.

Definition at line 75 of file MIDIInputElement.hpp.

◆ getFloatValue()

virtual float IVU::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 IVU::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

template<uint8_t NumValues, class Callback>
Array<uint8_t, NumValues> MCU::VU_Base< NumValues, Callback >::values = {}
private

Definition at line 166 of file VU.hpp.

◆ decayTime

template<uint8_t NumValues, class Callback>
unsigned int MCU::VU_Base< NumValues, Callback >::decayTime
private

Definition at line 167 of file VU.hpp.

◆ prevDecayTime

template<uint8_t NumValues, class Callback>
unsigned long MCU::VU_Base< NumValues, Callback >::prevDecayTime = 0
private

Definition at line 168 of file VU.hpp.

◆ callback

template<uint8_t NumValues, class Callback>
Callback MCU::VU_Base< NumValues, Callback >::callback

Definition at line 171 of file VU.hpp.

◆ elements

DoublyLinkedList< MIDIInputElementChannelPressure > MIDIInputElementChannelPressure::elements
staticprivateinherited

Definition at line 101 of file MIDIInputElementChannelPressure.hpp.

◆ address

const MIDICNChannelAddress MIDIInputElement::address
protectedinherited

Definition at line 80 of file MIDIInputElement.hpp.

◆ next

Definition at line 301 of file LinkedList.hpp.

◆ previous

Definition at line 302 of file LinkedList.hpp.

◆ max

const uint8_t IVU::max
protectedinherited

Definition at line 33 of file VU.hpp.


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