CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10
  1. #1
    Join Date
    Apr 1999
    Posts
    18

    Playing *.Wav Files

    How do you play a wav file?
    source code wise i mean

    Of all the things I've lost I miss my mind the most

  2. #2
    Join Date
    May 1999
    Location
    Oregon, USA
    Posts
    302

    Re: Playing *.Wav Files

    Have a look in the multimedia section of this site.
    There should be something there to help you get started.



  3. #3
    Join Date
    Apr 1999
    Posts
    5

    Re: Playing *.Wav Files

    You can play a wave file using the PlaySound function
    e.g.
    PlaySound("fmast.wav", NULL, SND_FILENAME | SND_ASYNC);

    with, obviously, your file in place of fmast.wav

    FUNKMASTER P

  4. #4
    Join Date
    Apr 1999
    Posts
    18

    Re: Playing *.Wav Files

    can this function play wav's directly from the hardrive or does the wav have to be in the project's workspace?

    Of all the things I've lost I miss my mind the most

  5. #5
    Join Date
    Apr 1999
    Posts
    18

    Re: Playing *.Wav Files

    when i try to use this function it says:

    error LNK2001: unresolved external symbol __imp__PlaySoundA@12




    how do i fix this? im including mmsystem.h in my dialog's cpp file

    Of all the things I've lost I miss my mind the most

  6. #6
    Join Date
    Apr 1999
    Posts
    5

    Re: Playing *.Wav Files

    If you specify the absolute path i.e. (C:msdevstd/bin/fmast.wav) then your file can be anywhere on the hard drive, however if you use the path (or lack there of ) that i included in the snippet, I believe the files has to be in the same directory as the code

    FUNKMASTER P

  7. #7
    Join Date
    Apr 1999
    Posts
    5

    Re: Playing *.Wav Files

    oh yeah sorry forgot...
    this is a pretty old function not MFC you know
    trying including windows.s
    i.e.
    #include windows.h

    FUNKMASTER P

  8. #8
    Join Date
    Apr 1999
    Posts
    18

    Re: Playing *.Wav Files

    nope including windows.h doesnt help, still has the same linking error, any other ideas?

    Of all the things I've lost I miss my mind the most

  9. #9
    Join Date
    Apr 1999
    Posts
    33

    Re: Playing *.Wav Files

    link with winmm.lib


  10. #10
    Join Date
    May 1999
    Location
    WA
    Posts
    65

    Re: Playing *.Wav Files

    Do everything that you have been (using the PlaySound() function), and linking to the .lib file that was given, but include the following line of code at the top of your .cpp file that you're calling the PlaySound() function in..

    #include "mmsystem.h"



    Have fun!


    - Troy

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

Featured