30.1. Adding sound to your program

How do we get our program to make noise? The easiest way is to use the multimedia features of Windows to play so-called wave or *.wav files. A wave file is to sound as a bitmap is to graphics: it’s a binary representation. Although Java code can also play files in the *.au format, the Visual C++ libraries don’t supply this capability.

And what about music? What about playing *.mp3, or generating sounds with algorithms? Certainly a full-featured game ought to have some music and some more sophisticated sound-blending modes. Also you’d like to be able to use MIDI to avoid having to store a sound file in such a large format. But, in this chapter, we’re only going to give you the bare minimum.

If you use the Windows ...

Get Software Engineering and Computer Games 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.