Playing a WAV File?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brian Basquille

    Playing a WAV File?

    Hello all,

    What is the syntax for simply playing a WAV file in your program?

    Am learning VB and have two VB books but don't wanna root through them to
    find the code.

    Any help would be much appreciated!

    Thanks in advance,
    Brian


  • Logit

    #2
    Re: Playing a WAV File?

    Give me permission and a valid e-mail address that
    can accept up to 1 mb files and I'll forward a zip
    file with numerous examples of how to play wav
    files.

    E-mail me at the address listed below.

    --
    Thanks !

    Jim

    [ logitga@yahoo.c om to reply directly ]

    "If you are living like there is no God ...
    ... you better be right !"



    Comment

    • Raoul Watson

      #3
      Re: Playing a WAV File?


      "Brian Basquille" <tbasquille@eir com.netSPAM> wrote in message
      news:ajw2b.2903 8$pK2.45724@new s.indigo.ie...[color=blue]
      > Hello all,
      >
      > What is the syntax for simply playing a WAV file in your program?
      >
      > Am learning VB and have two VB books but don't wanna root through them to
      > find the code.
      >
      > Any help would be much appreciated!
      >
      > Thanks in advance,
      > Brian
      >[/color]

      A couple of ways... here is one:

      Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA " (ByVal
      lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long

      dim wav&
      wav& = PlaySound("boin g.wav", 0, 0)



      Comment

      • gonzo

        #4
        Re: Playing a WAV File?

        Try this:
        ---------------------------------
        Detect if Sound Card Available:

        Declare Function waveOutGetNumDe vs Lib "winmm.dll" Alias "waveOutGetNumD evs"
        () as Long

        - Returns number of devices available to Play sound files (returns 0 if none
        available)

        ---------------------------------
        Play Sound:

        Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySou ndA" (ByVal
        lpszSoundName As String, ByVal uFlags As Long) as Long

        lpzSoundName - Name of sound to play
        uFlags - Options for playing the sound

        Constants:
        SND_SYNC - played synchronously, function does not return until
        sound ends
        SND_ASYNC - played asynchronously, function returns immediately
        after beginning sound
        SND_NODEFAULT - if sound cannot be found, returns silently without playing
        the default sound
        SND_LOOP - will continually play sound until sndPlaySound is
        called with a null
        SND_NOSTOP - if sound currently playing, returns false without
        playing the requested sound


        Good Luck!!!

        Gonzo



        "Brian Basquille" <tbasquille@eir com.netSPAM> wrote in message
        news:ajw2b.2903 8$pK2.45724@new s.indigo.ie...[color=blue]
        > Hello all,
        >
        > What is the syntax for simply playing a WAV file in your program?
        >
        > Am learning VB and have two VB books but don't wanna root through them to
        > find the code.
        >
        > Any help would be much appreciated!
        >
        > Thanks in advance,
        > Brian
        >
        >[/color]


        Comment

        • Kingbarry2000

          #5
          Re: Playing a WAV File?

          Try this:
          Use Google


          "Brian Basquille" <tbasquille@eir com.netSPAM> wrote in message
          news:ajw2b.2903 8$pK2.45724@new s.indigo.ie...[color=blue]
          > Hello all,
          >
          > What is the syntax for simply playing a WAV file in your program?
          >
          > Am learning VB and have two VB books but don't wanna root through them to
          > find the code.
          >
          > Any help would be much appreciated!
          >
          > Thanks in advance,
          > Brian
          >
          >[/color]


          Comment

          Working...