3#include <AH/STL/utility>
26template <
class Enc, u
int8_t NumBanks,
class BankAddress,
class Sender>
30 int16_t speedMultiply, uint8_t pulsesPerStep,
41 int16_t oldValue = values[
address.getSelection()];
42 int16_t newValue = oldValue + delta;
43 newValue = constrain(newValue, 0,
maxValue);
44 if (oldValue != newValue) {
45 values[
address.getSelection()] = newValue;
93 constexpr static int16_t
maxValue = uint16_t(1u << Sender::precision()) - 1;
99template <u
int8_t NumBanks,
class BankAddress,
class Sender>
103template <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.
#define AH_DIAGNOSTIC_POP()
#define AH_DIAGNOSTIC_WERROR()
A super class for object that have to be updated regularly.
An abstract class for rotary encoders that send absolute MIDI events.
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.
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.
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)
void forcedUpdate()
Send the current value over MIDI, even if the position of the encoder didn't change.
static constexpr int16_t maxValue
EncoderState< decltype(encoder.read())> encstate
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.