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 : class CCPotentiometer
28 : : public Bankable::MIDIFilteredAnalog<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 1 : CCPotentiometer(const Bank<NumBanks> &bank, pin_t analogPin,
45 : const Array<MIDIAddress, NumBanks> &addresses)
46 : : MIDIFilteredAnalog<ManyAddresses<NumBanks>, ContinuousCCSender> {
47 1 : {bank, addresses}, analogPin, {}} {}
48 : };
49 :
50 : } // namespace ManyAddresses
51 : } // namespace Bankable
52 :
53 : END_CS_NAMESPACE
|