QWORD WINAPI MidiEventGet ( HANDLE hSequence, WORD wTrack, DWORD dwEvent, DWORD dwWhat );
This function retrieves information about an event in a track.
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:
Constant | Returned value |
EVENT_INDEX | DWORD value corresponding to the index of the event. Same value as the parameter dwEvent |
EVENT_TIME | QWORD value corresponding to the time of the event in microseconds |
EVENT_TICKS | DWORD value corresponding to the position of the event in ticks |
EVENT_EVENT | BYTE value corresponding to the event byte of the event. See the Event member of BRELS_MIDI_EVENT |
EVENT_DATA | Pointer to a BYTE array containing the data of the event. Use MidiFreeBuffer to deallocate this pointer later |
EVENT_DATASIZE | BYTE value corresponding to the length of the data of the event |
EVENT_TAG | WORD 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; };
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 ()