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

#include <MIDI_Inputs/MCU/VU.hpp>

Detailed Description

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

Examples
VU-Meter-Bridge.ino.

Definition at line 188 of file VU.hpp.

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

Data access

uint8_t getValue () override
 Get the most recent VU position that was received. More...
 
bool getOverload () override
 Get the status of the overload indicator. More...
 

Enabling and disabling updatables

void enable ()
 Enable this updatable: insert it into the linked list of instances, so it gets updated automatically. More...
 
void disable ()
 Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically. More...
 
bool isEnabled () const
 Check if this updatable is enabled. More...
 
void moveDown ()
 Move down this element in the list. More...
 
static void enable (UpdatableCRTP *element)
 Enable this updatable: insert it into the linked list of instances, so it gets updated automatically. More...
 
static void enable (UpdatableCRTP &element)
 Enable this updatable: insert it into the linked list of instances, so it gets updated automatically. More...
 
static void enable (U(&array)[N])
 Enable this updatable: insert it into the linked list of instances, so it gets updated automatically. More...
 
static void disable (UpdatableCRTP *element)
 Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically. More...
 
static void disable (UpdatableCRTP &element)
 Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically. More...
 
static void disable (U(&array)[N])
 Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically. More...
 

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...
 

Public Types

using Matcher = VUMatcher
 
using Parent = MatchingMIDIInputElement< MIDIMessageType::CHANNEL_PRESSURE, Matcher >
 
using MessageType = typename MIDIInputElement< Type >::MessageType
 

Public Member Functions

 VU (uint8_t track, MIDIChannelCable channelCN, unsigned int decayTime=VUDecay::Default)
 Constructor. More...
 
 VU (uint8_t track, unsigned int decayTime=VUDecay::Default)
 Constructor. More...
 
void reset () override
 Reset all values to zero. More...
 
void update () override
 Decay the VU meter. More...
 
bool updateWith (MessageType midimsg) override
 Receive a new MIDI message and update the internal state. More...
 
virtual void handleUpdate (typename Matcher::Result match)=0
 
virtual void begin ()
 Initialize the input element. 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 bool updateAllWith (MessageType midimsg)
 Update all. More...
 
static void updateAll ()
 Update all. More...
 
static void beginAll ()
 Begin all. More...
 
static void resetAll ()
 Reset all. More...
 

Protected Member Functions

bool handleUpdateImpl (typename Matcher::Result match)
 
void handleUpdate (typename Matcher::Result match) override
 
bool decay ()
 

Protected Attributes

VUMatcher matcher
 
MIDIInputElement< Type > * next
 
MIDIInputElement< Type > * previous
 
uint8_t max
 
bool alwaysDirty
 
bool dirty = true
 

Static Protected Attributes

static DoublyLinkedList< MIDIInputElement< Type > > updatables
 

Private Attributes

VUState state = {}
 
AH::Timer< millis > decayTimer
 

Member Typedef Documentation

◆ Matcher

using Matcher = VUMatcher

Definition at line 192 of file VU.hpp.

◆ Parent

Definition at line 193 of file VU.hpp.

◆ MessageType

using MessageType = typename MIDIInputElement<Type>::MessageType
inherited

Definition at line 93 of file MIDIInputElement.hpp.

Constructor & Destructor Documentation

◆ VU() [1/2]

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

Constructor.

Parameters
trackThe track of the VU meter. [1, 8]
channelCNThe MIDI channel [CHANNEL_1, CHANNEL_16] and 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.
See also
MCU::VUDecay

Definition at line 213 of file VU.hpp.

◆ VU() [2/2]

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

Constructor.

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.
See also
MCU::VUDecay

Definition at line 233 of file VU.hpp.

Member Function Documentation

◆ handleUpdateImpl()

bool handleUpdateImpl ( typename Matcher::Result  match)
inlineprotected

Definition at line 237 of file VU.hpp.

◆ handleUpdate() [1/2]

void handleUpdate ( typename Matcher::Result  match)
inlineoverrideprotected

Definition at line 245 of file VU.hpp.

◆ decay()

bool decay ( )
inlineprotected

Definition at line 249 of file VU.hpp.

◆ reset()

void reset ( )
inlineoverridevirtual

Reset all values to zero.

Reimplemented from MIDIInputElement< Type >.

Definition at line 257 of file VU.hpp.

◆ update()

void update ( )
inlineoverridevirtual

Decay the VU meter.

Reimplemented from MIDIInputElement< Type >.

