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

Midi file parser which stores the data in RAM before making them available for parsing. Please note that this class might need a considerable amount of ram so you might consider to activate the PSRAM. Make sure that you complete all write() calls before starting to call parse() or parseTimed()! More...

#include <MidiFileParserMultiTrack.h>

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

Public Member Functions

bool begin (bool log=true, int bufferSize=MIDI_BUFFER_SIZE)
 Initializes & starts the processing.
 
void restart ()
 Call this method to restart the parsing with the available data.
 
size_t write (uint8_t c) override
 Single character write.
 
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.
 
int trackCount ()
 Returns the number of recorded tracks.
 
midi_parser_stateparse ()
 Provide the next midi element.
 
midi_parser_stateparseTimed ()
 Provide the next midi element considering the times.
 
 operator bool ()
 Returns true as long as we have data to be written or parsed.
 
bool isEmpty ()
 Returns true if there are no midi events.
 
size_t size ()
 Returns the number of available midi events (after writing)
 
void end ()
 Ends the processing: releases all memory.
 
void endWrite ()
 
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 parse (int limit)
 
void addEvent (midi_parser_state &state)
 Adds an new midi event with the corresponding time.
 
midi_time_eventparseTimeEvent ()
 Provide the next midi element using the iterators.
 

Protected Attributes

MidiFileParser parser
 
multichannel_segment_tracks data
 
midi_parser_state parser_state
 
midi_parser_state not_ready {MIDI_PARSER_DELAY}
 
midi_parser_state eob {MIDI_PARSER_EOB}
 
midi_time_eventp_current_state = nullptr
 
uint64_t start_time = 0l
 
bool is_iterators_available = false
 

Detailed Description

Midi file parser which stores the data in RAM before making them available for parsing. Please note that this class might need a considerable amount of ram so you might consider to activate the PSRAM. Make sure that you complete all write() calls before starting to call parse() or parseTimed()!

Author
Phil Schatzmann

Member Function Documentation

◆ endWrite()

void midi::MidiFileParserMultiTrack::endWrite ( )
inline

Marks that we are done with writing the data to prepare for parse() and parseTimed() calls.


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