MIDI Control Surface library for Arduino
|
Go to the documentation of this file.
12 inline int8_t
minimum(int8_t a, int8_t b) {
return a > b ? b : a; }
13 inline int8_t
maximum(int8_t a, int8_t b) {
return a < b ? b : a; }
44 int8_t value = position - 1;
47 case 1:
return minimum(value, 5);
49 case 3:
return maximum(5 - value, 0);
60 case 1:
return maximum(value, 6);
62 case 3:
return minimum(5 + value, 11);
69 virtual uint8_t
getValue()
const = 0;
73 uint8_t position = value & 0x0F;
74 return position < 0x0C ? position : 0x0B;
79 static uint8_t
getMode(uint8_t value) {
return (value & 0x30) >> 4; }
82 template <u
int8_t NumValues,
class Callback>
106 return (value & 0x0F) < 0x0C ? value : ((value & 0xF0) | 0xB);
143 template <
class Callback = VPotEmptyCallback>
176 template <u
int8_t NumBanks,
class Callback = VPotEmptyCallback>
212 template <u
int8_t NumBanks>
A class for MIDI input elements that represent Mackie Control Universal V-Pots.
constexpr static uint8_t VPotRingAddress
static bool getCenterLed(uint8_t value)
Extract the center LED state from the raw value.
int8_t maximum(int8_t a, int8_t b)
GenericVPotRing(uint8_t track, const MIDICNChannel &channelCN, const Callback &callback)
void onBankSettingChange() override
A function to be executed each time the bank setting changes.
A class for MIDI input elements that represent Mackie Control Universal V-Pots.
A namespace for MIDI elements that can be added to a Bank, to change their address or channel.
uint8_t getMode() const
Return the mode of the V-Pot ring: 0 = single dot, 1 = boost/cut, 2 = wrap, 3 = spread.
void begin() override
Initialize.
setting_t getSelection() const override
Get the active bank selection.
Names and note and controller numbers for the Mackie Control Universal (MCU) protocol.
uint8_t getStartOff() const
Get the first segment that should be off.
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.
#define BEGIN_CS_NAMESPACE
static uint8_t getMode(uint8_t value)
Extract the mode from the raw value.
Struct for easily matching MIDI messages.
VPotRing(uint8_t track, const MIDICNChannel &channelCN=CHANNEL_1)
bool getCenterLed() const
Return the status of the center LED of the V-Pot ring.
uint8_t getValue() const override
A class for MIDI input elements that represent Mackie Control Universal V-Pots.
GenericVPotRing(const BankConfig< NumBanks > &config, uint8_t track, const MIDICNChannel &channelCN, const Callback &callback)
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...
An array wrapper for easy copying, comparing, and iterating.
bool updateImpl(const ChannelMessageMatcher &midimsg, const MIDICNChannelAddress &target) override
Update the internal state with the new MIDI message.
VPotEmptyCallback()=default
A class for MIDI input elements that represent Mackie Control Universal V-Pots.
virtual uint8_t getSelection() const
Get the active bank selection.
VPotRing(BankConfig< NumBanks > config, uint8_t track, MIDICNChannel channelCN=CHANNEL_1)
A class for saving a MIDI channel and cable number.
uint8_t getPosition() const
Return the position of the V-Pot ring. [0, 11].
Array< uint8_t, NumValues > values
uint8_t getBankIndex(const MIDICNChannelAddress &target) const override
Get the bank index from a MIDI address.
uint8_t setting_t
The type used for Selectors.
virtual uint8_t getValue() const =0
static uint8_t getPosition(uint8_t value)
Extract the position from the raw value.
virtual setting_t getBankIndex(const MIDICNChannelAddress &target) const
Get the bank index from a MIDI address.
A struct for selecting the bank of BankableMIDIInputs and the bank type.
VPotRing_Base(uint8_t track, const MIDICNChannel &channelCN, const Callback &callback)
constexpr Channel CHANNEL_1
uint8_t getStartOn() const
Get the first segment that should be on.
int8_t minimum(int8_t a, int8_t b)
void reset() override
Reset all values to zero.
bool match(const MIDICNChannelAddress &target) const override
Check if the address of the incoming MIDI message is in one of the banks of this element.