Arduino MIDI File Parser
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
midi::MidiFileParser Class Reference

Midi File parser. Provide the data via write: You should try to keep the buffer as full as possible while parsing. You get the next parsing result by calling the parse() method. More...

#include <MidiFileParser.h>

Inheritance diagram for midi::MidiFileParser:
Inheritance graph
[legend]
Collaboration diagram for midi::MidiFileParser:
Collaboration graph
[legend]

Public Member Functions

bool begin (bool log=true, int bufferSize=MIDI_BUFFER_SIZE)
 Initializes & starts the processing.
 
size_t write (uint8_t c) override
 
virtual size_t write (const uint8_t *data, size_t len)
 Feed/Provide the midi data to the parser.
 
int availableForWrite ()
 Max number of bytes that we can write.
 
midi_parser_stateparse ()
 Parse data in order to provide the next midi element.
 
midi_parser_stateparseTimed ()
 
 operator bool ()
 Returns false after an error or when all data has been consumed.
 
void end ()
 Ends the processing: currently does nothing.
 
const char * midi_status_name (int status)
 Provides the string description for the midi_status value.
 
const char * midi_file_format_name (int fmt)
 Provides the string description for the file format.
 
const char * midi_meta_name (int type)
 Provides the string description for the midi_meta value.
 

Protected Member Functions

void setState (midi_parser_status state)
 
void logStatus (midi_parser_status status)
 
void reset ()
 
int midi_event_datalen (int status)
 
uint16_t midi_parse_be16 (const uint8_t *in)
 
uint32_t midi_parse_be32 (const uint8_t *in)
 
uint64_t midi_parse_N (const uint8_t *from_bytes, int len)
 
uint64_t midi_parse_variable_length (int32_t *offset)
 
enum midi_parser_status midi_parse_header ()
 
enum midi_parser_status midi_parse_track ()
 
bool midi_parse_vtime ()
 
enum midi_parser_status midi_parse_channel_event ()
 
int midi_parse_sysex_event ()
 
enum midi_parser_status midi_parse_meta_event ()
 
enum midi_parser_status midi_parse_event ()
 
enum midi_parser_status midi_parse ()
 

Protected Attributes

friend MidiFileParserMultiTrack
 
bool log_active = false
 
int write_len = 256
 
midi_parser_state parser_state
 
bool is_ok = true
 
int track_no = 0
 
midi_parser_state not_ready {MIDI_PARSER_DELAY}
 
midi_parser_state eob {MIDI_PARSER_EOB}
 

Detailed Description

Midi File parser. Provide the data via write: You should try to keep the buffer as full as possible while parsing. You get the next parsing result by calling the parse() method.

Author
Phil Schatzmann

Member Function Documentation

◆ parseTimed()

midi_parser_state& midi::MidiFileParser::parseTimed ( )
inline

Parse data in order to provide the next midi element considering the times.


The documentation for this class was generated from the following file: