Jump to content
  • Advertisement
Sign in to follow this  
CarlML

DirectX DirectSound

This topic is 3629 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to follow the tutorial on this page to add audio with DirectSound: http://www.codeproject.com/KB/audio-video/DirectSound9p1.aspx The author goes on to say that I obviously need to add reference to the project for Microsoft.DirectX and Microsoft.DirectX.DirectSound. Obviously I have no clue how to do that since it get errors no matter what I do.(authors should not assume so much methinks) For starters I'm trying to add:
using Microsoft.DirectX;
using Microsoft.DirectX.DirectSound;




But no deal. How do I add such a thing? I'm using Visual Studio 2008 pro, C++.

Share this post


Link to post
Share on other sites
Advertisement
I can find these files in:

C:\WINDOWS\assembly

C:\WINDOWS\Microsoft.NET\DirectX for Managed Code\1.0.2902.0

But I have no idea how to add them to the project. When I open the references dialog in Visual Studio nothing apprears in the list no matter what paths I add.

Please assist.:) This should be a really simple thing... wanna make sound.

Also tried adding XAudio2 instead but that just led to a neverending chain of include files...:|

Share this post


Link to post
Share on other sites
"Hi children, today we going to build a spaceship. Obviously you are going to need a rocket engine and an intergalactic flux capacitor but I assume you already made that so just add a nice shiny start button and press it to fly away."

Share this post


Link to post
Share on other sites
So you're using:
1) DirectSound, which was killed off.
2) Managed DirectX, which was killed off.

Not really a great place to be. I suggest:
1) XNA, with XACT/BasicSound: Microsoft's official way of doing this sort of thing.
2) SlimDX, with XAudio2: Unofficial DirectX wrapper, and XAudio2 is the new API meant to replace DirectSound.

Share this post


Link to post
Share on other sites
Quote:
Original post by Promit
So you're using:
1) DirectSound, which was killed off.
2) Managed DirectX, which was killed off.

Not really a great place to be. I suggest:
1) XNA, with XACT/BasicSound: Microsoft's official way of doing this sort of thing.
2) SlimDX, with XAudio2: Unofficial DirectX wrapper, and XAudio2 is the new API meant to replace DirectSound.

Aha, I see. Thanks. It's kind of hard to know these things when starting out. I'm not actually using anything so far so there is still time to switch.:)

I'm not familiar with XNA at all. What is the simplest way to add audio then? I'm not about to develop an audio processing program, just want to hook up to a device load some wavs and play them.

The sample for XAudio2 in the Directx SDK uses this header: SDKwavefile.h, which can be found in another sample and uses like 30 different headers that i probably don't have...

Any good tutorials to start with?

Share this post


Link to post
Share on other sites
Well, you were using C#, so you can take a look at the SlimDX XAudio2 sample. As for XNA, there's a class called BasicSound that is dead easy to use. I'm sure the sample games use it somewhere, so just poke through that.

Share this post


Link to post
Share on other sites
No, I'm using C++. The tutorial was listed under C++, but i guess it is C# then.

Isn't XNA some kind of major framework that I need to conform the project to? I'd rather keep things simple but i'll check those things out.

Share this post


Link to post
Share on other sites
Well I finally got XAudio2 working after some trial and error.:)

One issue though... When I play a sound I can only play it once. After that the pointer is left at the end of the buffer I guess (IXAudio2SourceVoice). What do I need to do to always start a sound from the beginning again when calling Start()?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!