Arduino MIDI Library  Version 5.0.1
Message< SysExMaxSize > Struct Template Reference

#include <midi_Message.h>

Public Member Functions

 Message ()
 
unsigned getSysExSize () const
 

Public Attributes

Channel channel
 
MidiType type
 
DataByte data1
 
DataByte data2
 
DataByte sysexArray [sSysExMaxSize]
 
bool valid
 
unsigned length
 

Static Public Attributes

static const unsigned sSysExMaxSize = SysExMaxSize
 

Detailed Description

template<unsigned SysExMaxSize>
struct Message< SysExMaxSize >

The Message structure contains decoded data of a MIDI message read from the serial port with read()

Definition at line 42 of file midi_Message.h.

Constructor & Destructor Documentation

◆ Message()

template<unsigned SysExMaxSize>
Message< SysExMaxSize >::Message ( )
inline

Default constructor
Initializes the attributes with their default values.

Definition at line 47 of file midi_Message.h.

48  : channel(0)
50  , data1(0)
51  , data2(0)
52  , valid(false)
53  {
54  memset(sysexArray, 0, sSysExMaxSize * sizeof(DataByte));
55  }

Member Function Documentation

◆ getSysExSize()

template<unsigned SysExMaxSize>
unsigned Message< SysExMaxSize >::getSysExSize ( ) const
inline

Definition at line 98 of file midi_Message.h.

99  {
100  const unsigned size = unsigned(data2) << 8 | data1;
101  return size > sSysExMaxSize ? sSysExMaxSize : size;
102  }

Member Data Documentation

◆ channel

template<unsigned SysExMaxSize>
Channel Message< SysExMaxSize >::channel

The MIDI channel on which the message was recieved.
Value goes from 1 to 16.

Definition at line 64 of file midi_Message.h.

◆ data1

template<unsigned SysExMaxSize>
DataByte Message< SysExMaxSize >::data1

The first data byte.
Value goes from 0 to 127.

Definition at line 74 of file midi_Message.h.

◆ data2

template<unsigned SysExMaxSize>
DataByte Message< SysExMaxSize >::data2

The second data byte. If the message is only 2 bytes long, this one is null.
Value goes from 0 to 127.

Definition at line 80 of file midi_Message.h.

◆ length

template<unsigned SysExMaxSize>
unsigned Message< SysExMaxSize >::length

Total Length of the message.

Definition at line 96 of file midi_Message.h.

◆ sSysExMaxSize

template<unsigned SysExMaxSize>
const unsigned Message< SysExMaxSize >::sSysExMaxSize = SysExMaxSize
static

The maximum size for the System Exclusive array.

Definition at line 59 of file midi_Message.h.

◆ sysexArray

template<unsigned SysExMaxSize>
DataByte Message< SysExMaxSize >::sysexArray[sSysExMaxSize]

System Exclusive dedicated byte array.
Array length is stocked on 16 bits, in data1 (LSB) and data2 (MSB)

Definition at line 86 of file midi_Message.h.

◆ type

template<unsigned SysExMaxSize>
MidiType Message< SysExMaxSize >::type

The type of the message (see the MidiType enum for types reference)

Definition at line 69 of file midi_Message.h.

◆ valid

template<unsigned SysExMaxSize>
bool Message< SysExMaxSize >::valid

This boolean indicates if the message is valid or not. There is no channel consideration here, validity means the message respects the MIDI norm.

Definition at line 92 of file midi_Message.h.


The documentation for this struct was generated from the following file:
Message::sysexArray
DataByte sysexArray[sSysExMaxSize]
Definition: midi_Message.h:86
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::data2
DataByte data2
Definition: midi_Message.h:80
Message::type
MidiType type
Definition: midi_Message.h:69
Message::channel
Channel channel
Definition: midi_Message.h:64
Message::data1
DataByte data1
Definition: midi_Message.h:74
DataByte
byte DataByte
Definition: midi_Defs.h:57