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