HANDLE hSequence, 
	WORD wTrack, 
	DWORD dwWhat

This function retrieves information about a track.


Return values

Returns the desired data or BRELS_ERROR (0xFFFFFFFFFFFFFFFF) if an error occurred. The reasons for an error are an invalid sequence handle, an invalid track index or an invalid information constant.


The following table lists the information you can retrieve using MidiTrackGet:

ConstantReturned value
BYTE_COUNT DWORD value corresponding to the size of the encoded data of the track.
TICK_COUNT DWORD value corresponding to the length of the track in ticks
TIME_COUNT QWORD value corresponding to the length of the track in microseconds
EVENT_COUNT DWORD value informing the number of events of the track.
CURRENT_EVENTDWORD value informing the current event of the track.
TRACK_DATA Pointer to a BYTE array corresponding to the encoded data of the track. Use MidiFreeBuffer to deallocate this pointer later.
TRACK_HEADER Pointer to a BRELS_TRACK_HEADER structure corresponding to the track header. Use MidiFreeBuffer to deallocate this pointer later.
TRACK_MUTE BOOL value informing whether note events (0x9n) will be ignored (TRUE) or played normally (FALSE).
TRACK_INDEX WORD value corresponding to the track index (same value passed in the wTrack parameter).

Always make a cast to the apropriate data type when retrieving information using MidiTrackGet, like in the example below:


HANDLE Sequence;
QWORD qwLength;
DWORD dwSize;
LPBYTE lpData;
BOOL Mute;

// Open the sequence
MidiOpen("test1.mid", NO_DEVICE, &Sequence);

// Get several types of values
qwLength = (QWORD) MidiTrackGet(Sequence, 0, TIME_COUNT);
dwSize = (DWORD) MidiTrackGet(Sequence, 0, BYTE_COUNT);
lpData = (LPBYTE) MidiTrackGet(Sequence, 0, TRACK_DATA);
lpbth = (LPBRELS_TRACK_HEADER) MidiTrackGet(Sequence, 0, TRACK_HEADER);
Mute = (BOOL) MidiTrackGet(Sequence, 0, TRACK_MUTE);

// Deallocate created data

// Close the sequence

Further information

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