Jump to content


using direct sound with VS 2010 C++


2 replies to this topic

#1 smoland

    New Member

  • Members
  • Pip
  • 1 posts

Posted 25 April 2012 - 08:09 PM

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 Reedbeta

    DevMaster Staff

  • Administrators
  • 5311 posts
  • LocationSanta Clara, CA

Posted 25 April 2012 - 09:24 PM

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.
reedbeta.com - developer blog, OpenGL demos, and other projects

#3 TheNut

    Senior Member

  • Moderators
  • 1701 posts
  • LocationCyberspace

Posted 26 April 2012 - 01:34 AM

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.
http://www.nutty.ca - Being a nut has its advantages.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users