BOOL WINAPI MidiSuspend ( HANDLE hSequence, BOOL Synchronize );
This function suspends a playback operation, if there is one, to let the sequence to be altered then resumed normally.
TRUE if the sequence was suspended or
FALSE if not. The most likely reason for an error is an invalid sequence handle.
MidiSuspend does not silence the sequence. If you want the sequence to be silenced, call MidiSilence. After you have done all alterations to the sequence, call MidiResume to restore playback or to enable it again. Do not use MidiSuspend in situations where MidiPause would be more adequate.
The example below adds a tempo change to a sequence.
HANDLE Sequence; BRELS_MIDI_EVENT Event; // Opens the sequence MidiOpen("test1.mid", DEFAULT_DEVICE, &Sequence); // Plays MidiPlay(Sequence); // Waits 4 seconds while (MidiGet(Sequence, CURRENT_TIME)<4000000) continue; // Doubles speed MidiSuspend(Sequence, FALSE); Event.wTag = 0; Event.dwTicks = MidiGet(Sequence, CURRENT_TICKS) + 1; Event.Event = 0x51; // Tempo Event.DataSize = 3; Event.lpData = "\x03\xD0\x90"; // 0x03D090 == 250,000 (240 bpm) MidiInsertTrackEvents(Sequence, 0, 1, &Event); MidiResume(Sequence, FALSE); // Waits the end of the sequence while (MidiGet(Sequence, CURRENT_TICKS)) continue; // Finishes MidiClose(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 ()