Control Surface  1.2.0
MIDI Control Surface library for Arduino
SerialMIDI_Parser.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "MIDI_Parser.hpp"
4 #include "SysExBuffer.hpp"
5 
7 
8 class SerialMIDI_Parser : public MIDI_Parser {
9  public:
10  MIDIReadEvent parse(uint8_t midibyte);
11 
12 #if !IGNORE_SYSEX
13  SysExMessage getSysExMessage() const override {
14  return {sysexbuffer.getBuffer(), sysexbuffer.getLength(), 0};
15  }
16 #endif
17 
18  protected:
19 #if !IGNORE_SYSEX
21 
22  bool addSysExByte(uint8_t data) { return sysexbuffer.add(data); }
24  void endSysEx() { sysexbuffer.end(); }
25 #endif
26 
27  private:
28  bool thirdByte = false;
29 };
30 
SerialMIDI_Parser::startSysEx
void startSysEx()
Definition: SerialMIDI_Parser.hpp:23
SerialMIDI_Parser::addSysExByte
bool addSysExByte(uint8_t data)
Definition: SerialMIDI_Parser.hpp:22
SysExMessage
Definition: MIDI_MessageTypes.hpp:138
SysExBuffer::start
void start()
Start a new SysEx message.
Definition: SysExBuffer.cpp:5
MIDI_Parser
Definition: MIDI_Parser.hpp:22
SerialMIDI_Parser::sysexbuffer
SysExBuffer sysexbuffer
Definition: SerialMIDI_Parser.hpp:20
SysExBuffer.hpp
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition: Settings/NamespaceSettings.hpp:9
SysExBuffer::end
void end()
Finish the current SysEx message.
Definition: SysExBuffer.cpp:11
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition: Settings/NamespaceSettings.hpp:10
SerialMIDI_Parser::endSysEx
void endSysEx()
Definition: SerialMIDI_Parser.hpp:24
SysExBuffer
Definition: SysExBuffer.hpp:7
SerialMIDI_Parser
Definition: SerialMIDI_Parser.hpp:8
SysExBuffer::getLength
size_t getLength() const
Get the length of the SysEx message in the buffer.
Definition: SysExBuffer.cpp:35
SerialMIDI_Parser::getSysExMessage
SysExMessage getSysExMessage() const override
Get the latest SysEx message.
Definition: SerialMIDI_Parser.hpp:13
SerialMIDI_Parser::parse
MIDIReadEvent parse(uint8_t midibyte)
Definition: SerialMIDI_Parser.cpp:5
MIDIReadEvent
MIDIReadEvent
Result of the MIDI interface read methods.
Definition: MIDI_Parser.hpp:15
SysExBuffer::add
bool add(uint8_t data)
Add a byte to the current SysEx message.
Definition: SysExBuffer.cpp:16
SysExBuffer::getBuffer
const uint8_t * getBuffer() const
Get a pointer to the buffer.
Definition: SysExBuffer.cpp:33
SerialMIDI_Parser::thirdByte
bool thirdByte
Definition: SerialMIDI_Parser.hpp:28
MIDI_Parser.hpp