Control Surface  1.1.1
MIDI Control Surface library for Arduino
MultiMIDI_Interface.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 
6 
15 template <uint8_t N>
17  public:
28 
29  void begin() override {
30  for (auto interface : interfaces)
31  interface->begin();
32  }
33 
34  void update() override {
35  for (auto interface : interfaces)
36  interface->update();
37  }
38 
39  void setCallbacks(MIDI_Callbacks *cb) override {
40  for (auto interface : interfaces)
41  interface->setCallbacks(cb);
42  }
44 
45  protected:
46  void sendImpl(uint8_t m, uint8_t c, uint8_t d1, uint8_t d2,
47  uint8_t cn) override {
48  for (auto interface : interfaces)
49  interface->sendImpl(m, c, d1, d2, cn);
50  }
51 
52  void sendImpl(uint8_t m, uint8_t c, uint8_t d1, uint8_t cn) override {
53  for (auto interface : interfaces)
54  interface->sendImpl(m, c, d1, cn);
55  }
56 
57  void sendImpl(const uint8_t *data, size_t length, uint8_t cn) override {
58  for (auto interface : interfaces)
59  interface->sendImpl(data, length, cn);
60  }
61 
62  void sendImpl(uint8_t rt, uint8_t cn) override {
63  for (auto interface : interfaces)
64  interface->sendImpl(rt, cn);
65  }
66 
67  private:
69 };
70 
MultiMIDI_Interface::sendImpl
void sendImpl(uint8_t m, uint8_t c, uint8_t d1, uint8_t d2, uint8_t cn) override
Low-level function for sending a 3-byte MIDI message.
Definition: MultiMIDI_Interface.hpp:46
MIDI_Interface::setCallbacks
virtual void setCallbacks(MIDI_Callbacks *cb)=0
Set the callbacks that will be called when a MIDI message is received.
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition: Settings/NamespaceSettings.hpp:9
MultiMIDI_Interface::begin
void begin() override
Initialize the MIDI Interface.
Definition: MultiMIDI_Interface.hpp:29
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition: Settings/NamespaceSettings.hpp:10
MultiMIDI_Interface::sendImpl
void sendImpl(uint8_t m, uint8_t c, uint8_t d1, uint8_t cn) override
Low-level function for sending a 2-byte MIDI message.
Definition: MultiMIDI_Interface.hpp:52
MultiMIDI_Interface::sendImpl
void sendImpl(uint8_t rt, uint8_t cn) override
Low-level function for sending a single-byte MIDI message.
Definition: MultiMIDI_Interface.hpp:62
MultiMIDI_Interface::setCallbacks
void setCallbacks(MIDI_Callbacks *cb) override
Set the callbacks that will be called when a MIDI message is received.
Definition: MultiMIDI_Interface.hpp:39
AH::Array
An array wrapper for easy copying, comparing, and iterating.
Definition: Array.hpp:36
MultiMIDI_Interface::interfaces
Array< Parsing_MIDI_Interface *, N > interfaces
Definition: MultiMIDI_Interface.hpp:68
MultiMIDI_Interface::MultiMIDI_Interface
MultiMIDI_Interface(const Array< Parsing_MIDI_Interface *, N > &interfaces)
Constructor.
Definition: MultiMIDI_Interface.hpp:26
MultiMIDI_Interface::sendImpl
void sendImpl(const uint8_t *data, size_t length, uint8_t cn) override
Low-level function for sending a system exclusive MIDI message.
Definition: MultiMIDI_Interface.hpp:57
MultiMIDI_Interface
A class for grouping multiple MIDI interfaces in parallel.
Definition: MultiMIDI_Interface.hpp:16
MIDI_Callbacks
A class for callbacks from MIDI input.
Definition: MIDI_Interface.hpp:247
MIDI_Interface
An abstract class for MIDI interfaces.
Definition: MIDI_Interface.hpp:16
MIDI_Interface.hpp
MultiMIDI_Interface::update
void update() override
Read the MIDI interface and call the callback if a message is received.
Definition: MultiMIDI_Interface.hpp:34