O'Reilly logo

Game Development with SlimDX by Michael Fontanini

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

XAudio2

XAudio2 is, of course, newer and more powerful than DirectSound. We will add some more code to the same file we've spent the first part of this chapter working on (TileGameWindow.cs).

As usual, we first need to add some using statements at the top of the file, so that we can use XAudio2.

using SlimDX.XAudio2;

Next, we will create some member variables to hold our XAudio2 objects. This time there are four of them.

XAudio2 m_XAudio2;
MasteringVoice m_MasteringVoice;
AudioBuffer m_AudioBuffer;
SourceVoice m_SourceVoice;

The first one, m_XAudio2, will hold our XAudio2 object. The second one will hold our mastering voice . In XAudio2, the MasteringVoice class is used to represent the sound output device. The third variable is the buffer that we ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required