QWORD WINAPI MidiSet ( HANDLE hSequence, DWORD dwWhat, QWORD qwValue );
This function sets properties of a sequence.
QWORD valueReturns 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.
The following table lists the properties you can set using MidiSet:
| Constant | Property |
| BEAT_SIZE | Sets the size of a beat, in Ticks. Ranges from 1 to 65535. |
| CURRENT_TEMPO | Sets the length of a beat, in microseconds. Ranges from 1 to 16777215 |
| MIDI_HANDLE | Sets the midiOut handle used for playback. It will close the currently used device and the function will return TRUE |
| MIDI_LOOP | Sets the looping of the sequence. Set to TRUE to repeat the sequence when it ends or FALSE to not repeat |
| MIDI_PRECISION | Sets the playback timer interval, in microseconds. The minimum allowed value is 1000 |
| CALLBACK_HWND | Sets the handle of the window which will receive callback messages. Set to NULL to disable callback |
| CALLBACK_MESSAGE | Sets the callback message sent to the window. Use WM_APP+n |
| SOLO_TRACK | Sets the track that will be played exclusively. Set to NO_SOLO (0xFFFF) to allow all tracks to play again |
| CURRENT_TIME | Sets the current time position of the sequence, in microseconds |
| CURRENT_TICKS | Sets 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:
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);
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 ()