Results 1 to 4 of 4

Thread: [RESOLVED] make a sound file repeat using WINMM.DLL

  1. #1

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Resolved [RESOLVED] make a sound file repeat using WINMM.DLL

    i am trying to make a sound file loaded from a resource file repeat until stopped using WINMM.DLL

    Dim sndData() As Byte


    Private Declare Function sndPlaySound Lib "WINMM.DLL" Alias _
    "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As _
    Long) As Long
    Const SND_SYNC = &H0
    Const SND_ASYNC = &H1
    Const SND_NODEFAULT = &H2
    Const SND_LOOP = &H8
    Const SND_NOSTOP = &H10

    play the sound
    sndData = LoadResData("hit", "SOUND")
    sndPlaySound sndData(0), SND_LOOP

    stop the sound
    sndPlaySound ByVal 0, 0
    how can this be done?
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  2. #2
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    5,269

    Re: make a sound file repeat using WINMM.DLL

    I'm trying to wrap my mind around the fact, that the API expects a string and he sends the first member of his byte-array
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  3. #3

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: make a sound file repeat using WINMM.DLL

    for some reason oi got to work by changing this line:
    sndPlaySound sndData(0), SND_LOOP
    to this
    sndPlaySound sndData(0), SND_LOOP Or SND_ASYNC Or SND_MEMORY
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  4. #4
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,624

    Re: [RESOLVED] make a sound file repeat using WINMM.DLL

    Look up the difference between SND_SYNC and SND_ASYNC. That'll help you understand.

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