Line data Source code
1 : #pragma once
2 :
3 : #include <MIDI_Outputs/Abstract/MIDIButtonLatching.hpp>
4 : #include <MIDI_Senders/DigitalCCSender.hpp>
5 :
6 : BEGIN_CS_NAMESPACE
7 :
8 : /**
9 : * @brief A class of MIDIOutputElement%s that read the input of a **latching
10 : * push button or toggle switch**, and send out MIDI **Control Change**
11 : * events.
12 : *
13 : * When the switch changes state, two MIDI events are sent: the first
14 : * one with a value of 0x7F, followed immediately by a second one with
15 : * a value of 0x00.
16 : * The switch is debounced in software.
17 : * This version cannot be banked.
18 : *
19 : * @ingroup MIDIOutputElements
20 : */
21 : class CCButtonLatching : public MIDIButtonLatching<DigitalCCSender> {
22 : public:
23 : /**
24 : * @brief Create a new CCButtonLatching object with the given pin,
25 : * the given controller number and channel.
26 : *
27 : * @param pin
28 : * The digital input pin with the button connected.
29 : * The internal pull-up resistor will be enabled.
30 : * @param address
31 : * The MIDI address containing the controller number [0, 119],
32 : * channel [Channel_1, Channel_16], and optional cable number
33 : * [Cable_1, Cable_16].
34 : * @param sender
35 : * The MIDI sender to use.
36 : */
37 1 : CCButtonLatching(pin_t pin, MIDIAddress address,
38 : const DigitalCCSender &sender = {})
39 1 : : MIDIButtonLatching(pin, address, sender) {}
40 : };
41 :
42 : END_CS_NAMESPACE
|