Control Surface  1.1.0
MIDI Control Surface library for Arduino
ManyAddresses/PCButton.hpp
Go to the documentation of this file.
1 #pragma once
2 
6 
8 
9 namespace Bankable {
10 namespace ManyAddresses {
11 
12 /**
13  * @brief A class of MIDIOutputElement%s that read the input of a **momentary
14  * push button or switch**, and send out MIDI **Program Change**
15  * events.
16  *
17  * A Program Change event is sent when the button is pressed.
18  * The button is debounced in software.
19  * This version can be banked using an arbitrary list of alternative
20  * addresses.
21  *
22  * @tparam N
23  * The number of variants/alternative addresses the element has.
24  *
25  * @ingroup ManyAddressesMIDIOutputElements
26  */
27 template <setting_t N>
28 class PCButton
29  : public Bankable::MIDIButton<ManyAddresses<N>, ProgramChangeSender> {
30  public:
31  /**
32  * @brief Create a new PCButton object with the given pin, program number
33  * and channel.
34  *
35  * @param bank
36  * The bank that selects the address to use.
37  * @param pin
38  * The digital input pin to read from.
39  * The internal pull-up resistor will be enabled.
40  * @param addresses
41  * The list of MIDI addresses containing the program number
42  * [0, 127], channel [CHANNEL_1, CHANNEL_16], and optional cable
43  * number [0, 15].
44  * @param sender
45  * The MIDI sender to use.
46  */
47  PCButton(const Bank<N> &bank, pin_t pin,
48  const Array<MIDICNChannelAddress, N> &addresses,
49  const ProgramChangeSender &sender = {})
51  {bank, addresses},
52  pin,
53  sender,
54  } {}
55 };
56 
57 } // namespace ManyAddresses
58 } // namespace Bankable
59 
MIDIButton.hpp
Bank
A class that groups Bankable BankableMIDIOutputs and BankableMIDIInputs, and allows the user to chang...
Definition: Bank.hpp:77
ProgramChangeSender.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::ManyAddresses::PCButton::PCButton
PCButton(const Bank< N > &bank, pin_t pin, const Array< MIDICNChannelAddress, N > &addresses, const ProgramChangeSender &sender={})
Create a new PCButton object with the given pin, program number and channel.
Definition: ManyAddresses/PCButton.hpp:47
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition: Settings/NamespaceSettings.hpp:9
Bankable::MIDIButton
An abstract class for momentary push buttons that send MIDI events.
Definition: Bankable/Abstract/MIDIButton.hpp:20
BankAddresses.hpp
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
Bankable::ManyAddresses::PCButton
A class of MIDIOutputElements that read the input of a momentary push button or switch,...
Definition: ManyAddresses/PCButton.hpp:28
AH::pin_t
uint16_t pin_t
The type for Arduino pins (and ExtendedIOElement pins).
Definition: Hardware-Types.hpp:17
Bankable::MIDIButton< ManyAddresses< N >, ProgramChangeSender >::sender
ProgramChangeSender sender
Definition: Bankable/Abstract/MIDIButton.hpp:59
ProgramChangeSender
Definition: ProgramChangeSender.hpp:7