Sign in to follow this  
CarlML

DirectX DirectSound

Recommended Posts

CarlML    215
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
CarlML    215
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
CarlML    215
"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
Promit    13246
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
CarlML    215
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
Promit    13246
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
CarlML    215
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
CarlML    215
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this