Go to the source code of this file.
|
enum | midiEventType_t { MIDI_EVENT
, META_EVENT
, SYSEX_EVENT
} |
| The possible sub-types of MIDI events. More...
|
|
enum | metaEventType_t {
SEQUENCE_NUMBER = 0x00
, TEXT = 0x01
, COPYRIGHT = 0x02
, SEQUENCE_OR_TRACK_NAME = 0x03
,
INSTRUMENT_NAME = 0x04
, LYRIC = 0x05
, MARKER = 0x06
, CUE_POINT = 0x07
,
CHANNEL_PREFIX = 0x20
, PORT_PREFIX = 0x21
, END_OF_TRACK = 0x2F
, TEMPO = 0x51
,
SMPTE_OFFSET = 0x54
, TIME_SIGNATURE = 0x58
, KEY_SIGNATURE = 0x59
, PROPRIETARY = 0x7F
} |
| The possible types of meta-events. More...
|
|
enum | midiFileFormat_t { MIDI_FORMAT_0 = 0
, MIDI_FORMAT_1 = 1
, MIDI_FORMAT_2 = 2
} |
| The MIDI file format, which determines how to interpret the track or tracks it contains. More...
|
|
◆ midiTrack_t
Data Fields |
uint32_t |
length |
Total chunk length. |
uint8_t * |
data |
Pointer to the start of this chunk's data. |
◆ midiFile_t
Data Fields |
uint8_t * |
data |
A pointer to the start of the MIDI file. |
uint32_t |
length |
The total length of the MIDI file. |
midiFileFormat_t |
format |
The MIDI file format which defines how this file's tracks are interpreted. |
uint16_t |
timeDivision |
The time division of MIDI frames, either ticks per frame or ticks per quarter note. |
uint16_t |
trackCount |
The number of tracks in this file. |
midiTrack_t * |
tracks |
An array of MIDI tracks. |
◆ midiFileReader_t
Data Fields |
const midiFile_t * |
file |
A pointer to the MIDI file currently loaded into the reader, if any. |
bool |
handleMetaEvents |
If true, text meta-events will be handled and sent to the MIDI player. |
uint16_t |
division |
The number of divisions per midi tick. |
uint8_t |
stateCount |
The number of track states allocated. |
midiTrackState_t * |
states |
An array containing the internal parser state for each track. |
◆ midiStatusEvent_t
Data Fields |
uint8_t |
status |
The MIDI status byte. |
uint8_t |
data[2] |
The data bytes of the MIDI status event. The meaning of these bytes depends on the status value. |
◆ midiTimeSignature_t
struct midiTimeSignature_t |
Data Fields |
uint8_t |
numerator |
The numerator of the time signature. |
uint8_t |
denominator |
The power of two of the time signature denominator (e.g. 2 for 4/4, 3 for 4/8) |
uint8_t |
midiClocksPerMetronomeTick |
The number of MIDI clocks per metronome tick. |
uint8_t |
num32ndNotesPerBeat |
Number of 32nd notes per 24 MIDI clocks (= 1 beat) |
◆ midiMetaEvent_t
◆ midiSysexEvent_t
Data Fields |
uint16_t |
manufacturerId |
The manufacturer ID embedded in the SysEx event. - Note
- When this is a single-byte manufacturer ID, the most-significant bit (15) will be set
|
uint32_t |
length |
The length of the data contained in this SysEx event. |
uint8_t |
prefix |
A byte to prefix to the actual data, if non-zero. |
const uint8_t * |
data |
A pointer to the data for this SysEx event. |
◆ midiEvent_t
Data Fields |
uint32_t |
deltaTime |
The time between this event and the previous event. |
uint32_t |
absTime |
The absolute timestamp of this event in ticks. |
midiEventType_t |
type |
The overall event type – MIDI, Meta, or SysEx. |
uint8_t |
track |
The index of the track which contains this event. |
union midiEvent_t.__unnamed5__ |
__unnamed__ |
|
◆ midiMetaEvent_t.__unnamed1__
union midiMetaEvent_t.__unnamed1__ |
◆ midiMetaEvent_t.__unnamed1__.startTime
struct midiMetaEvent_t.__unnamed1__.startTime |
Data Fields |
uint8_t |
hour |
|
uint8_t |
min |
|
uint8_t |
sec |
|
uint8_t |
frame |
|
uint8_t |
frameHundredths |
|
◆ midiMetaEvent_t.__unnamed1__.keySignature
struct midiMetaEvent_t.__unnamed1__.keySignature |
Data Fields |
uint8_t |
flats |
The number of flats in the key. |
uint8_t |
sharps |
The number of sharps in the key. |
bool |
minor |
True for a minor key, false for a major key. |
◆ midiEvent_t.__unnamed5__
union midiEvent_t.__unnamed5__ |
◆ midiTrackState_t
◆ midiEventType_t
The possible sub-types of MIDI events.
Enumerator |
---|
MIDI_EVENT | A normal MIDI status event, such as note on or off.
|
META_EVENT | A non-MIDI meta-event from a MIDI file, such as tempo or lyrics.
|
SYSEX_EVENT | A system-exclusive MIDI event.
|
◆ metaEventType_t
The possible types of meta-events.
Enumerator |
---|
SEQUENCE_NUMBER | |
TEXT | |
COPYRIGHT | |
SEQUENCE_OR_TRACK_NAME | |
INSTRUMENT_NAME | |
LYRIC | |
MARKER | |
CUE_POINT | |
CHANNEL_PREFIX | |
PORT_PREFIX | |
END_OF_TRACK | |
TEMPO | |
SMPTE_OFFSET | |
TIME_SIGNATURE | |
KEY_SIGNATURE | |
PROPRIETARY | |
◆ midiFileFormat_t
The MIDI file format, which determines how to interpret the track or tracks it contains.
Enumerator |
---|
MIDI_FORMAT_0 | One track only containing all MIDI data for any number of channels.
|
MIDI_FORMAT_1 | Multiple MIDI tracks, played simultaneously.
|
MIDI_FORMAT_2 | Multiple MIDI tracks, played sequentially.
|
◆ loadMidiFile()
bool loadMidiFile |
( |
const char * | name, |
|
|
midiFile_t * | file, |
|
|
bool | spiRam ) |
Load a MIDI file from the filesystem.
- Parameters
-
file | A pointer to a midiFile_t struct to load the file into |
name | The name of the MIDI file to load |
spiRam | Whether to load the MIDI file into SPIRAM |
- Returns
- true If the load succeeded
-
false If the load failed
◆ unloadMidiFile()
Free the data associated with the given MIDI file.
- Parameters
-
file | A pointer to the MIDI file to be unloaded |
◆ initMidiParser()
Initialize or reset the MIDI file reader with a particular file.
- Parameters
-
reader | A pointer to the MIDI file reader to initialize |
file | A pointer to the MIDI file to load |
- Returns
- true if the MIDI file reader was initialized
-
false if an error occurred while allocating data for the MIDI file reader
◆ midiParserSetFile()
Set a new file for the MIDI file reader. The reader's state will be reset.
- Parameters
-
reader | A pointer to the MIDI file reader to set the file of |
file | A pointer to the MIDI file to load |
◆ resetMidiParser()
Reset the state of the MIDI parser without deinitializing it or changing the file.
The next event returned from this MIDI parser will be the first event in the file again.
- Parameters
-
reader | A pointer to the MIDI file reader to reset |
◆ deinitMidiParser()
Deinitialize the MIDI file reader and free any memory it has allocated.
- Parameters
-
reader | The MIDI file reader to deinitialize |
◆ midiNextEventTime()
Return the start time of the next event in the MIDI file being read.
- Parameters
-
reader | The reader to check |
- Returns
- uint32_t The timestamp of the next event, or UINT32_MAX if there is none
◆ midiNextEvent()
Process and retrieve the next MIDI event in the file.
- Parameters
-
reader | The reader to read the event from |
event | A pointer to a MIDI event to be updated with the next event |
- Returns
- true If event data was written to event
-
false If there are no more events in this file or there was a fatal parse error
◆ midiWriteEvent()
int midiWriteEvent |
( |
uint8_t * | out, |
|
|
int | max, |
|
|
const midiEvent_t * | event ) |
Writes a MIDI event to a byte buffer.
- Parameters
-
out | The byte array |
max | The maximum number of bytes to write |
event | The event to write |
- Returns
- int The number of bytes written