Results 1 to 3 of 3

Thread: waiting for process

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Posts
    67

    Post

    I wonder how to do that.
    I want to play, let's say 4 .wav of about 2 Minutes 30 sec. each
    one after the other and i want my app to wait until the previous
    one is finished before starting the next one.
    But i only get the last one. I don't want my app to freeze
    either since i want to be able to close it when i press ESC.

    So!
    How do i make my .wavs to play one after the other?
    If possible please provide codes.
    Process by example is the best way to learn.

  2. #2
    Fanatic Member Dim's Avatar
    Join Date
    Jul 2000
    Posts
    620
    Have you tried using DoEvents between each wav file. Place the DoEvents in a Do While loop and do this for every wav. Something like:
    Code:
    Do While mplayer.stillexecuting
       DoEvents
    Loop
    I couldn't give you the exact syntax b/c i don't know what way you are playing the wave files.

    Gl,
    D!m

    PS.You could also place a timer and set the interval to a second and play the seond wave file after the timer reached the length of the first wave file then play the third wave files when the timer reached the length of the first 2 combined.
    Dim

  3. #3
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Use the SND_NOSTOP flag with the PlaySound function. It returns False if a sound is allready playing.
    Code:
    Private Declare Function PlaySound _
     Lib "winmm.dll" Alias "PlaySoundA" ( _
     ByVal lpszName As String, _
     ByVal hModule As Long, _
     ByVal dwFlags As Long) As Long
    
    Private Const SND_NOSTOP = &H10
    Private Const SND_ASYNC = &H1
    
    Private Sub PlayMyWavFiles(sWavFileName As String)
        Do While Not PlaySound(sWavFileName, 0&, SND_NOSTOP + SND_ASYNC)
            DoEvents
        Loop
    End Sub
    Good luck!

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