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);
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);
145 template <
class Callback = VPotEmptyCallback>
178 template <u
int8_t NumBanks,
class Callback = VPotEmptyCallback>
214 template <u
int8_t NumBanks>
A class for MIDI input elements that represent Mackie Control Universal V-Pots.
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...
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)
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
VPotRing_Base(uint8_t track, const MIDIChannelCN &channelCN, const Callback &callback)
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.
GenericVPotRing(BankConfig< NumBanks > config, uint8_t track, const MIDIChannelCN &channelCN, const Callback &callback)
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.
A class for saving a MIDI channel and cable number.
VPotRing(uint8_t track, const MIDIChannelCN &channelCN=CHANNEL_1)
#define BEGIN_CS_NAMESPACE
static uint8_t getMode(uint8_t value)
Extract the mode from the raw value.
Struct for easily matching MIDI messages.
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.
An array wrapper for easy copying, comparing, and iterating.
VPotEmptyCallback()=default
A class for MIDI input elements that represent Mackie Control Universal V-Pots.
VPotRing(BankConfig< NumBanks > config, uint8_t track, MIDIChannelCN channelCN=CHANNEL_1)
virtual uint8_t getSelection() const
Get the active bank selection.
virtual setting_t getBankIndex(const MIDIAddress &target) const
Get the bank index from a MIDI address.
uint8_t getPosition() const
Return the position of the V-Pot ring. [0, 11].
GenericVPotRing(uint8_t track, const MIDIChannelCN &channelCN, const Callback &callback)
Array< uint8_t, NumValues > values
uint8_t getBankIndex(const MIDIAddress &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.
constexpr Channel CHANNEL_1
uint8_t getStartOn() const
Get the first segment that should be on.
bool updateImpl(const ChannelMessageMatcher &midimsg, const MIDIAddress &target) override
Update the internal state with the new MIDI message.
int8_t minimum(int8_t a, int8_t b)
void reset() override
Reset all values to zero.