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