Results 1 to 3 of 3

Thread: Is there a way to play MIDI files without MMControl?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516

    Unhappy

    I've looked almost everywhere, but all the API calls (PlaySound etc) sem to be geared towards *.wav files. So how do I play a MIDI with the API? Do I HAVE to use MMControl?
    Courgettes.

  2. #2
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    I expect you could do that using DirectMusic. I have no experience of using DirectX but a lot of the regulars of the games forum do, so maybe it would be a good idea to post ther too. KENNNY posted a good link the other day for tutorials on games-related VB programming, and there was quite a bit on DirectX there. The link was in a post titled 'im a beginner' in the games and graphics forum, I can't remember it now.
    Harry.

    "From one thing, know ten thousand things."

  3. #3
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604

    Playing MIDI without MM

    The code looks like this:

    In your General Declarations:
    Private 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
    (all of the above is one really long line)

    In the sub where the MIDI will be launched:

    'ret = mciSendString("open PATHNAME type sequencer alias myfile", 0&, 0, 0)
    ret = mciSendString("play myfile wait", 0&, 0, 0)
    ret = mciSendString("close myfile", 0&, 0, 0)
    (where I typed PATHNAME, replace it with the full pathname or default path to your Midi file, e.g. c:\midis\xxx.mid)
    That's all


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