Question about the PlaySound() function

I've used this function a couple of times but for some reason only certain WAV files work with it. I can have two separate WAV files named wav1 and wav2 in the same directory as the exe but one of them will not work
1
2
3
PlaySound("wav1.WAV",NULL,SND_FILENAME|SND_LOOP|SND_ASYNC);  //works

PlaySound("wav2.WAV",NULL,SND_FILENAME|SND_LOOP|SND_ASYNC);  //outputs an error beep and quits 


Are there any restrictions for specific attributes of wav files to work in PlaySound()?
How big is "wav2.WAV"?
Is it encoded using a different codec?
Last edited on
Are you sure the problem is caused by the file? I'm not sure you can do that with PlaySound... Try this:

1
2
PlaySound("wav2.WAV",NULL,SND_FILENAME|SND_LOOP|SND_ASYNC);
PlaySound("wav1.WAV",NULL,SND_FILENAME|SND_LOOP|SND_ASYNC);

If it plays wav2 and then stops, it means that the problem is not caused by the file.
Thanks for the help, after staring at the files for another 15 minutes I noticed that the "Save As" I was doing was saving it in a special wav codec, I switched it back and it all works fine now.

But I think I might just try an actual audio library, which do you guys suggest for just a simple "play", "loop", "stop" and easy to use library? =D
FMOD, OpenAL, or SFML.
I tried using FMOD but I couldn't get it to work. It acted as if there was a linker error because it stated even the most primitive functions of FMOD were undeclared.

The compiler accepted the fmod header file and I linked the correct lib for Dev C++ but it still wouldn't compile. I didn't find much help on google, but from what I read it seems Dev C++ isn't compatible with the FMOD C++ commands so I can't use it or something.

I might try out OpenAL.
Topic archived. No new replies allowed.