4 Replies - 6290 Views - Last Post: 13 April 2010 - 10:52 AM Rate Topic: -----

#1 Curel_Fate  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 12-April 10

How to play wav file in c++?

Posted 12 April 2010 - 11:21 PM

Hi
I want to know hoe to play wav file in c++?
I have a code as below :

#include <windows.h>
#include <mmsystem.h>

int main(int argc, char *argv[])
{
PlaySound("chimes.wav",NULL,SND_FILENAME|SND_ASYNC);//PLAY WAV SOUND ONCE
getch();
return 0;
}

But I use TURBO C++ and it doesn't include mmsystem.h file.
it displays error.
I have attach a file which i got from google if any one help then plz send me it with changes if required.
so plz help me its urgent.....

Attached File(s)



Is This A Good Question/Topic? 0
  • +

Replies To: How to play wav file in c++?

#2 tauit_dnmd  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 129
  • Joined: 25-March 10

Re: How to play wav file in c++?

Posted 12 April 2010 - 11:44 PM

only Visual C/c++
Was This Post Helpful? 0
  • +
  • -

#3 masoug  Icon User is offline

  • D.I.C Head

Reputation: 22
  • View blog
  • Posts: 181
  • Joined: 30-December 09

Re: How to play wav file in c++?

Posted 13 April 2010 - 09:51 AM

Try a library,
such as OpenAL...

That might be easier to start with...

-Masoug
Was This Post Helpful? 0
  • +
  • -

#4 callahan09  Icon User is offline

  • D.I.C Head

Reputation: 20
  • View blog
  • Posts: 61
  • Joined: 13-April 10

Re: How to play wav file in c++?

Posted 13 April 2010 - 10:04 AM

I use the Visual C++ compiler, so I'm not sure if I can be too helpful, but couldn't you find the "mmsystem.h" file on the web somewhere, download it, and manually include it in your project?

I found it here:

mmsystem.h source

Not sure if it will work in your compiler, but I don't know why it wouldn't.
Was This Post Helpful? 0
  • +
  • -

#5 sarmanu  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 966
  • View blog
  • Posts: 2,362
  • Joined: 04-December 09

Re: How to play wav file in c++?

Posted 13 April 2010 - 10:52 AM

From mmsystem.h:
#ifdef __cplusplus
extern "C" {
// EVERYTHING in mmsystem.h is defined in this block


So, it works only on MSVC compilers. You would have better recommend him a newer Compiler. Eh, I'm gonna do that by myself: Microsoft Visual C++ 2010 It's free, and it's good!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1