Control Surface  1.1.0
MIDI Control Surface library for Arduino
ManyAddresses/PBPotentiometer.hpp
Go to the documentation of this file.
1 #pragma once
2 
5 
6 #include <AH/Containers/ArrayHelpers.hpp>
10 
12 
13 namespace Bankable {
14 namespace ManyAddresses {
15 
16 /**
17  * @brief A class of MIDIOutputElement%s that read the analog input from a
18  * **potentiometer or fader**, and send out 14-bit MIDI **Pitch Bend**
19  * events.
20  *
21  * The analog input is filtered and hysteresis is applied for maximum
22  * stability.
23  * The actual precision is "only" 10 bits, because this is the resolution of the
24  * built-in ADC, and this is the default resolution used by the Mackie Control
25  * Universal protocol.
26  * This version can be banked using an arbitrary list of alternative
27  * addresses.
28  *
29  * @tparam N
30  * The number of variants/alternative addresses the element has.
31  *
32  * @ingroup ManyAddressesMIDIOutputElements
33  */
34 template <setting_t N>
36  : public Bankable::MIDIFilteredAnalog<ManyAddresses<N>,
37  PitchBendSender<10>> {
38  public:
39  /**
40  * @brief Create a new Bankable PBPotentiometer object with the given
41  * analog pin and channel.
42  *
43  * @param bank
44  * The bank that selects the address to use.
45  * @param analogPin
46  * The analog input pin to read from.
47  * @param addresses
48  * The list of MIDI channels [CHANNEL_1, CHANNEL_16] and optional
49  * Cable Numbers [0, 15].
50  * @param sender
51  * The MIDI sender to use.
52  */
53  PBPotentiometer(const Bank<N> &bank, pin_t analogPin,
54  const Array<MIDICNChannel, N> &addresses,
55  const PitchBendSender<10> &sender = {})
57  {bank, AH::copyAs<MIDICNChannelAddress>(addresses)},
58  analogPin,
59  sender,
60  } {}
61 };
62 
63 } // namespace ManyAddresses
64 } // namespace Bankable
65 
67 
Bank
A class that groups Bankable BankableMIDIOutputs and BankableMIDIInputs, and allows the user to chang...
Definition: Bank.hpp:77
Warnings.hpp
Bankable
A namespace for MIDI elements that can be added to a Bank, to change their address or channel.
Definition: BankAddresses.hpp:7
Bankable::ManyAddresses::ManyAddresses< N >
Bankable::MIDIFilteredAnalog
A class for potentiometers and faders that send MIDI events (with only a channel, no address) and tha...
Definition: Bankable/Abstract/MIDIFilteredAnalog.hpp:93
Bankable::ManyAddresses::PBPotentiometer::PBPotentiometer
PBPotentiometer(const Bank< N > &bank, pin_t analogPin, const Array< MIDICNChannel, N > &addresses, const PitchBendSender< 10 > &sender={})
Create a new Bankable PBPotentiometer object with the given analog pin and channel.
Definition: ManyAddresses/PBPotentiometer.hpp:53
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition: Settings/NamespaceSettings.hpp:9
AH_DIAGNOSTIC_POP
#define AH_DIAGNOSTIC_POP()
Definition: Warnings.hpp:17
BankAddresses.hpp
PitchBendSender< 10 >
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition: Settings/NamespaceSettings.hpp:10
AH::Array
An array wrapper for easy copying, comparing, and iterating.
Definition: Array.hpp:36
PitchBendSender.hpp
Bankable::MIDIFilteredAnalog< ManyAddresses< N >, PitchBendSender< 10 > >::sender
PitchBendSender< 10 > sender
Definition: Bankable/Abstract/MIDIFilteredAnalog.hpp:151
MIDIFilteredAnalog.hpp
Bankable::ManyAddresses::PBPotentiometer
A class of MIDIOutputElements that read the analog input from a potentiometer or fader,...
Definition: ManyAddresses/PBPotentiometer.hpp:35
AH::pin_t
uint16_t pin_t
The type for Arduino pins (and ExtendedIOElement pins).
Definition: Hardware-Types.hpp:17
AH_DIAGNOSTIC_WERROR
#define AH_DIAGNOSTIC_WERROR()
Definition: Warnings.hpp:16