Line data Source code
1 : #pragma once 2 : 3 : #include <AH/Settings/Warnings.hpp> 4 : AH_DIAGNOSTIC_WERROR() 5 : 6 : #include <MIDI_Outputs/Abstract/MIDIFilteredAnalog.hpp> 7 : #include <MIDI_Senders/PitchBendSender.hpp> 8 : 9 : BEGIN_CS_NAMESPACE 10 : 11 : /** 12 : * @brief A class of MIDIOutputElement%s that read the analog input from a 13 : * **potentiometer or fader**, and send out 14-bit MIDI **Pitch Bend** 14 : * events. 15 : * 16 : * The analog input is filtered and hysteresis is applied for maximum 17 : * stability. 18 : * The actual precision is "only" 8 bits, because the built-in ADC 19 : * is pretty noisy. 20 : * This version cannot be banked. 21 : * 22 : * @ingroup MIDIOutputElements 23 : */ 24 4 : class PBPotentiometer : public MIDIFilteredAnalog<PitchBendSender<10>> { 25 : public: 26 : /** 27 : * @brief Create a new PBPotentiometer object with the given analog pin 28 : * and channel. 29 : * 30 : * @param analogPin 31 : * The analog input pin to read from. 32 : * @param address 33 : * The MIDI channel [CHANNEL_1, CHANNEL_16] and optional Cable 34 : * Number [0, 15]. 35 : * @param sender 36 : * The MIDI sender to use. 37 : */ 38 4 : PBPotentiometer(pin_t analogPin, const MIDICNChannel &address = CHANNEL_1, 39 : const PitchBendSender<10> &sender = {}) 40 4 : : MIDIFilteredAnalog(analogPin, address, sender) {} 41 : }; 42 : 43 : END_CS_NAMESPACE 44 : 45 : AH_DIAGNOSTIC_POP()