Results 1 to 2 of 2

Thread: MIDIs in VB

  1. #1
    Guest

    Post

    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!

  2. #2
    Lively Member
    Join Date
    Jun 1999
    Location
    Ireland
    Posts
    96

    Post

    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).]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width