Control Surface new-input
MIDI Control Surface library for Arduino
MIDI_Parser.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <stddef.h>
4 #include <stdint.h>
5 #include <stdlib.h>
6 
7 #include <Def/Def.hpp>
8 #include <Settings/SettingsWrapper.hpp>
9 
10 #include "MIDI_MessageTypes.hpp"
11 #include "MIDIReadEvent.hpp"
12 
14 
16 class MIDI_Parser {
17  public:
22  return SysCommonMessage(midimsg);
23  }
26 #if IGNORE_SYSEX
28  SysExMessage getSysExMessage() const { return {nullptr, 0, CABLE_1}; }
29 #endif
30 
31  protected:
32  MIDIMessage midimsg = {0x00, 0x00, 0x00};
34 
35  public:
37  static bool isStatus(uint8_t data) { return data & (1 << 7); }
39  static bool isData(uint8_t data) { return (data & (1 << 7)) == 0; }
40 };
41 
constexpr Cable CABLE_1
Definition: Cable.hpp:118
#define END_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Base class for MIDI parsers.
Definition: MIDI_Parser.hpp:16
ChannelMessage getChannelMessage() const
Get the latest MIDI channel voice message.
Definition: MIDI_Parser.hpp:19
RealTimeMessage getRealTimeMessage() const
Get the latest MIDI real-time message.
Definition: MIDI_Parser.hpp:25
static bool isData(uint8_t data)
Check if the given byte is a MIDI data byte.
Definition: MIDI_Parser.hpp:39
static bool isStatus(uint8_t data)
Check if the given byte is a MIDI header/status byte.
Definition: MIDI_Parser.hpp:37
SysCommonMessage getSysCommonMessage() const
Get the latest MIDI system common message.
Definition: MIDI_Parser.hpp:21
MIDIMessage midimsg
Definition: MIDI_Parser.hpp:32
RealTimeMessage rtmsg
Definition: MIDI_Parser.hpp:33