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/DigitalCCSender.hpp>
6 :
7 : BEGIN_CS_NAMESPACE
8 :
9 : /** @brief A namespace for MIDI elements that can be added to a Bank,
10 : * to change their address or channel.
11 : */
12 : namespace Bankable {
13 :
14 : /**
15 : * @brief A class of MIDIOutputElement%s that read the input of a **momentary
16 : * push button or switch**, and send out MIDI **Control Change**
17 : * events.
18 : *
19 : * A value of 0x7F is sent when the button is pressed, and a value of
20 : * 0x00 is sent when the button is released.
21 : * The button is debounced in software.
22 : * This version can be banked.
23 : *
24 : * @ingroup BankableMIDIOutputElements
25 : */
26 : class CCButton : public MIDIButton<SingleAddress, DigitalCCSender> {
27 : public:
28 : /**
29 : * @brief Create a new Bankable CCButton object with the given bank
30 : * configuration, button pin, and address.
31 : *
32 : * @param config
33 : * The bank configuration to use: the bank to add this element to,
34 : * and whether to change the address, channel or cable number.
35 : * @param pin
36 : * The digital input pin with the button connected.
37 : * The internal pull-up resistor will be enabled.
38 : * @param address
39 : * The MIDI address containing the controller number [0, 119],
40 : * channel [Channel_1, Channel_16], and optional cable number
41 : * [Cable_1, Cable_16].
42 : * @param sender
43 : * The MIDI sender to use.
44 : */
45 4 : CCButton(OutputBankConfig<> config, pin_t pin, MIDIAddress address,
46 : const DigitalCCSender &sender = {})
47 4 : : MIDIButton {{config, address}, pin, sender} {}
48 : };
49 :
50 : } // namespace Bankable
51 :
52 : END_CS_NAMESPACE
|