Line data Source code
1 : #pragma once 2 : 3 : #include <Banks/BankAddresses.hpp> 4 : #include <MIDI_Outputs/Bankable/Abstract/MIDIIncrementDecrementButtons.hpp> 5 : #include <MIDI_Senders/RelativeCCSender.hpp> 6 : 7 : BEGIN_CS_NAMESPACE 8 : 9 : namespace Bankable { 10 : namespace ManyAddresses { 11 : /** 12 : * @brief A class of MIDIOutputElement%s that read the input of **two 13 : * momentary push buttons** to increment or decrement a **relative 14 : * setting** using relative MIDI **Control Change** events. 15 : * An optional note number can be provided to reset the setting. 16 : * 17 : * This version can be banked using an arbitrary list of alternative 18 : * addresses. 19 : * 20 : * @tparam N 21 : * The number of variants/alternative addresses the element has. 22 : * 23 : * @ingroup ManyAddressesMIDIOutputElements 24 : */ 25 : template <setting_t N> 26 1 : class CCIncrementDecrementButtons 27 : : public MIDIIncrementDecrementButtons< 28 : TwoManyAddresses<N>, RelativeCCSender, DigitalNoteSender> { 29 : public: 30 : /** 31 : * @brief Construct a new Bankable CCIncrementDecrementButtons object. 32 : * 33 : * @param config 34 : * The bank configuration to use: the bank to add this element to, 35 : * and whether to change the address, channel or cable number. 36 : * @param buttons 37 : * The pins with the increment and decrement buttons connected. 38 : * The internal pull-up resistors will be enabled. 39 : * @param addresses 40 : * The list of MIDI addresses to use for the relative events, 41 : * containing the controller number [0, 119], channel [CHANNEL_1, 42 : * CHANNEL_16], and optional cable number [0, 15]. 43 : * @param multiplier 44 : * The multiplier for the relative events. When setting it to 2, 45 : * it will scroll twice as fast, for example. 46 : * @param resetNotes 47 : * The list of MIDI addresses to use to reset the setting, 48 : * containing the note number [0, 127], channel [CHANNEL_1, 49 : * CHANNEL_16], and optional cable number [0, 15]. It will be 50 : * triggered when the increment and decrement buttons are pressed 51 : * simultaneously. 52 : * @param relativeSender 53 : * The MIDI sender to use for the relative events. 54 : * @param resetSender 55 : * The MIDI sender to use for reset events. 56 : */ 57 1 : CCIncrementDecrementButtons( 58 : const OutputBankConfig &config, 59 : const AH::IncrementDecrementButtons &buttons, 60 : const Array<MIDICNChannelAddress, N> &addresses, uint8_t multiplier = 1, 61 : const Array<MIDICNChannelAddress, N> &resetNotes = {}, 62 : const RelativeCCSender &relativeSender = {}, 63 : const DigitalNoteSender &resetSender = {}) 64 1 : : MIDIIncrementDecrementButtons<TwoManyAddresses<N>, RelativeCCSender, 65 : DigitalNoteSender>( 66 1 : {config, {addresses, resetNotes}}, buttons, multiplier, 67 3 : relativeSender, resetSender) {} 68 : }; 69 : } // namespace ManyAddresses 70 : } // namespace Bankable 71 : 72 : END_CS_NAMESPACE