MidiGet

QWORD WINAPI MidiGet
(
	HANDLE hSequence, 
	DWORD dwWhat
);

This function retrieves sequence specific information.

Parameters

Return values

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

Remarks

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

ConstantReturned value
BEAT_SIZE WORD value informing the number of ticks in a beat or quarter note
SOLO_TRACK WORD value informing the current solo track or NO_SOLO (0xFFFF) if there is none
TICK_INTERVAL QWORD value informing the number of microseconds per tick
SKIP_INTERVAL QWORD value informing how many microseconds were skipped in order to keep the sequence playing correctly
BYTE_COUNT DWORD value corresponding to the size in bytes of the sequence when encoded
TICK_COUNT DWORD value corresponding to the length in ticks of the sequence
TIME_COUNT QWORD value corresponding to the length in microseconds of the sequence
EVENT_COUNT DWORD value informing the number of events in the sequence
TRACK_COUNT WORD value informing the number of tracks of the sequence
CURRENT_TIME QWORD value corresponding to the sequence's current time position in microseconds
CURRENT_TICKS DWORD value corresponding to the current tick position of the sequence
CURRENT_TEMPO QWORD value corresponding to the current tempo (in microseconds per beat)
CALLBACK_HWND HWND value informing the window which will receive callback messages
CALLBACK_MESSAGE UINT value corresponding to the message sent to the callback window
CALLBACK_PROCESSED BOOL value indicating whether a previously sent callback message was processed and another is allowed to be sent
MIDI_DEVICE DWORD value corresponding to the ID of the midiOut device used by the sequence
MIDI_HANDLE HMIDIOUT value correspoding to the midiOut handle used by the sequence
MIDI_HEADER Pointer to a BRELS_MIDI_HEADER structure corresponding to the MIDI header in the encoded sequence. Use MidiFreeBuffer to deallocate this pointer later.
MIDI_LOOP BOOL value indicating if the sequence will restart playing when playback finishes
MIDI_PRECISION QWORD value indicating the number of microseconds in the multimedia timer used for playback.
MIDI_STATUS DWORD value indicating the current status of the sequence: MIDI_BUSY, MIDI_STOP, MIDI_PAUSE or MIDI_PLAY
MIDI_DONE BOOL value indicating whether the sequence is doing a playback operation (FALSE) or is waiting until it is time to play the next event (TRUE)

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

Example

HANDLE Sequence;
WORD wBeatSize;
DWORD dwTicks;
QWORD qwTime;
HWND window;
UINT uMsg;
HANDLE hmo;
BOOL looping;
LPBRELS_MIDI_HEADER lpbmh;

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

// Get several types of values
wBeatSize = (WORD) MidiGet(Sequence, BEAT_SIZE);
dwTicks = (DWORD) MidiGet(Sequence, CURRENT_TICKS);
qwTime = (QWORD) MidiGet(Sequence, CURRENT_TIME);
window = (HWND) MidiGet(Sequence, CALLBACK_HWND);
uMsg = (UINT) MidiGet(Sequence, CALLBACK_MESSAGE);
hmo = (HMIDIOUT) MidiGet(Sequence, MIDI_HANDLE);
looping = (BOOL) MidiGet(Sequence, MIDI_LOOP);
lpbmh = (LPBRELS_MIDI_HEADER) MidiGet(Sequence, MIDI_HEADER);

// Free the allocated data
MidiFreeBuffer(lpbmh);

// 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: [email protected]
ICQ: 78977999 ()