using direct sound with VS 2010 C++

6cb5861b32f234b7c9828984f7e99594
0
smoland 101 Apr 25, 2012 at 20:09

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.

2 Replies

Please log in or register to post a reply.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Apr 25, 2012 at 21:24

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.

6837d514b487de395be51432d9cdd078
0
TheNut 179 Apr 26, 2012 at 01:34

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.