Line data Source code
1 : #pragma once
2 :
3 : #include <Banks/BankAddresses.hpp>
4 : #include <MIDI_Outputs/Bankable/Abstract/MIDIButton.hpp>
5 : #include <MIDI_Senders/ProgramChangeSender.hpp>
6 :
7 : BEGIN_CS_NAMESPACE
8 :
9 : namespace Bankable {
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 **Program Change**
14 : * events.
15 : *
16 : * A Program Change event is sent when the button is pressed.
17 : * The button is debounced in software.
18 : * This version can be banked.
19 : *
20 : * @ingroup BankableMIDIOutputElements
21 : */
22 : class PCButton : public MIDIButton<SingleAddress, ProgramChangeSender> {
23 : public:
24 : /**
25 : * @brief Create a new PCButton object with the given pin, program number
26 : * and channel.
27 : *
28 : * @param config
29 : * The bank configuration to use: the bank to add this element to,
30 : * and whether to change the address, channel or cable number.
31 : * @param pin
32 : * The digital input pin to read from.
33 : * The internal pull-up resistor will be enabled.
34 : * @param address
35 : * The MIDI address containing the program number [0, 127],
36 : * channel [Channel_1, Channel_16], and optional cable number
37 : * [Cable_1, Cable_16].
38 : */
39 1 : PCButton(OutputBankConfig<> config, pin_t pin, MIDIAddress address)
40 1 : : MIDIButton({config, address}, pin, {}) {}
41 : };
42 :
43 : } // namespace Bankable
44 :
45 : END_CS_NAMESPACE
|