3#include <AH/STL/utility>
24template <
class Enc, u
int8_t NumBanks,
class BankAddress,
class Sender>
28 int16_t speedMultiply, uint8_t pulsesPerStep,
40 int16_t newValue = oldValue + delta;
41 newValue = constrain(newValue, 0,
maxValue);
42 if (oldValue != newValue) {
96 constexpr static int16_t
maxValue = uint16_t(1u << Sender::precision()) - 1;
102template <u
int8_t NumBanks,
class BankAddress,
class Sender>
106template <u
int8_t NumBanks,
class BankAddress,
class Sender>
uint8_t setting_t
The type used for Selectors.
#define BEGIN_CS_NAMESPACE
std::enable_if< has_method_begin< T >::value >::type begin_if_possible(T &t)
Calls the begin() method of t if that method exists.
A super class for object that have to be updated regularly.
An abstract class for rotary encoders that send absolute MIDI events.
int16_t resetPositionOffset()
static int16_t getMaxValue()
Get the maximum possible value that can be returned by getValue.
int16_t getSpeedMultiply() const
void forcedUpdate()
Send the current value over MIDI, even if the position of the encoder didn't change.
uint16_t getValue() const
Get the absolute value of the encoder in the active bank.
void setValue(uint16_t value, setting_t bank)
Set the absolute value of the encoder in the given bank.
void setSpeedMultiply(int16_t speedMultiply)
void update() override
Update this updatable.
void setValue(uint16_t value)
Set the absolute value of the encoder in the active bank.
void forcedUpdate(setting_t bank)
void begin() override
Initialize this updatable.
Array< int16_t, NumBanks > values
static constexpr int16_t maxValue
GenericMIDIAbsoluteEncoder(const BankAddress &address, Enc &&encoder, int16_t speedMultiply, uint8_t pulsesPerStep, const Sender &sender)
uint16_t getValue(setting_t bank) const
Get the absolute value of the encoder in the given bank.
EncoderState< decltype(encoder.read())> encstate
Class to keep track of relative position changes of rotary encoders.
int16_t getSpeedMultiply() const
void setSpeedMultiply(int16_t speedMultiply)
int16_t update(Enc_t encval)
A namespace for MIDI elements that can be added to a Bank, to change their address or channel.
An array wrapper for easy copying, comparing, and iterating.