Line data Source code
1 : #pragma once 2 : 3 : #include <AH/Settings/Warnings.hpp> 4 : AH_DIAGNOSTIC_WERROR() 5 : 6 : #include <Banks/BankAddresses.hpp> 7 : #include <MIDI_Outputs/Bankable/Abstract/MIDIFilteredAnalog.hpp> 8 : #include <MIDI_Senders/PitchBendSender.hpp> 9 : 10 : BEGIN_CS_NAMESPACE 11 : 12 : namespace Bankable { 13 : 14 : /** 15 : * @brief A class of MIDIOutputElement%s that read the analog input from a 16 : * **potentiometer or fader**, and send out 14-bit MIDI **Pitch Bend** 17 : * events. 18 : * 19 : * The analog input is filtered and hysteresis is applied for maximum 20 : * stability. 21 : * The actual precision is "only" 10 bits, because this is the resolution of the 22 : * built-in ADC, and this is the default resolution used by the Mackie Control 23 : * Universal protocol. 24 : * This version can be banked. 25 : * 26 : * @ingroup BankableMIDIOutputElements 27 : */ 28 1 : class PBPotentiometer 29 : : public MIDIFilteredAnalog<SingleAddress, PitchBendSender<10>> { 30 : public: 31 : /** 32 : * @brief Create a new Bankable PBPotentiometer object with the given 33 : * analog pin and channel. 34 : * 35 : * @param config 36 : * The bank configuration to use: the bank to add this element to, 37 : * and whether to change the address, channel or cable number. 38 : * @param analogPin 39 : * The analog input pin to read from. 40 : * @param address 41 : * The MIDI channel [CHANNEL_1, CHANNEL_16] and optional Cable 42 : * Number [0, 15]. 43 : * @param sender 44 : * The MIDI sender to use. 45 : */ 46 1 : PBPotentiometer(const OutputBankConfig &config, pin_t analogPin, 47 : const MIDICNChannel &address, 48 : const PitchBendSender<10> &sender = {}) 49 1 : : MIDIFilteredAnalog{{config, address}, analogPin, sender} {} 50 : }; 51 : 52 : } // namespace Bankable 53 : 54 : END_CS_NAMESPACE 55 : 56 : AH_DIAGNOSTIC_POP()