MidiCreate

BOOL WINAPI MidiCreate
(
	DWORD dwDevice, 
	WORD wBeatSize, 
	LPHANDLE lphSequence
);

This function creates a new, empty MIDI sequence.

Parameters

Return values

TRUE if the sequence was created or FALSE if not. The reasons for an error are a busy midiOut device, an invalid beat size or an invalid pointer for the handle.

Remarks

Use NO_DEVICE (0xFFFFFFFE) to create a sequence not using any device. Use the smallest necessary beat size for your application. The BRELS MIDI Editor, for example, uses a beat size of 16.

The sequence created with MidiCreate is just like any other open with MidiOpen, so you must close it with MidiClose when it is not necessary anymore. After you fill the sequence with events, do playback operations normally with MidiPlay, MidiPause and MidiStop, or even MidiNext.

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