Line data Source code
1 : #pragma once 2 : 3 : #include <Banks/BankAddresses.hpp> 4 : #include <MIDI_Outputs/Bankable/Abstract/MIDIFilteredAnalog.hpp> 5 : #include <MIDI_Senders/ContinuousCCSender.hpp> 6 : 7 : BEGIN_CS_NAMESPACE 8 : namespace Bankable { 9 : namespace ManyAddresses { 10 : 11 : /** 12 : * @brief A class of MIDIOutputElement%s that read the analog input from a 13 : * **potentiometer or fader**, and send out 7-bit MIDI **Control 14 : * Change** events. 15 : * 16 : * The analog input is filtered and hysteresis is applied for maximum 17 : * stability. 18 : * This version can be banked using an arbitrary list of alternative 19 : * addresses. 20 : * 21 : * @tparam NumBanks 22 : * The number of variants/alternative addresses the element has. 23 : * 24 : * @ingroup ManyAddressesMIDIOutputElements 25 : */ 26 : template <setting_t NumBanks> 27 1 : class CCPotentiometer 28 : : public Bankable::MIDIFilteredAnalogAddressable<ManyAddresses<NumBanks>, 29 : ContinuousCCSender> { 30 : public: 31 : /** 32 : * @brief Create a new CCPotentiometer object with the given 33 : * analog pin, and address list. 34 : * 35 : * @param bank 36 : * The bank that selects the address to use. 37 : * @param analogPin 38 : * The analog input pin to read from. 39 : * @param addresses 40 : * The list of MIDI addresses containing the controller number 41 : * [0, 119], channel [CHANNEL_1, CHANNEL_16], and optional cable 42 : * number [CABLE_1, CABLE_16]. 43 : * 44 : * @ingroup MIDIOutputElementConstructors 45 : */ 46 1 : CCPotentiometer(const Bank<NumBanks> &bank, pin_t analogPin, 47 : const Array<MIDIAddress, NumBanks> &addresses) 48 1 : : MIDIFilteredAnalogAddressable<ManyAddresses<NumBanks>, 49 : ContinuousCCSender>{ 50 2 : {bank, addresses}, analogPin, {}} {} 51 : }; 52 : 53 : } // namespace ManyAddresses 54 : } // namespace Bankable 55 : 56 : END_CS_NAMESPACE