Skip to main content

.NET 3.5 CD Audio Player: Create a CD Audio Player in .NET 3.5 using WPF and DirectSound

.NET 3.5 CD Audio Player: Create a CD Audio Player in .NET 3.5 using WPF and DirectSound

Andrew Moore

ISBN: 978-0-470-28532-9

Feb 2008

Select type: Download



This Wrox Blox illustrates a CD Player application built with WPF and DirectSound using C# and Visual Studio 2008, and is targeted at the intermediate-level programmer who is familiar with C#, WPF, and .NET interoperability with native Windows APIs, and the Visual Studio development environment. This application provides basic control capabilities such as Play, Pause, Stop, and Eject, and also displays the duration of the disk and each track as well as the title of each track, artist, genre, album, and year of publication as received from the on-line database at  There are four components for this application:
  • Low-level device I/O to read the disk table of contents
  • Read audio data, and eject the disk
  • Socket code to connect to and send and receive disk information from
  • Audio player using DirectSound to play the disk audio data, and a user interface Developed using WPF and XAML.

Usage Rights for Wiley Wrox Blox

Any Wrox Blox you purchase from this site will come with certain restrictions that allow Wiley to protect the copyrights of its products. After you purchase and download this title, you:  

  • Are entitled to three downloads
  • Are entitled to make a backup copy of the file for your own use
  • Are entitled to print the Wrox Blox for your own use
  • Are entitled to make annotations and comments in the Wrox Blox file for your own use
  • May not lend, sell or give the Wrox Blox to another user
  • May not place the Wrox Blox file on a network or any file sharing service for use by anyone other than yourself or allow anyone other than yourself to access it
  • May not copy the Wrox Blox file other than as allowed above
  • May not copy, redistribute, or modify any portion of the Wrox Blox contents in any way without prior permission from Wiley

If you have any questions about these restrictions, you may contact Customer Care at (877) 762-2974 (8 a.m. - 5 p.m. EST, Monday - Friday). If you have any issues related to Technical Support, please contact us at 800-762-2974 (United States only) or 317-572-3994 (International) 8 a.m. - 8 p.m. EST, Monday - Friday).

Getting Started.

User Interface.

CD Device I/O.

Opening a CD.

Reading the CD Table of Contents.

Querying CD Artist and Track Information.

Using DirectSound for Audio Playback.

Creating a DirectSound Device.

Creating DirectSound Buffers for Audio Output.

CD Audio Playback with DirectSound.

Stopping Audio Playback with DirectSound.


About Andrew Moore.

Additional Code