smoland at April 25th, 2012 16:09 — #1
Can someone me make some sense out of playing a wav file with VS 2010 C++
I am not knowledgeable about Direct Sound or directx
I don't even know what to do with example code I get off the net.
(I will get exampes and there will be several files and I don't know how they all work together!!!)
Is direct sound part of c++?
Is direct sound part of directx?
Can I compile direct sound example code in C++???
I am just totally lost!!!
Can someone help me just play a wav file in c++???
Eventually I would like to develope a game.
Thanks for any help that comes my way.
reedbeta at April 25th, 2012 17:24 — #2
If you're in Windows and you just want to play a .wav file, you can just use PlaySound and pass the file path to the .wav. You can only play one sound at a time this way, though.
thenut at April 25th, 2012 21:34 — #3
The first thing you need to do is download the DirectX SDK. Once you download and install this, look in the samples folder C++ / XAudio2. You can check out those samples to see how it all works. DirectSound and DirectSound3D have been deprecated since Windows Vista. You can still program with it if you want to support Windows XP, but Windows Vista and Windows 7 will run in software mode instead of hardware (not really a big deal). I don't think the SDK has any samples on DirectSound anymore (I couldn't find it), so you may have to hunt for something on the web.
Alternatively you can use OpenAL (download OpenAL11CoreSDK), which runs on Windows, Linux (use openal-soft), Mac, and iOS. The API is fairly easy and you can get sounds up and running I think far quicker than setting up a DirectX project. Just avoid using "alut". It was supposed to further simplify OpenAL, but it hasn't been maintained.