A class for MIDI input elements that represent Mackie Control Universal V-Pots. More...
#include <MIDI_Inputs/MCU/VPotRing.hpp>
Public Member Functions | |
GenericVPotRing (BankConfig< NumBanks > config, uint8_t track, const MIDIChannelCN &channelCN, const Callback &callback) | |
void | begin () override |
Initialize. More... | |
void | reset () override |
Reset all values to zero. More... | |
virtual void | update () |
Update the value of the input element. Used for decaying VU meters etc. More... | |
bool | updateWith (const ChannelMessageMatcher &midimsg) |
Receive a new MIDI message and update the internal state. More... | |
uint8_t | getPosition () const |
Return the position of the V-Pot ring. [0, 11]. More... | |
bool | getCenterLed () const |
Return the status of the center LED of the V-Pot ring. More... | |
uint8_t | getMode () const |
Return the mode of the V-Pot ring: 0 = single dot, 1 = boost/cut, 2 = wrap, 3 = spread. More... | |
uint8_t | getStartOn () const |
Get the first segment that should be on. More... | |
uint8_t | getStartOff () const |
Get the first segment that should be off. More... | |
setting_t | getSelection () const |
Get the current bank setting. More... | |
uint8_t | getBankIndex (const MIDIAddress &target, const MIDIAddress &base) const |
Calculate the bank setting of a given MIDI address, relative to a base address. More... | |
Static Public Member Functions | |
static void | beginAll () |
Initialize all MIDIInputElementCC elements. More... | |
static void | updateAll () |
Update all MIDIInputElementCC elements. More... | |
static void | resetAll () |
Reset all MIDIInputElementCC elements to their initial state. More... | |
static void | updateAllWith (const ChannelMessageMatcher &midimsg) |
Update all MIDIInputElementCC elements with a new MIDI message. More... | |
Public Attributes | |
VPotEmptyCallback | callback |
Protected Member Functions | |
bool | matchBankable (uint8_t toMatch, uint8_t base) const |
Check if the given address is part of the bank relative to the base address. More... | |
bool | matchBankable (const MIDIAddress &toMatch, const MIDIAddress &base) const |
Check whether a given address is part of the bank relative to the base address. More... | |
bool | matchBankableInRange (uint8_t toMatch, uint8_t base, uint8_t length) const |
Check if the given address is part of the bank relative to the base address. More... | |
uint8_t | getRangeIndex (MIDIAddress target, MIDIAddress base) const |
If matchBankableAddressInRange returned true, get the index of the message in the range. More... | |
bool | matchBankableAddressInRange (const MIDIAddress &toMatch, const MIDIAddress &base, uint8_t length) const |
Check whether a given address is part of the bank relative to the base address and within a range with a given length. More... | |
Static Protected Member Functions | |
static uint8_t | sanitizeValue (uint8_t value) |
Make sure that the received value is valid and will not result in array out of bounds conditions. More... | |
static bool | inRange (uint8_t toMatch, uint8_t base, uint8_t length) |
Check whether a given address is within a range of given length starting from the given base address. More... | |
Protected Attributes | |
const MIDIAddress | address |
MIDIInputElementCC * | next |
MIDIInputElementCC * | previous |
Private Member Functions | |
setting_t | getSelection () const override |
uint8_t | getBankIndex (const MIDIAddress &target) const override |
Get the bank index from a MIDI address. More... | |
bool | match (const MIDIAddress &target) const override |
Check if the address of the incoming MIDI message is in one of the banks of this element. More... | |
void | onBankSettingChange () override |
A function to be executed each time the bank setting changes. More... | |
bool | updateImpl (const ChannelMessageMatcher &midimsg, const MIDIAddress &target) override |
Update the internal state with the new MIDI message. More... | |
uint8_t | getValue () const override |
void | moveDown () |
Move down this element in the linked list of elements. More... | |
virtual MIDIAddress | getTarget (const ChannelMessageMatcher &midimsg) const |
Extract the target address from a MIDI message. More... | |
Static Private Member Functions | |
static uint8_t | getPosition (uint8_t value) |
Extract the position from the raw value. More... | |
static bool | getCenterLed (uint8_t value) |
Extract the center LED state from the raw value. More... | |
static uint8_t | getMode (uint8_t value) |
Extract the mode from the raw value. More... | |
Private Attributes | |
Array< uint8_t, NumValues > | values |
Bank< N > & | bank |
const BankType | type |
Static Private Attributes | |
static DoublyLinkedList< MIDIInputElementCC > | elements |
A class for MIDI input elements that represent Mackie Control Universal V-Pots.
This version is generic to allow for custom callbacks.
This version can be banked.
NumBanks | The number of banks. |
Definition at line 179 of file VPotRing.hpp.
|
inline |
Definition at line 182 of file VPotRing.hpp.
|
inlineoverrideprivate |
Definition at line 188 of file VPotRing.hpp.
|
inlineoverrideprivatevirtual |
Get the bank index from a MIDI address.
Reimplemented from VPotRing_Base< NumBanks, VPotEmptyCallback >.
Definition at line 192 of file VPotRing.hpp.
|
inlineoverrideprivatevirtual |
Check if the address of the incoming MIDI message is in one of the banks of this element.
Reimplemented from MIDIInputElement.
Definition at line 198 of file VPotRing.hpp.
|
inlineoverrideprivatevirtual |
A function to be executed each time the bank setting changes.
Think of an LED that indicates whether a track is muted or not. If this LED is bankable, let's say with 4 tracks per bank, 2 banks, and a base address of 3, then this LED object keeps the state of tracks 3 and 7. When the bank setting is 0, the LED displays the state of track 3, when the bank setting is 1, the LED displays the state of track 7.
To know when to update the LED, this callback is used.
Reimplemented from BankableMIDIInput< NumBanks >.
Definition at line 203 of file VPotRing.hpp.
|
inlineoverridevirtualinherited |
|
inlineoverridevirtualinherited |
Reset all values to zero.
Reimplemented from MIDIInputElement.
Definition at line 95 of file VPotRing.hpp.
|
inlinestaticprotectedinherited |
Make sure that the received value is valid and will not result in array out of bounds conditions.
Definition at line 105 of file VPotRing.hpp.
|
inlineoverrideprivatevirtualinherited |
Update the internal state with the new MIDI message.
Implements MIDIInputElement.
Definition at line 110 of file VPotRing.hpp.
|
inlineoverrideprivateinherited |
Definition at line 120 of file VPotRing.hpp.
|
inlinestaticinherited |
Initialize all MIDIInputElementCC elements.
Definition at line 52 of file MIDIInputElementCC.hpp.
|
inlinestaticinherited |
Update all MIDIInputElementCC elements.
Definition at line 60 of file MIDIInputElementCC.hpp.
|
inlinestaticinherited |
Reset all MIDIInputElementCC elements to their initial state.
Definition at line 68 of file MIDIInputElementCC.hpp.
|
inlinestaticinherited |
Update all MIDIInputElementCC elements with a new MIDI message.
Definition at line 76 of file MIDIInputElementCC.hpp.
|
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 94 of file MIDIInputElementCC.hpp.
|
inlinevirtualinherited |
Update the value of the input element. Used for decaying VU meters etc.
Reimplemented in VU_Base< NumValues, Callback >, VU_Base< NumBanks, VULEDsCallback< NumLEDs > >, VU_Base< NumBanks, VUEmptyCallback >, VU_Base< 1, VUEmptyCallback >, and VU_Base< 1, VULEDsCallback< NumLEDs > >.
Definition at line 36 of file MIDIInputElement.hpp.
|
inlineinherited |
Receive a new MIDI message and update the internal state.
Definition at line 39 of file MIDIInputElement.hpp.
|
inlineprivatevirtualinherited |
Extract the target address from a MIDI message.
Reimplemented in MIDIInputElementPC, MIDIInputElementChannelPressure, VU_Base< NumValues, Callback >, VU_Base< NumBanks, VULEDsCallback< NumLEDs > >, VU_Base< NumBanks, VUEmptyCallback >, VU_Base< 1, VUEmptyCallback >, and VU_Base< 1, VULEDsCallback< NumLEDs > >.
Definition at line 63 of file MIDIInputElement.hpp.
|
inlineinherited |
Return the position of the V-Pot ring. [0, 11].
Definition at line 32 of file VPotRing.hpp.
|
inlinestaticprivateinherited |
Extract the position from the raw value.
Definition at line 72 of file VPotRing.hpp.
|
inlineinherited |
Return the status of the center LED of the V-Pot ring.
Definition at line 34 of file VPotRing.hpp.
|
inlinestaticprivateinherited |
Extract the center LED state from the raw value.
Definition at line 77 of file VPotRing.hpp.
|
inlineinherited |
Return the mode of the V-Pot ring: 0 = single dot, 1 = boost/cut, 2 = wrap, 3 = spread.
Definition at line 37 of file VPotRing.hpp.
|
inlinestaticprivateinherited |
Extract the mode from the raw value.
Definition at line 79 of file VPotRing.hpp.
|
inlineinherited |
Get the first segment that should be on.
Definition at line 40 of file VPotRing.hpp.
|
inlineinherited |
Get the first segment that should be off.
Definition at line 56 of file VPotRing.hpp.
|
inlineinherited |
Get the current bank setting.
Definition at line 59 of file BankableMIDIInput.hpp.
|
inlineinherited |
Calculate the bank setting of a given MIDI address, relative to a base address.
target | The MIDI address to calculate the bank setting of. |
base | The base address to compare it to (the address of bank setting 0). |
Definition at line 71 of file BankableMIDIInput.hpp.
|
inlineprotectedinherited |
Check if the given address is part of the bank relative to the base address.
Consider the following example:
A Bank with 4 tracks per bank (T), 2 bank settings (N), and a base address of 3.
Addresses before the base adddress are not matched (0, 1, 2).
Addresses after N * T are not matched (8, 9, 10, 11, 12).
Addresses with a distance to the base address that is not a multiple of N are not matched (4, 5, 6).
toMatch | The address to check. |
base | The base address (the address of bank setting 0). |
matchBankableInRange(toMatch, base, 1)
. Definition at line 113 of file BankableMIDIInput.hpp.
|
inlineprotectedinherited |
Check whether a given address is part of the bank relative to the base address.
toMatch | The address to check. |
base | The base address (the address of bank setting 0). |
Definition at line 174 of file BankableMIDIInput.hpp.
|
inlineprotectedinherited |
Check if the given address is part of the bank relative to the base address.
toMatch | The address to check. |
base | The base address (the address of bank setting 0). |
length | The length of the range. |
Definition at line 132 of file BankableMIDIInput.hpp.
|
inlineprotectedinherited |
If matchBankableAddressInRange returned true, get the index of the message in the range.
Definition at line 143 of file BankableMIDIInput.hpp.
|
inlinestaticprotectedinherited |
Check whether a given address is within a range of given length starting from the given base address.
toMatch | The address to check |
base | The base address, start of the range. |
length | The length of the range. |
Definition at line 161 of file BankableMIDIInput.hpp.
|
inlineprotectedinherited |
Check whether a given address is part of the bank relative to the base address and within a range with a given length.
toMatch | The address to check. |
base | The base address (the address of bank setting 0). |
length | The length of the range. |
Definition at line 211 of file BankableMIDIInput.hpp.
|
privateinherited |
Definition at line 131 of file VPotRing.hpp.
|
inherited |
Definition at line 134 of file VPotRing.hpp.
|
staticprivateinherited |
Definition at line 99 of file MIDIInputElementCC.hpp.
|
protectedinherited |
Definition at line 83 of file MIDIInputElement.hpp.
|
protectedinherited |
Definition at line 323 of file LinkedList.hpp.
|
protectedinherited |
Definition at line 324 of file LinkedList.hpp.
|
privateinherited |
Definition at line 242 of file BankableMIDIInput.hpp.
|
privateinherited |
Definition at line 243 of file BankableMIDIInput.hpp.