Three short questions about MIDIs in VB:
1) How to play/stop/pause a MIDI in VB? (an example or link to one would be nice if possible)
2) How to play more than one MIDI at the same time?
3) How to detect if a MIDI has stopped playing? (to start it again so it repeats)
Any help is appreciated and, of cource, welcome!
SteveS
Nov 3rd, 1999, 07:49 AM
1. How to play a Midi.
Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Dim Result as Long
Result = mciSendString("close all", 0&, 0, 0)
Result = mciSendString("open MidiFile.mid type sequencer alias MyMidi", 0&, 0, 0)
Result = mciSendString("play MyMidi", 0&, 0, 0)
2. Playing more than 1 Midi at a time, I don't think that is possible, but you can play a wav file at the same time.
For playing multiple files at the same time find a DirectX Ocx that allows sound buffering.
3. Well the way I did it, and I doubt it's the best way, is to find the length of the midi file, increment a counter while it's playing and when the counter is > file length then start it again.
Hope this helps,
Steve.
[This message has been edited by SteveS (edited 11-03-1999).]