Line data Source code
1 : #pragma once 2 : 3 : #include <Banks/BankAddresses.hpp> 4 : #include <MIDI_Outputs/Bankable/Abstract/MIDIRotaryEncoder.hpp> 5 : #include <MIDI_Senders/RelativeCCSender.hpp> 6 : 7 : BEGIN_CS_NAMESPACE 8 : 9 : namespace Bankable { 10 : namespace ManyAddresses { 11 : 12 : /** 13 : * @brief A class of MIDIOutputElement%s that read the input of a **quadrature 14 : * (rotary) encoder** and send out relative MIDI **Control Change** 15 : * events. 16 : * 17 : * This version can be banked using an arbitrary list of alternative 18 : * addresses. 19 : * 20 : * @tparam NumBanks 21 : * The number of variants/alternative addresses the element has. 22 : * 23 : * @ingroup ManyAddressesMIDIOutputElements 24 : */ 25 : template <setting_t NumBanks> 26 : class CCRotaryEncoder 27 : : public MIDIRotaryEncoder<ManyAddresses<NumBanks>, RelativeCCSender> { 28 : public: 29 : /** 30 : * @brief Construct a new Bankable CCRotaryEncoder object with the given 31 : * pins, controller, channel, speed factor, and number of pulses 32 : * per step. 33 : * 34 : * @param bank 35 : * The bank that selects the address to use. 36 : * @param encoder 37 : * The rotary encoder object to read from. 38 : * @param addresses 39 : * The list of MIDI addresses containing the controller number 40 : * [0, 119], channel [Channel_1, Channel_16], and optional cable 41 : * number [Cable_1, Cable_16]. 42 : * @param speedMultiply 43 : * A constant factor to increase the speed of the rotary encoder. 44 : * The difference in position will just be multiplied by this 45 : * factor. 46 : * @param pulsesPerStep 47 : * The number of pulses per physical click of the encoder. 48 : * For a normal encoder, this is 4. If you want to increase the 49 : * resolution, for the use of Jog wheels, for example, you can go 50 : * as 1. 51 : * Whereas a greater speedMultiply factor will increase the 52 : * speed, increasing the number of pulsesPerStep will result in a 53 : * lower speed. 54 : */ 55 1 : CCRotaryEncoder(const Bank<NumBanks> &bank, AHEncoder &&encoder, 56 : const Array<MIDIAddress, NumBanks> &addresses, 57 : int16_t speedMultiply = 1, uint8_t pulsesPerStep = 4) 58 : : MIDIRotaryEncoder<ManyAddresses<NumBanks>, RelativeCCSender>( 59 1 : {bank, addresses}, std::move(encoder), speedMultiply, 60 2 : pulsesPerStep, {}) {} 61 : }; 62 : 63 : } // namespace ManyAddresses 64 : } // namespace Bankable 65 : 66 : END_CS_NAMESPACE