MidiInsertTrack

BOOL WINAPI MidiInsertTrack
(
	HANDLE hSequence, 
	WORD wTrack
);

This function inserts a blank track in the specified position of a sequence.

Parameters

Return values

TRUE if a track was inserted or FALSE if not. The reasons for an error are an invalid sequence handle or an invalid track index.

Remarks

The sequence must have been open by MidiOpen or created by MidiCreate before you insert tracks in it.

If you insert a track after the last track in the sequence, you will append a track. Use MidiGet(Sequence, TRACK_COUNT) as the index number to do that.

Example

HANDLE Sequence;

// Creates the sequence
MidiCreate(DEFAULT_DEVICE, 16, &Sequence);

// Appends a track
MidiInsertTrack(Sequence, MidiGet(Sequence, TRACK_COUNT));

// Saves the sequence
MidiEncode(Sequence, "test2.mid", TRUE);

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