MD_MIDIFile Standard MIDI File Processing 2.6
Library to play Standard MIDI Files (SMF)
MD_MIDIHelper.h File Reference

Header file for helper functions definitions. More...

+ This graph shows which files directly or indirectly include this file:

Macros

#define MTHD_HDR   "MThd"
 SMF marker.
 
#define MTHD_HDR_SIZE   4
 SMF marker length.
 
#define MTRK_HDR   "MTrk"
 SMF track header marker.
 
#define MTRK_HDR_SIZE   4
 SMF track header marker length.
 
#define BUF_SIZE(x)   (sizeof(x)/sizeof(x[0]))
 Buffer size macro.
 
#define MB_LONG   4
 readMultibyte() parameter specifying expected 4 byte value
 
#define MB_TRYTE   3
 readMultibyte() parameter specifying expected 3 byte value
 
#define MB_WORD   2
 readMultibyte() parameter specifying expected 2 byte value
 
#define MB_BYTE   1
 readMultibyte() parameter specifying expected 1 byte value
 

Functions

uint32_t readMultiByte (SDFILE *f, uint8_t nLen)
 
uint32_t readVarLen (SDFILE *f)
 
void dumpBuffer (uint8_t *p, int len)
 

Detailed Description

Header file for helper functions definitions.

Function Documentation

◆ dumpBuffer()

void dumpBuffer ( uint8_t *  p,
int  len 
)

Dump a block of data stream

During debugging, this method provides a formatted dump of data to the debug output stream.

The DUMP_DATA macro define must be set to 1 to enable this method.

Parameters
ppointer to the data buffer.
lensize of the data buffer.

◆ readMultiByte()

uint32_t readMultiByte ( SDFILE f,
uint8_t  nLen 
)

Read a multi byte value from the input stream

SMF contain numbers that are fixed length. This function reads these from the input file.

Parameters
*fpointer to SDFile object to use for reading.
nLenone of MB_LONG, MB_TRYTE, MB_WORD, MB_BYTE to specify the number of bytes to read.
Returns
the value read as a 4 byte integer. This should be cast to the expected size if required.

◆ readVarLen()

uint32_t readVarLen ( SDFILE f)

Read a variable length parameter from the input stream

SMF contain numbers that are variable length, with the last byte of the number identified with bit 7 set. This function reads these from the input file.

Parameters
*fpointer to SDFile object to use for reading.
Returns
the value read as a 4 byte integer. This should be cast to the expected size if required.