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 N 23 : * The number of variants/alternative addresses the element has. 24 : * 25 : * @ingroup ManyAddressesMIDIOutputElements 26 : */ 27 : template <setting_t N> 28 1 : class PCButton 29 : : public Bankable::MIDIButton<ManyAddresses<N>, 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 [0, 15]. 44 : * @param sender 45 : * The MIDI sender to use. 46 : */ 47 1 : PCButton(const Bank<N> &bank, pin_t pin, 48 : const Array<MIDICNChannelAddress, N> &addresses, 49 : const ProgramChangeSender &sender = {}) 50 1 : : MIDIButton<ManyAddresses<N>, ProgramChangeSender>{ 51 1 : {bank, addresses}, 52 1 : pin, 53 1 : sender, 54 2 : } {} 55 : }; 56 : 57 : } // namespace ManyAddresses 58 : } // namespace Bankable 59 : 60 : END_CS_NAMESPACE