Results 1 to 8 of 8

Thread: Sounds

  1. #1
    lord_dude
    Guest

    Sounds

    A lot of sites say to use the mci control to play sound files, but i couldt find this (im using vb6 prof) so i am trying to use the api but my code doest appear to be working. This is my code:


    Public Declare Function mciSendString Lib "winmm.dll" Alias _
    "mciSendStringA" (ByVal lpszCommand As String, ByVal _
    lpszReturnString As String, ByVal cchReturnLength As Long, _
    ByVal hwndCallback As Long) As Long

    Sub Play_File(Path As String, Name As String)
    Call mciSendString("Open " & Path & " alius " & Name, "", 0, 0)
    Call mciSendString("Play " & Name, "", 0, 0)
    End Sub

    Sub Stop_File(Name As String)
    Call mciSendString("Close " & Name, "", 0, 0)
    End Sub


    Anyone have any ideas as to the problem/if the mcicontrol goes by a different name in the components list?

    Thanks

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    This is API, no MCI control. Here is a syntax error in your code!
    Code:
    Call mciSendString("Open " & Path & " alius " & Name, "", 0, 0) 
    'make it
    Call mciSendString("Open " & Path & " alias " & Name, "", 0, 0)
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  3. #3
    lord_dude
    Guest
    Still doest work. Am i using the wrong type of file? I have tried it with a wav and a midi.

  4. #4
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Try this
    Code:
    mciSendString("OPEN " + Path + " TYPE SEQUENCER ALIAS " + Name, 0&, 0, 0)
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  5. #5
    lord_dude
    Guest
    Still doest work!!!! Nor does this code http://www.allapi.net/api/api221.php !!!


    I am begining to suspect there is something wrong with my pc. i know the files i am trying to play are fine coz i can play them in winamp.

  6. #6
    lord_dude
    Guest
    ive found the problem. Despite the fact that i am running win98, it needs to have the path passed a dos one, so c:\program files\file1.mid would need to be c:\progra~1\file.mid. I looked this api call up on several sites but all neglected to mention this major issue!

  7. #7
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Because usually you would have it stored locally, eg.

    App.Path & "\mymid.mid"

    But if this isn't the case then yes, that is a huge problem.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  8. #8
    lord_dude
    Guest
    Originally posted by Sastraxi
    Because usually you would have it stored locally, eg.

    App.Path & "\mymid.mid"

    But if this isn't the case then yes, that is a huge problem.

    you say this but surely most of the time app.path would return something begining with c:\program files\


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