MidiRemoveTrackEvents

DWORD WINAPI MidiRemoveTrackEvents
(
	HANDLE hSequence, 
	WORD wTrack, 
	QWORD qwFirst, 
	QWORD qwLast, 
	DWORD dwFormat
);

This function removes the events inside the specified range from a track.

Parameters

Return values

Returns the new number of events of the sequence or zero if an error occurred. The reasons for an error are an invalid sequence handle, an invalid track index or an invalid event range or range format.

Remarks

MidiRemoveTrackEvents may be slow. Try to reduce its utilization. The example below shows two ways of truncating a track:

Example

HANDLE Sequence;

// Slower method
MidiOpen("test1.mid", NO_DEVICE, &Sequence);
MidiRemoveTrackEvents(Sequence, 0, 0, MidiTrackGet(Sequence, 0, EVENT_COUNT)-1, MIDI_INDEX);
MidiClose(Sequence);

// Faster method
MidiOpen("test1.mid", NO_DEVICE, &Sequence);
MidiRemoveTrack(Sequence, 0);
MidiInsertTrack(Sequence, 0);
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 ()