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 : 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 NumBanks 23 : * The number of variants/alternative addresses the element has. 24 : * 25 : * @ingroup ManyAddressesMIDIOutputElements 26 : */ 27 : template <setting_t NumBanks> 28 : class PCButton : public Bankable::MIDIButton<ManyAddresses<NumBanks>, 29 : 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 [Cable_1, Cable_16]. 44 : */ 45 1 : PCButton(const Bank<NumBanks> &bank, pin_t pin, 46 : const Array<MIDIAddress, NumBanks> &addresses) 47 : : MIDIButton<ManyAddresses<NumBanks>, ProgramChangeSender> { 48 1 : {bank, addresses}, pin, {}} {} 49 : }; 50 : 51 : } // namespace ManyAddresses 52 : } // namespace Bankable 53 : 54 : END_CS_NAMESPACE