Definition at line 260 of file VU.hpp.

◆ getValue()

uint8_t getValue ( )
inlineoverridevirtual

Get the most recent VU position that was received.

Implements IVU.

Definition at line 269 of file VU.hpp.

◆ getOverload()

bool getOverload ( )
inlineoverridevirtual

Get the status of the overload indicator.

Implements IVU.

Definition at line 271 of file VU.hpp.

◆ updateWith()

bool updateWith ( MessageType  midimsg)
inlineoverridevirtualinherited

Receive a new MIDI message and update the internal state.

Implements MIDIInputElement< Type >.

Definition at line 95 of file MIDIInputElement.hpp.

◆ handleUpdate() [2/2]

virtual void handleUpdate ( typename Matcher::Result  match)
pure virtualinherited

Implemented in VULEDs< NumLEDs >.

◆ begin()

virtual void begin ( )
inlinevirtualinherited

◆ updateAllWith()

static bool updateAllWith ( MessageType  midimsg)
inlinestaticinherited

Update all.

Definition at line 46 of file MIDIInputElement.hpp.

◆ updateAll()

static void updateAll ( )
inlinestaticinherited

Update all.

Definition at line 57 of file MIDIInputElement.hpp.

◆ beginAll()

static void beginAll ( )
inlinestaticinherited

Begin all.

Definition at line 62 of file MIDIInputElement.hpp.

◆ resetAll()

static void resetAll ( )
inlinestaticinherited

Reset all.

Definition at line 67 of file MIDIInputElement.hpp.

◆ enable() [1/4]

void enable ( )
inlineinherited

Enable this updatable: insert it into the linked list of instances, so it gets updated automatically.

Definition at line 100 of file Updatable.hpp.

◆ enable() [2/4]

static void enable ( UpdatableCRTP< MIDIInputElement< Type > > *  element)
inlinestaticinherited

Enable this updatable: insert it into the linked list of instances, so it gets updated automatically.

Definition at line 129 of file Updatable.hpp.

◆ enable() [3/4]

static void enable ( UpdatableCRTP< MIDIInputElement< Type > > &  element)
inlinestaticinherited

Enable this updatable: insert it into the linked list of instances, so it gets updated automatically.

Definition at line 131 of file Updatable.hpp.

◆ enable() [4/4]

static void enable ( U(&)  array[N])
inlinestaticinherited

Enable this updatable: insert it into the linked list of instances, so it gets updated automatically.

Definition at line 134 of file Updatable.hpp.

◆ disable() [1/4]

void disable ( )
inlineinherited

Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically.

Definition at line 110 of file Updatable.hpp.

◆ disable() [2/4]

static void disable ( UpdatableCRTP< MIDIInputElement< Type > > *  element)
inlinestaticinherited

Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically.

Definition at line 140 of file Updatable.hpp.

◆ disable() [3/4]

static void disable ( UpdatableCRTP< MIDIInputElement< Type > > &  element)
inlinestaticinherited

Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically.

Definition at line 142 of file Updatable.hpp.

◆ disable() [4/4]

static void disable ( U(&)  array[N])
inlinestaticinherited

Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically.

Definition at line 145 of file Updatable.hpp.

◆ isEnabled()

bool isEnabled ( ) const
inlineinherited

Check if this updatable is enabled.

Note
Assumes that the updatable is not added to a different linked list by the user.

Definition at line 124 of file Updatable.hpp.

◆ moveDown()

void moveDown ( )
inlineinherited

Move down this element in the list.

Definition at line 151 of file Updatable.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.

◆ getFloatValue()

virtual float getFloatValue ( )
inlinevirtualinherited

Get the VU meter value as a floating point number.

Reimplemented in AudioVU, and VU< BankSize >.

Definition at line 108 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

◆ state

VUState state = {}
private

Definition at line 276 of file VU.hpp.

◆ decayTimer

AH::Timer<millis> decayTimer
private

Definition at line 277 of file VU.hpp.

◆ matcher

VUMatcher matcher
protectedinherited

Definition at line 105 of file MIDIInputElement.hpp.

◆ updatables

DoublyLinkedList< MIDIInputElement< Type > > updatables
staticprotectedinherited

Definition at line 156 of file Updatable.hpp.

◆ next

MIDIInputElement< Type > * next
protectedinherited

Definition at line 324 of file LinkedList.hpp.

◆ previous

MIDIInputElement< Type > * previous
protectedinherited

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