176 uint16_t sequenceNumber;
188 uint8_t frameHundredths;
Contains all track-specific parsing state.
Definition midiFileParser.c:25
void midiParserSetFile(midiFileReader_t *reader, const midiFile_t *file)
Set a new file for the MIDI file reader. The reader's state will be reset.
Definition midiFileParser.c:888
midiTrackState_t * states
An array containing the internal parser state for each track.
Definition midiFileParser.h:121
uint32_t deltaTime
The time between this event and the previous event.
Definition midiFileParser.h:235
uint8_t midiClocksPerMetronomeTick
The number of MIDI clocks per metronome tick.
Definition midiFileParser.h:147
midiTrack_t * tracks
An array of MIDI tracks.
Definition midiFileParser.h:101
midiFileFormat_t format
The MIDI file format which defines how this file's tracks are interpreted.
Definition midiFileParser.h:92
metaEventType_t type
The type of this MIDI meta-event.
Definition midiFileParser.h:158
midiFileFormat_t
The MIDI file format, which determines how to interpret the track or tracks it contains.
Definition midiFileParser.h:55
@ MIDI_FORMAT_0
One track only containing all MIDI data for any number of channels.
Definition midiFileParser.h:57
@ MIDI_FORMAT_2
Multiple MIDI tracks, played sequentially.
Definition midiFileParser.h:61
@ MIDI_FORMAT_1
Multiple MIDI tracks, played simultaneously.
Definition midiFileParser.h:59
uint8_t num32ndNotesPerBeat
Number of 32nd notes per 24 MIDI clocks (= 1 beat)
Definition midiFileParser.h:149
int midiWriteEvent(uint8_t *out, int max, const midiEvent_t *event)
Writes a MIDI event to a byte buffer.
Definition midiFileParser.c:1073
const uint8_t * data
A pointer to the data for this SysEx event.
Definition midiFileParser.h:226
midiEventType_t
The possible sub-types of MIDI events.
Definition midiFileParser.h:18
@ META_EVENT
A non-MIDI meta-event from a MIDI file, such as tempo or lyrics.
Definition midiFileParser.h:22
@ MIDI_EVENT
A normal MIDI status event, such as note on or off.
Definition midiFileParser.h:20
@ SYSEX_EVENT
A system-exclusive MIDI event.
Definition midiFileParser.h:24
uint8_t stateCount
The number of track states allocated.
Definition midiFileParser.h:118
void resetMidiParser(midiFileReader_t *reader)
Reset the state of the MIDI parser without deinitializing it or changing the file.
Definition midiFileParser.c:912
uint8_t denominator
The power of two of the time signature denominator (e.g. 2 for 4/4, 3 for 4/8)
Definition midiFileParser.h:145
bool midiNextEvent(midiFileReader_t *reader, midiEvent_t *event)
Process and retrieve the next MIDI event in the file.
Definition midiFileParser.c:953
uint16_t timeDivision
The time division of MIDI frames, either ticks per frame or ticks per quarter note.
Definition midiFileParser.h:95
metaEventType_t
The possible types of meta-events.
Definition midiFileParser.h:31
@ TIME_SIGNATURE
Definition midiFileParser.h:48
@ SEQUENCE_NUMBER
Definition midiFileParser.h:32
@ KEY_SIGNATURE
Definition midiFileParser.h:49
@ LYRIC
Definition midiFileParser.h:37
@ MARKER
Definition midiFileParser.h:38
@ PORT_PREFIX
Definition midiFileParser.h:44
@ CUE_POINT
Definition midiFileParser.h:39
@ SEQUENCE_OR_TRACK_NAME
Definition midiFileParser.h:35
@ TEXT
Definition midiFileParser.h:33
@ COPYRIGHT
Definition midiFileParser.h:34
@ CHANNEL_PREFIX
Definition midiFileParser.h:43
@ INSTRUMENT_NAME
Definition midiFileParser.h:36
@ PROPRIETARY
Definition midiFileParser.h:50
@ SMPTE_OFFSET
Definition midiFileParser.h:47
@ TEMPO
Definition midiFileParser.h:46
@ END_OF_TRACK
Definition midiFileParser.h:45
uint16_t trackCount
The number of tracks in this file.
Definition midiFileParser.h:98
const midiFile_t * file
A pointer to the MIDI file currently loaded into the reader, if any.
Definition midiFileParser.h:109
void deinitMidiParser(midiFileReader_t *reader)
Deinitialize the MIDI file reader and free any memory it has allocated.
Definition midiFileParser.c:939
uint8_t track
The index of the track which contains this event.
Definition midiFileParser.h:244
uint8_t numerator
The numerator of the time signature.
Definition midiFileParser.h:143
uint8_t * data
Pointer to the start of this chunk's data.
Definition midiFileParser.h:77
void unloadMidiFile(midiFile_t *file)
Free the data associated with the given MIDI file.
Definition midiFileParser.c:865
uint32_t absTime
The absolute timestamp of this event in ticks.
Definition midiFileParser.h:238
uint8_t prefix
A byte to prefix to the actual data, if non-zero.
Definition midiFileParser.h:223
bool loadMidiFile(const char *name, midiFile_t *file, bool spiRam)
Load a MIDI file from the filesystem.
Definition midiFileParser.c:794
uint8_t status
The MIDI status byte.
Definition midiFileParser.h:130
midiEventType_t type
The overall event type – MIDI, Meta, or SysEx.
Definition midiFileParser.h:241
uint32_t length
Total chunk length.
Definition midiFileParser.h:74
uint16_t manufacturerId
The manufacturer ID embedded in the SysEx event.
Definition midiFileParser.h:217
bool handleMetaEvents
If true, text meta-events will be handled and sent to the MIDI player.
Definition midiFileParser.h:112
bool initMidiParser(midiFileReader_t *reader, const midiFile_t *file)
Initialize or reset the MIDI file reader with a particular file.
Definition midiFileParser.c:872
uint32_t midiNextEventTime(midiFileReader_t *reader)
Return the start time of the next event in the MIDI file being read.
uint16_t division
The number of divisions per midi tick.
Definition midiFileParser.h:115
Contains information for an entire MIDI event or non-MIDI meta-event.
Definition midiFileParser.h:233
Definition midiFileParser.h:107
Contains information which applies to the entire MIDI file.
Definition midiFileParser.h:84
Data for a normal MIDI status event.
Definition midiFileParser.h:128
Contains information for a MIDI System Exclusive event.
Definition midiFileParser.h:214
Data for a MIDI time signature definition.
Definition midiFileParser.h:141
Contains basic information pointing to a MIDI track within its file data.
Definition midiFileParser.h:72