Playing Back an Audio or Video File Simply

In order to use the audio and video playback namespace, you will first need to add a reference to this namespace into your application. You may also want to include a using clause for the namespace in your code file.

Our goal when we designed these classes was to make them extremely simple to use, so if we wanted to play a file, it should be accomplished with just one line of code. If you wanted to play an audio file called “piano.mp3”, let's say, the code would look like this:

Audio someAudio = new Audio("piano.mp3", true);

There are two main classes that are included in this namespace: the video class and the audio class. These names are pretty self-explanatory. Each class's constructor has two overloads; ...

Get Managed DirectX® 9 Kick Start: Graphics and Game Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.