MidiQuery

QWORD WINAPI MidiQuery
(
	HANDLE hSequence, 
	WORD wTrack, 
	DWORD dwWhat, 
	DWORD dwFrom, 
	QWORD qwValue
);

This function converts the given value from a type to another in the context of a sequence and, optionally, in the context track

Parameters

Return values

Returns the converted value or BRELS_ERROR (0xFFFFFFFFFFFFFFFF) if an error occurred. The reasons for an error are an invalid sequence, an invalid track index when one is required or invalid type constants.

Remarks

You can convert MIDI_TICKS values to MIDI_TIME and vice-versa, or convert a MIDI_FILTER value (see MidiFilterTrackEvents) to MIDI_EVENT. The following example shows those usages:

Example

HANDLE Sequence;
DWORD dwTicks;
QWORD qwTime;
BYTE Event;

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

// Ticks from time (1.5 seconds)
dwTicks = MidiQuery(Sequence, 0, MIDI_TICKS, MIDI_TIME, 1500000);

// Time from ticks (40 ticks)
qwTime = MidiQuery(Sequence, 0, MIDI_TIME, MIDI_TICKS, 40);

// Event from filter (FILTER_NOTEON)
Event = MidiQuery(Sequence, 0, MIDI_EVENT, MIDI_FILTER, FILTER_NOTEON);

// Close the sequence
MidiClose(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: breno_sarmento@hotmail.com
ICQ: 78977999 ()