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

DirectSound

We will add some simple sound to the 2D world we made in the previous chapter. So, open Visual Studio and let's get started!

Note

Before we get started, it should be noted that the music track we are using in this chapter (lost_village_128.wav) is courtesy of http://wrathgames.com/blog (WrathGames Studio). So, a big thanks goes out to them.

This sound file is, of course, included in the downloadable code for this chapter.

Open the TileGameWindow.cs file. First of all, we need to add the following using statements to the top of the file so that we can use DirectSound:

using SlimDX.DirectSound;
using SlimDX.Multimedia;

Now, we need to add some new member variables to this class. The first one we will add is a Boolean variable named m_UseDirectSound ...

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