Functions

sysex_tools.h File Reference

Sysex utility functions. More...

#include <inttypes.h>

Go to the source code of this file.

Functions

uint16_t sysex_encoded_length (uint16_t decoded_length)
 Compute the length of a message after it is encoded.
uint16_t sysex_decoded_length (uint16_t encoded_length)
 Compute the length of a message after it is decoded.
uint16_t sysex_encode (uint8_t *encoded, const uint8_t *source, uint16_t length)
 Encode data so that it can be transmitted safely in a sysex message.
uint16_t sysex_decode (uint8_t *decoded, const uint8_t *source, uint16_t length)
 Decode encoded data.

Detailed Description

Sysex utility functions.

These functions are for converting data to and from a "midi-safe" format, which can be use to send data with sysex messages. Sysex messages may only contain data where the to bit is not set.

An "encoded" midi message is one that contains all of the data from its original state, but does not have any of the top bits set.

Every 7 bytes of decoded data is converted into 8 bytes of encoded data and visa-versa. If you'd like to operate on small segments, make sure that you encode in 7 byte increments and decode in 8 byte increments.