HANDLE hSequence, 
	WORD wTrack, 
	DWORD dwEvent, 
	DWORD dwWhat

This function retrieves information about an event in 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 or event index, or an invalid information constant.


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

ConstantReturned value
EVENT_INDEXDWORD value corresponding to the index of the event. Same value as the parameter dwEvent
EVENT_TIMEQWORD value corresponding to the time of the event in microseconds
EVENT_TICKSDWORD value corresponding to the position of the event in ticks
EVENT_EVENTBYTE value corresponding to the event byte of the event. See the Event member of BRELS_MIDI_EVENT
EVENT_DATAPointer to a BYTE array containing the data of the event. Use MidiFreeBuffer to deallocate this pointer later
EVENT_DATASIZEBYTE value corresponding to the length of the data of the event
EVENT_TAGWORD value corresponding to the user-defined tag of the event

Always make a cast to the apropriate data type when retrieving information using MidiEventGet. In the example below, the function returns the number of events of a specified type in the track:


DWORD EventCount(HANDLE Sequence, WORD wTrack, BYTE SearchEvent)
	BYTE Event;
	DWORD i, nEvents, Count;

	Count = 0;
	nEvents = (DWORD) MidiTrackGet(Sequence, wTrack, EVENT_COUNT);

	for (i = 0; i < nEvents; i++)
		Event = (BYTE) MidiEventGet(Sequence, wTrack, i, EVENT_EVENT);
		if (Event==SearchEvent) Count++;
	return Count;

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 ()