MidiSet

QWORD WINAPI MidiSet
(
	HANDLE hSequence, 
	DWORD dwWhat, 
	QWORD qwValue
);

This function sets properties of a sequence.

Parameters

Return values

Returns the previous value of the property or TRUE if the value is not valid anymore. It returns BRELS_ERROR (0xFFFFFFFFFFFFFFFF) if an error occurred. The reasons for an error are an invalid sequence handle, an invalid property constant or an invalid property value.

Remarks

The following table lists the properties you can set using MidiSet:

ConstantProperty
BEAT_SIZESets the size of a beat, in Ticks. Ranges from 1 to 65535.
CURRENT_TEMPOSets the length of a beat, in microseconds. Ranges from 1 to 16777215
MIDI_HANDLESets the midiOut handle used for playback. It will close the currently used device and the function will return TRUE
MIDI_LOOPSets the looping of the sequence. Set to TRUE to repeat the sequence when it ends or FALSE to not repeat
MIDI_PRECISIONSets the playback timer interval, in microseconds. The minimum allowed value is 1000
CALLBACK_HWNDSets the handle of the window which will receive callback messages. Set to NULL to disable callback
CALLBACK_MESSAGESets the callback message sent to the window. Use WM_APP+n
SOLO_TRACKSets the track that will be played exclusively. Set to NO_SOLO (0xFFFF) to allow all tracks to play again
CURRENT_TIMESets the current time position of the sequence, in microseconds
CURRENT_TICKSSets the current tick position of the sequence

Always make the apropriate cast from and to QWORD values when using MidiSet.

The example below sets several properties of a sequence:

Example

HANDLE Sequence;
QWORD qwLength;

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

// Double the size of the notes
MidiSet(Sequence, BEAT_SIZE, 8);

// Turn looping on
MidiSet(Sequence, MIDI_LOOP, TRUE);

// Go to the half of the sequence
qwLength = MidiGet(Sequence, TIME_COUNT);
MidiSet(Sequence, CURRENT_TIME, qwLength / 2);

// Twice faster
MidiSet(Sequence, CURRENT_TEMPO, 250000);

// Play the sequence
MidiPlay(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 ()