You sure you've got everything hooked up correctly and it is not muted?
Can other applications play sounds?
[Sorry, I've got to ask. I did the same thing once before. It took me a week to figure out that had I told Windows never to allow any sounds at all...]
Oy, that was a long time ago. I don't remember. I think it was somewhere in the sound configuration options from the Control Panel...
The only option you are specifying is SND_FILENAME, and the function is not returning FALSE?
1 2 3 4 5 6 7 8 9 10 11
if (!PlaySound(
TEXT("lazer.wav"),
NULL,
SND_FILENAME | SND_ASYNC | SND_NODEFAULT
))
MessageBox(
NULL,
TEXT("Could not play \"lazer.wav\""),
TEXT("fooey!"),
MB_OK | MB_ICONINFORMATION | MB_TASKMODAL
);
(The SND_ASYNC and SND_NODEFAULT flags are optional for this test...)
Oh, and the "lazer.wav" file is in the current directory, the windows directory, the windows system directory, one of the directories listed in the PATH environment variable, or a network-mapped directory?
Hey QWERTYman just a moment ago i didn't even know that we could put sound in c++ programs especially in console ones.
I saw your post and searched and found that you could. I looked up other forums and found how to play a sound file and i succcesfully played it.
Here's how i did it :
1. Make sure you are using Windows 98 and above.
2. Include the necessary librares and header files (windows.h and winmm)
3. I used the same syntax as you posted (i just did ctrl+c and ctrl+v :P)
4. I made sure that the music file was under my working directory
And BINGO my fav Halo Music in my console Project !!