Thread: sound file in project

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    77

    sound file in project

    can anyone teach mi how to insert a .wav file into the project and make it play automatic ??

  2. #2
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    Just call PlaySound when you want the sound *.wav to play.

    Code:
    PlaySound("yourwav.wav",NULL,SND_FILENAME | SND_ASYNC);

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    31
    Will that work with mp3's as well, or just wav files?
    "Some succeed because they are destined to, others succeed because they are determined to."
    ~Anonymous

    "A shorn scrotum is quite breathtaking, I suggest you try it."
    ~Dr. Evil

    EMT/Firefighter
    Eagle Scout

  4. #4
    Unregistered
    Guest
    Just wav files. mp3s have to be decoded into a wav format to be played

  5. #5
    Registered User
    Join Date
    Apr 2002
    Posts
    77
    cannot
    its a unknown function to the visiual c++
    must i add any file anot ???

  6. #6
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    You need to make sure that you link to winmm.lib and include mmsystem.h.

  7. #7
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Lightbulb YOu can play MP3s!

    It's in mmsystem.h, too. Jus do this:

    mciSendString(
    "play file.mp3",
    0,
    0,
    0
    );
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: [email protected]

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 04:27 PM
  2. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  3. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 04:54 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. simulate Grep command in Unix using C
    By laxmi in forum C Programming
    Replies: 6
    Last Post: 05-10-2002, 04:10 PM