|
Nanomidi
Simple stream-based MIDI message encoder and decoder
|
MIDI message decoder. More...
Data Structures | |
| struct | midi_sysex_buffer |
| Buffer for SysEx messages decoding. More... | |
| struct | midi_istream |
| Input stream for midi_decode() More... | |
Functions | |
| struct midi_message * | midi_decode (struct midi_istream *stream) |
| Decodes a single MIDI message. More... | |
| struct midi_message * | midi_decode_usb (struct midi_istream *stream, uint8_t *cable_number) |
| Decodes a single MIDI message from USB packet. More... | |
| void | midi_istream_from_buffer (struct midi_istream *stream, const void *buffer, size_t size) |
| Creates an input stream which reads from a buffer. More... | |
MIDI message decoder.
| struct midi_message * midi_decode | ( | struct midi_istream * | stream | ) |
Decodes a single MIDI message.
If a message is decoded, it has to be processed (e.g. copied) immediately as it will become invalid with the next call to midi_decode().
| stream | Pointer to the midi_istream structure |
NULL if the message has not been decoded yet. | struct midi_message * midi_decode_usb | ( | struct midi_istream * | stream, |
| uint8_t * | cable_number | ||
| ) |
Decodes a single MIDI message from USB packet.
The packet format is described in Universal Serial Bus Device Class Definition for MIDI Devices.
If a message is decoded, it has to be processed (e.g. copied) immediately as it will become invalid with the next call to midi_decode().
| stream | Pointer to the midi_istream structure | |
| [out] | cable_number | Decoded cable number (0 to 15) |
NULL if the message has not been decoded yet. | void midi_istream_from_buffer | ( | struct midi_istream * | stream, |
| const void * | buffer, | ||
| size_t | size | ||
| ) |
Creates an input stream which reads from a buffer.
The input stream can be used to read a finite number of bytes from a pre-allocated buffer. It can be also used to decode a single message if the function is called right before midi_decode().
| stream | Pointer to the midi_istream structure to be initialized | |
| [in] | buffer | Pointer to the buffer to be read from |
| size | Buffer size (in bytes) |