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 ...
No credit card required