typedef struct
	DWORD dwMagic;
	DWORD dwSize;
	WORD  wFormat;
	WORD  wTracks;
	WORD  wBeatSize;

This is the MIDI header as found in a MIDI file. The header is the first 14 bytes of any MIDI file.



Due to the difference between the storage method of the file and its memory representation, the byte order of values in each member of the structure is reversed. Use btlw and btldw to correct them:


void CorrectMidiHeader(LPBRELS_MIDI_HEADER lpbmh)
	lpbmh->dwMagic = btldw(lpbmh->dwMagic);
	lpbmh->dwSize = btldw(lpbmh->dwSize);
	lpbmh->wFormat = btlw(lpbmh->wFormat);
	lpbmh->wTracks = btlw(lpbmh->wTracks);
	lpbmh->wBeatSize = btlw(lpbmh->wBeatSize);

Further information

Released in November 19th, 2003
Updated in April 29th, 2004
Property of Breno de Lima Sarmento
Home page:
E-mail: [email protected]
ICQ: 78977999 ()