3#include <AH/STL/utility>
22template <class Enc, class Sender>
31 int16_t speedMultiply, uint8_t pulsesPerStep,
33 : encoder(std::forward<Enc>(encoder)), address(address),
34 encstate(speedMultiply, pulsesPerStep), sender(sender) {}
39 auto encval = encoder.read();
40 if (int16_t delta = encstate.update(encval)) {
41 sender.send(delta, address);
46 encstate.setSpeedMultiply(speedMultiply);
64template <
class Sender>
67template <
class Sender>
#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.
Class to keep track of relative position changes of rotary encoders.
An abstract class for rotary encoders that send MIDI events.
void setAddress(MIDIAddress address)
Set the MIDI address.
int16_t getSpeedMultiply() const
void setSpeedMultiply(int16_t speedMultiply)
void update() override
Update this updatable.
void begin() override
Initialize this updatable.
MIDIAddress getAddress() const
Get the MIDI address.
GenericMIDIRotaryEncoder(Enc &&encoder, MIDIAddress address, int16_t speedMultiply, uint8_t pulsesPerStep, const Sender &sender)
Construct a new MIDIRotaryEncoder.
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...