Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
ProgramChangeSelector.hpp
Go to the documentation of this file.
1#pragma once
2
6
8
9template <setting_t N, class Callback = EmptySelectorCallback>
11 : public GenericSelector<N, Callback>,
12 public MatchingMIDIInputElement<MIDIMessageType::ProgramChange,
13 OneByteMIDIMatcher> {
14 public:
16 using Parent =
18
20 const Callback &callback,
21 MIDIChannelCable address)
22 : GenericSelector<N, Callback> {selectable, callback}, Parent(address) {
23 }
24
26
28
29 void handleUpdate(typename Matcher::Result match) override {
30 uint8_t program = match.value;
31 if (program < N) {
32 this->set(program);
33 } else {
34 DEBUGFN(F("Warning: Received Program Change to program 0x")
35 << hex << program << dec
36 << F(", which is not smaller than the number of settings (")
37 << N << ')');
38 }
39 }
40};
41
50template <setting_t N>
56
#define END_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
MatchingMIDIInputElement< MIDIMessageType::ProgramChange, Matcher > Parent
GenericProgramChangeSelector(Selectable< N > &selectable, const Callback &callback, MIDIChannelCable address)
void begin() override
Initialize this updatable.
void handleUpdate(typename Matcher::Result match) override
void reset() override
Reset the input element to its initial state.
void set(setting_t newSetting)
Select the given selection.
Definition Selector.hpp:93
Callback callback
Definition Selector.hpp:144
Selectable< N > & selectable
Definition Selector.hpp:141
void begin() override
Initialize this updatable.
Definition Selector.hpp:72
void reset()
Reset the selection to the initial selection.
Definition Selector.hpp:80
A class for saving a MIDI channel and cable number.
The MIDIInputElement base class is very general: you give it a MIDI message, and it calls the updateW...
Selector that listens for MIDI Program Change events on a given MIDI Channel, and uses the program nu...
ProgramChangeSelector(Selectable< N > &selectable, MIDIChannelCable address)
#define DEBUGFN(x)
Print an expression and its function (function name and line number) to the debug output if debugging...
Definition Debug.hpp:115
Matcher for MIDI messages with 1 data byte, such as Channel Pressure and Program Change.