This is an old version of the documentation. View the latest version here.
Control Surface  1.0.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  MIDI_read_t parse(uint8_t midibyte);
11 
12 #if !IGNORE_SYSEX
13  SysExMessage getSysEx() 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
SysExMessage
Definition: MIDI_Parser.hpp:64
SerialMIDI_Parser::parse
MIDI_read_t parse(uint8_t midibyte)
Definition: SerialMIDI_Parser.cpp:5
MIDI_read_t
MIDI_read_t
Definition: MIDI_Parser.hpp:29
SerialMIDI_Parser::endSysEx
void endSysEx()
Definition: SerialMIDI_Parser.hpp:24
MIDI_Parser
Definition: MIDI_Parser.hpp:84
SysExBuffer.hpp
SysExBuffer::add
bool add(uint8_t data)
Add a byte to the current SysEx message.
Definition: SysExBuffer.cpp:16
SysExBuffer::getLength
size_t getLength() const
Get the length of the SysEx message in the buffer.
Definition: SysExBuffer.cpp:35
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition: NamespaceSettings.hpp:9
SysExBuffer
Definition: SysExBuffer.hpp:7
SerialMIDI_Parser
Definition: SerialMIDI_Parser.hpp:8
SerialMIDI_Parser::addSysExByte
bool addSysExByte(uint8_t data)
Definition: SerialMIDI_Parser.hpp:22
SysExBuffer::getBuffer
const uint8_t * getBuffer() const
Get a pointer to the buffer.
Definition: SysExBuffer.cpp:33
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition: NamespaceSettings.hpp:10
SysExBuffer::start
void start()
Start a new SysEx message.
Definition: SysExBuffer.cpp:5
SerialMIDI_Parser::thirdByte
bool thirdByte
Definition: SerialMIDI_Parser.hpp:28
SysExBuffer::end
void end()
Finish the current SysEx message.
Definition: SysExBuffer.cpp:11
SerialMIDI_Parser::getSysEx
SysExMessage getSysEx() const override
Get the latest SysEx message.
Definition: SerialMIDI_Parser.hpp:13
SerialMIDI_Parser::sysexbuffer
SysExBuffer sysexbuffer
Definition: SerialMIDI_Parser.hpp:20
MIDI_Parser.hpp