Line data Source code
1 : #pragma once 2 : 3 : #include <Banks/BankAddresses.hpp> 4 : #include <MIDI_Outputs/Bankable/Abstract/MIDIAbsoluteEncoder.hpp> 5 : #include <MIDI_Senders/PitchBendSender.hpp> 6 : 7 : BEGIN_CS_NAMESPACE 8 : 9 : namespace Bankable { 10 : 11 : /** 12 : * @brief A class of MIDIOutputElement%s that read the input of a **quadrature 13 : * (rotary) encoder** and send out absolute MIDI **Pitch Bend** 14 : * events. 15 : * 16 : * This version can be banked. 17 : * 18 : * @tparam NumBanks 19 : * The number of banks. 20 : * 21 : * @ingroup BankableMIDIOutputElements 22 : */ 23 : template <size_t NumBanks> 24 : class PBAbsoluteEncoder 25 : : public MIDIAbsoluteEncoder<NumBanks, SingleAddress, PitchBendSender<14>> { 26 : public: 27 : /** 28 : * @brief Construct a new Bankable PBAbsoluteEncoder object with the given 29 : * pins, channel, speed factor, and number of pulses per step. 30 : * 31 : * @param config 32 : * The bank configuration to use: the bank to add this element to, 33 : * and whether to change the address, channel or cable number. 34 : * @param encoder 35 : * The Encoder object to use. 36 : * Usually passed as a list of the two pins connected to the 37 : * A and B outputs of the encoder, e.g. `{2, 3}`. 38 : * The internal pull-up resistors will be enabled by the Encoder 39 : * library. 40 : * @param address 41 : * The MIDI channel [Channel_1, Channel_16], and optional cable 42 : * number [0, 15]. 43 : * @param speedMultiply 44 : * A constant factor to increase the speed of the rotary encoder. 45 : * The difference in position will just be multiplied by this 46 : * factor. 47 : * @param pulsesPerStep 48 : * The number of pulses per physical click of the encoder. 49 : * For a normal encoder, this is 4. If you want to increase the 50 : * resolution, for the use of Jog wheels, for example, you can go 51 : * as 1. 52 : * Whereas a greater speedMultiply factor will increase the 53 : * speed, increasing the number of pulsesPerStep will result in a 54 : * lower speed. 55 : */ 56 1 : PBAbsoluteEncoder(const BankConfig<NumBanks> &config, AHEncoder &&encoder, 57 : MIDIChannelCable address, int16_t speedMultiply = 1, 58 : uint8_t pulsesPerStep = 4) 59 : : MIDIAbsoluteEncoder<NumBanks, SingleAddress, PitchBendSender<14>>( 60 1 : {config, address}, std::move(encoder), speedMultiply, 61 2 : pulsesPerStep, {}) {} 62 : }; 63 : 64 : } // namespace Bankable 65 : 66 : END_CS_NAMESPACE