Line data Source code
1 : #pragma once 2 : 3 : #include <Banks/BankableAddresses.hpp> 4 : #include <Control_Surface/Control_Surface_Class.hpp> 5 : #include <Def/Def.hpp> 6 : #include <Selectors/Selectable.hpp> 7 : 8 : BEGIN_CS_NAMESPACE 9 : 10 : namespace Bankable { 11 : 12 : template <setting_t N> 13 : class ProgramChanger : public Selectable<N> { 14 : public: 15 1 : ProgramChanger(OutputBankConfig<> bank, const Array<uint8_t, N> &programs, 16 : MIDIChannelCable channelCN) 17 1 : : bank(bank), programs(programs), channelCN(channelCN) {} 18 : 19 0 : void select(setting_t setting) override { 20 0 : setting = this->validateSetting(setting); 21 0 : MIDIAddress addr {programs[setting], channelCN}; 22 0 : Control_Surface.sendProgramChange(addr + bank.getAddressOffset()); 23 0 : } 24 : 25 : private: 26 : OutputBankableMIDIAddress bank; 27 : Array<uint8_t, N> programs; 28 : MIDIChannelCable channelCN; 29 : }; 30 : 31 : } // namespace Bankable 32 : 33 : END_CS_NAMESPACE