Announcement

Collapse
No announcement yet.

Playing a wav file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Playing a wav file

    I have a program that needs to play a wav file when an
    update routine fails. I have looked around the EZ_GUI
    and PowerBasic archives and found nothing really simple.
    Does anyone know of an EASY way to play a wav file?

    Thanks
    Doug

    ------------------
    There is a principle which is a bar against all information, which is proof against all arguments and which cannot fail to keep a man in everlasting ignorance - that principle is contempt prior to investigation.

    Herbert Spencer

  • #2
    this has a lot of fluf, but can get you started.
    http://www.powerbasic.com/support/pb...ad.php?t=22949

    ------------------
    -greg

    [this message has been edited by gregery d engle (edited october 23, 2001).]
    -Greg
    [email protected]
    MCP,MCSA,MCSE,MCSD

    Comment


    • #3
      Doug:

      Try this...
      Code:
      SUB PlayWave(BYVAL File$)
         LOCAL zWav AS ASCIIZ * 256
         zWav = File$
         CALL PlaySound(zWav, BYVAL NULL%, %SND_ASYNC)
      END SUB
      Timm
      mailto:[email protected]
      Tsunami Record Manager

      Comment


      • #4
        Some code I dug up...

        Code:
        Declare Function PlaySound LIB "WINMM.DLL" Alias "PlaySoundA" (lpszName As Asciiz, ByVal hModule As Long, ByVal dwFlags As Long) As Long
         
        %SND_SYNC                                    = &H0
        %SND_ASYNC                                   = &H1
        %SND_NODEFAULT                               = &H2
        %SND_MEMORY                                  = &H4
        %SND_ALIAS                                   = &H10000
        %SND_FILENAME                                = &H20000
        %SND_RESOURCE                                = &H40004
        %SND_ALIAS_ID                                = &H110000
        %SND_ALIAS_START                             = 0
        %SND_LOOP                                    = &H8
        %SND_NOSTOP                                  = &H10
        %SND_VALID                                   = &H1F
        %SND_NOWAIT                                  = &H2000
         
         
        Function PbMain As Long
         PlaySound "MYFILE.WAV", 0, %SND_FILENAME Or %SND_LOOP
        End Function
        Where 'MyFile.wav' is the name of the file you want to play.

        Regards,

        ------------------
        Kev G Peel
        KGP Software, Bridgwater, UK.
        mailto:[email protected][email protected]</A>
        kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

        Comment


        • #5
          Timm,

          You need to replace

          LOCAL zWav AS ASCIIZ * 256

          with

          LOCAL zWav AS ASCIIZ * %MAX_PATH

          and #include "win32api.inc"


          and

          CALL PlaySound(zWav, BYVAL NULL%, %SND_ASYNC)

          with

          CALL PlaySound(zWav, BYVAL %NULL, %SND_ASYNC)

          ------------------
          -Greg

          [This message has been edited by Gregery D Engle (edited October 23, 2001).]
          -Greg
          [email protected]
          MCP,MCSA,MCSE,MCSD

          Comment


          • #6
            Gregery and Timm

            Thanks, Worked like a charm! I'm new to this API stuff so your
            help is appreciated. Seems like it's written in Chinese!

            Doug

            ------------------
            There is a principle which is a bar against all information, which is proof against all arguments and which cannot fail to keep a man in everlasting ignorance - that principle is contempt prior to investigation.

            Herbert Spencer

            Comment


            • #7
              Worse than that, the API definitions in the SDK are written in C.

              Luckily for us, a vast number of the declarations have already been converted to PowerBASIC, courtesy of the WIN32API.INC and related .INC files.

              ------------------
              Lance
              PowerBASIC Support
              mailto:[email protected][email protected]</A>
              Lance
              mailto:[email protected]

              Comment

              Working...
              X