Nanomidi
Simple stream-based MIDI message encoder and decoder
|
Input stream for midi_decode() More...
#include <decoder.h>
Data Fields | |
size_t(* | read_cb )(struct midi_istream *stream, void *data, size_t size) |
Pointer to a user-implemented read callback. More... | |
size_t | capacity |
Stream capacity. More... | |
struct midi_message | msg |
Message data structure filled by the decoder. More... | |
struct midi_message | rtmsg |
Message data structure filled by the decoder. More... | |
struct midi_sysex_buffer | sysex_buffer |
Buffer for SysEx messages decoding. More... | |
int | bytes_left |
Number of bytes remaining to complete the current message (handled internally). More... | |
void * | param |
Optional parameter to be passed to read_cb() More... | |
Input stream for midi_decode()
Read callback read_cb() and stream capacity must be provided by the user. If SysEx decoding is required, it is necessary to provide a buffer in sysex_buffer. It is possible to use midi_istream_from_buffer() to create a stream which reads from a buffer.
size_t(* read_cb) (struct midi_istream *stream, void *data, size_t size) |
Pointer to a user-implemented read callback.
The callback should read the exact number of bytes requested.
stream | Pointer to associated midi_istream | |
[out] | data | Data read |
size | Number of bytes to be read |
size_t capacity |
Stream capacity.
Function midi_decode() will not read more than capacity
bytes from the stream unless midi_istream.capacity is set to MIDI_STREAM_CAPACITY_UNLIMITED.
struct midi_message msg |
Message data structure filled by the decoder.
Once a message is decoded, midi_decode() returns pointer to midi_istream.msg.
struct midi_message rtmsg |
Message data structure filled by the decoder.
Once a System Real Time Message is decoded, midi_decode() returns pointer to midi_istream.rtmsg.
struct midi_sysex_buffer sysex_buffer |
Buffer for SysEx messages decoding.
int bytes_left |
Number of bytes remaining to complete the current message (handled internally).
void* param |
Optional parameter to be passed to read_cb()