hi help in playing wav file in vb

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tgpreign
    New Member
    • Oct 2007
    • 3

    hi help in playing wav file in vb

    i want to play a 2 consecutive wav file on clicking a once commant button.
    example. by clickng the command button first.wav will play then the second.wav will follow.

    thnx in advance
  • Ali Rizwan
    Banned
    Contributor
    • Aug 2007
    • 931

    #2
    Originally posted by tgpreign
    i want to play a 2 consecutive wav file on clicking a once commant button.
    example. by clickng the command button first.wav will play then the second.wav will follow.

    thnx in advance
    Hi
    Just do this.

    Declarations.

    Code:
    Private Declare Function sndPlaySound& Lib "winmm.dll" Alias _
        "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long)
     Const SND_SYNC = &H0
     Const SND_ASYNC = &H1
     Const SND_NODEFAULT = &H2
     Const SND_LOOP = &H8
     Const SND_NOSTOP = &H10
    Now add this line.

    Code:
    sndPlaySound [B]"Sound Path"[/B] SND_ASYNC Or SND_NODEFAULT
    If you want to play sound for infinite loop then

    Code:
    sndPlaySound [B]"Sound Path"[/B] SND_ASYNC Or SND_NODEFAULT Or SND_LOOP
    GOODLUCK
    ALI

    Comment

    • nev
      Contributor
      • Oct 2007
      • 251

      #3
      Last edited by Killer42; Oct 16 '07, 05:02 AM.

      Comment

      • tgpreign
        New Member
        • Oct 2007
        • 3

        #4
        i know how to play wav files. what i want to know if its possible to play 2 consecutive wav file. because when i worte this code

        sndPlaySound "first.wav" , SND_ASYNC Or SND_NODEFAULT
        sndPlaySound "second.wav ", SND_ASYNC Or SND_NODEFAULT

        the second.wav only plays.

        what i want to know is to play the first.wav first then then second.wav will play too.
        is it possible?.

        thnx...

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #5
          The way I see it, "ASYNCH" effectively means "continue straight away without waiting". So what happens if you specify SYNCH instead. (You may need to look up the correct name for the value). With luck, it should play the sound before control comes back to run your next line.

          Comment

          • tgpreign
            New Member
            • Oct 2007
            • 3

            #6
            thnx everyone. using sync to play consecutive works. thnx a lot. thnx killer42..

            Comment

            • Killer42
              Recognized Expert Expert
              • Oct 2006
              • 8429

              #7
              Glad we could help. :)

              Comment

              Working...