Arduino MIDI Library  Version 4.3
midi_Message.h
Go to the documentation of this file.
1 
29 #pragma once
30 
31 #include "midi_Namespace.h"
32 #include "midi_Defs.h"
33 
35 
39 template<unsigned SysExMaxSize>
40 struct Message
41 {
45  inline Message()
46  : channel(0)
47  , type(midi::InvalidType)
48  , data1(0)
49  , data2(0)
50  , valid(false)
51  {
52  memset(sysexArray, 0, sSysExMaxSize * sizeof(DataByte));
53  }
54 
57  static const unsigned sSysExMaxSize = SysExMaxSize;
58 
63 
68 
73 
79 
85 
90  bool valid;
91 
92  inline unsigned getSysExSize() const
93  {
94  const unsigned size = unsigned(data2) << 8 | data1;
95  return size > sSysExMaxSize ? sSysExMaxSize : size;
96  }
97 };
98 
DataByte data1
Definition: midi_Message.h:72
static const unsigned sSysExMaxSize
Definition: midi_Message.h:57
DataByte data2
Definition: midi_Message.h:78
MidiType type
Definition: midi_Message.h:67
#define BEGIN_MIDI_NAMESPACE
DataByte sysexArray[sSysExMaxSize]
Definition: midi_Message.h:84
#define END_MIDI_NAMESPACE
For notifying errors.
Definition: midi_Defs.h:68
byte Channel
Definition: midi_Defs.h:60
MIDI Library for the Arduino - Namespace declaration.
MidiType
Definition: midi_Defs.h:66
byte DataByte
Definition: midi_Defs.h:59
MIDI Library for the Arduino - Definitions.
bool valid
Definition: midi_Message.h:90
unsigned getSysExSize() const
Definition: midi_Message.h:92
Channel channel
Definition: midi_Message.h:62