Arduino MIDI Library  Version 5.0.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 #ifndef ARDUINO
33 #include <string.h>
34 #endif
35 
37 
41 template<unsigned SysExMaxSize>
42 struct Message
43 {
47  inline Message()
48  : channel(0)
50  , data1(0)
51  , data2(0)
52  , valid(false)
53  {
54  memset(sysexArray, 0, sSysExMaxSize * sizeof(DataByte));
55  }
56 
59  static const unsigned sSysExMaxSize = SysExMaxSize;
60 
65 
70 
75 
81 
87 
92  bool valid;
93 
96  unsigned length;
97 
98  inline unsigned getSysExSize() const
99  {
100  const unsigned size = unsigned(data2) << 8 | data1;
101  return size > sSysExMaxSize ? sSysExMaxSize : size;
102  }
103 };
104 
Message::getSysExSize
unsigned getSysExSize() const
Definition: midi_Message.h:98
midi_Defs.h
MIDI Library for the Arduino - Definitions.
MIDI_NAMESPACE
#define MIDI_NAMESPACE
Definition: midi_Namespace.h:30
Message::sysexArray
DataByte sysexArray[sSysExMaxSize]
Definition: midi_Message.h:86
END_MIDI_NAMESPACE
#define END_MIDI_NAMESPACE
Definition: midi_Namespace.h:32
InvalidType
@ InvalidType
For notifying errors.
Definition: midi_Defs.h:96
Message::sSysExMaxSize
static const unsigned sSysExMaxSize
Definition: midi_Message.h:59
Message::valid
bool valid
Definition: midi_Message.h:92
Message::length
unsigned length
Definition: midi_Message.h:96
midi_Namespace.h
MIDI Library for the Arduino - Namespace declaration.
Message::Message
Message()
Definition: midi_Message.h:47
Message::data2
DataByte data2
Definition: midi_Message.h:80
Message::type
MidiType type
Definition: midi_Message.h:69
MidiType
MidiType
Definition: midi_Defs.h:95
BEGIN_MIDI_NAMESPACE
#define BEGIN_MIDI_NAMESPACE
Definition: midi_Namespace.h:31
Message::channel
Channel channel
Definition: midi_Message.h:64
Channel
byte Channel
Definition: midi_Defs.h:58
Message::data1
DataByte data1
Definition: midi_Message.h:74
Message
Definition: midi_Message.h:43
DataByte
byte DataByte
Definition: midi_Defs.h:57