MidiEncode

BOOL WINAPI MidiEncode
(
	HANDLE hSequence, 
	LPSTR lpstrFile, 
	BOOL OverWrite
);

This function saves the sequence as a normal, compatible MIDI file.

Parameters

Return values

TRUE if the sequence was saved or FALSE if not. The reasons for an error are an invalid handle, an invalid file name or a an existing file without OverWrite set to TRUE.

Remarks

The sequence must have been open by MidiOpen or created by MidiCreate before to be encoded.

Some elements provided by the BRELS MIDI API, such as tags in the events or loopings, are not saved by MidiEncode, since they are not part of the MIDI Specification. If you need to use these features for future access, you have to turn them on again when loading the sequence with MidiOpen. Another solution is to create your own file format for a sequence project and use MidiEncode to export the final sequence.

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