|
Swadge ESP32-S2
APIs to develop for the Magfest Swadge
|
Go to the source code of this file.
Data Structures | |
| struct | midiTrack_t |
| Contains basic information pointing to a MIDI track within its file data. More... | |
| struct | midiFile_t |
| Contains information which applies to the entire MIDI file. More... | |
| struct | midiFileReader_t |
| struct | midiStatusEvent_t |
| Data for a normal MIDI status event. More... | |
| struct | midiTimeSignature_t |
| Data for a MIDI time signature definition. More... | |
| struct | midiMetaEvent_t |
| Contains information for a non-MIDI meta-event from a MIDI file. More... | |
| struct | midiSysexEvent_t |
| Contains information for a MIDI System Exclusive event. More... | |
| struct | midiEvent_t |
| Contains information for an entire MIDI event or non-MIDI meta-event. More... | |
| union | midiMetaEvent_t.__unnamed0__ |
| struct | midiMetaEvent_t.__unnamed0__.startTime |
| Contains the start time of this track, when type is SMPTE_OFFSET. More... | |
| struct | midiMetaEvent_t.__unnamed0__.keySignature |
| Contains key signature data, when type is KEY_SIGNATURE. More... | |
| union | midiEvent_t.__unnamed0__ |
Typedefs | |
| typedef struct midiTrackState | midiTrackState_t |
Enumerations | |
| 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... | |
Functions | |
| bool | loadMidiData (uint8_t *data, size_t size, midiFile_t *file) |
| Load a MIDI file from raw data, without copying it. | |
| bool | loadMidiFile (cnfsFileIdx_t fIdx, midiFile_t *file, bool spiRam) |
| Load a MIDI file from the filesystem. | |
| void | unloadMidiFile (midiFile_t *file) |
| Free the data associated with the given MIDI file. | |
| bool | initMidiParser (midiFileReader_t *reader, const midiFile_t *file) |
| Initialize or reset the MIDI file reader with a particular file. | |
| 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. | |
| void | resetMidiParser (midiFileReader_t *reader) |
| Reset the state of the MIDI parser without deinitializing it or changing the file. | |
| void | deinitMidiParser (midiFileReader_t *reader) |
| Deinitialize the MIDI file reader and free any memory it has allocated. | |
| uint32_t | midiNextEventTime (midiFileReader_t *reader) |
| Return the start time of the next event in the MIDI file being read. | |
| bool | midiNextEvent (midiFileReader_t *reader, midiEvent_t *event) |
| Process and retrieve the next MIDI event in the file. | |
| int | midiWriteEvent (uint8_t *out, int max, const midiEvent_t *event) |
| Writes a MIDI event to a byte buffer. | |
| struct midiTrack_t |
| struct 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. |
| struct 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. |
| struct midiStatusEvent_t |
| struct midiTimeSignature_t |
| struct midiSysexEvent_t |
| struct midiMetaEvent_t.__unnamed0__.startTime |
| struct midiMetaEvent_t.__unnamed0__.keySignature |
| union midiEvent_t.__unnamed0__ |
| Data Fields | ||
|---|---|---|
| midiStatusEvent_t | midi | The MIDI status event data, when type is MIDI_EVENT. |
| midiMetaEvent_t | meta | The non-MIDI meta-event data, when type is META_EVENT. |
| midiSysexEvent_t | sysex | The MIDI System Exclusive event data, when type is SYSEX_EVENT. |
| typedef struct midiTrackState midiTrackState_t |
| enum midiEventType_t |
| enum metaEventType_t |
| enum midiFileFormat_t |
| bool loadMidiData | ( | uint8_t * | data, |
| size_t | size, | ||
| midiFile_t * | file ) |
Load a MIDI file from raw data, without copying it.
| data | The raw data for the MIDI file, uncompressed |
| size | The length of the MIDI data in bytes |
| file | A pointer to a midiFile_t struct to load the data into |
| bool loadMidiFile | ( | cnfsFileIdx_t | fIdx, |
| midiFile_t * | file, | ||
| bool | spiRam ) |
Load a MIDI file from the filesystem.
| file | A pointer to a midiFile_t struct to load the file into |
| fIdx | The cnfsFileIdx_t of the MIDI file to load |
| spiRam | Whether to load the MIDI file into SPIRAM |
| void unloadMidiFile | ( | midiFile_t * | file | ) |
Free the data associated with the given MIDI file.
| file | A pointer to the MIDI file to be unloaded |
| bool initMidiParser | ( | midiFileReader_t * | reader, |
| const midiFile_t * | file ) |
Initialize or reset the MIDI file reader with a particular file.
| reader | A pointer to the MIDI file reader to initialize |
| file | A pointer to the MIDI file to load |
| 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.
| reader | A pointer to the MIDI file reader to set the file of |
| file | A pointer to the MIDI file to load |
| void resetMidiParser | ( | midiFileReader_t * | reader | ) |
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.
| reader | A pointer to the MIDI file reader to reset |
| void deinitMidiParser | ( | midiFileReader_t * | reader | ) |
Deinitialize the MIDI file reader and free any memory it has allocated.
| reader | The MIDI file reader to deinitialize |
| uint32_t midiNextEventTime | ( | midiFileReader_t * | reader | ) |
Return the start time of the next event in the MIDI file being read.
| reader | The reader to check |
| bool midiNextEvent | ( | midiFileReader_t * | reader, |
| midiEvent_t * | event ) |
Process and retrieve the next MIDI event in the file.
| reader | The reader to read the event from |
| event | A pointer to a MIDI event to be updated with the next event |
| int midiWriteEvent | ( | uint8_t * | out, |
| int | max, | ||
| const midiEvent_t * | event ) |
Writes a MIDI event to a byte buffer.
| out | The byte array |
| max | The maximum number of bytes to write |
| event | The event to write |