Results 1 to 3 of 3

Thread: how can i stop a looping sound?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2000
    Posts
    24

    Post

    I've recently programmed a small game which is part of a program, nothing fancy (no DirectX and stuff), in which I use an API call to play sounds. I have this background loop (a wave file) which doesn't stop playing after I close the window, while I've let the program play (both loop AND normal) an empty wave file (about 2 secs of silence) on the unload event of the form.

    ------------------
    Doomstar
    http://come.to/Doomstar

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Post

    Try putting a DoEvents statement inside the sound loop.

    ------------------
    Marty
    Can you buy an entire chess set in a pawn shop?

  3. #3
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    The Sound should be stopped as soon as your App is unloaded, perhaps you have another form, or some other Routine running which is keeping the App in Memory and not Unloading properly?

    To Force a WAV to Stop, use the SND_PURGE Constant with the sndPlaySound API, ie.
    Code:
    Private Sub Form_Unload()
        Call sndPlaySound("", SND_PURGE)
    End Sub

    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]


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