Chapter 7: Driving Hardware with Property Sets


If a manufacturer adds a feature to its sound cards that is not supported by the DirectSound SDK, the manufacturer can make the feature available to the programmer through the use of property sets . Property sets provide a way to write code more or less directly to the hardware. This may seem intimidating, but using property sets is in fact as easy, and in some cases easier, than programming for the SDK.

This chapter will focus on how to use Environmental Audio Extensions (EAX), which are the property set extensions most widely supported in sound cards.

The Property Values Sample

The Property Values sample demonstrates the 26 preset audio environments of EAX 2.0 (from Padded cell to Psychotic) and includes an example of obstruction and occlusion .

In this context, obstruction means that although there is an airway from the source of a sound to the listener, that airway is blocked in some way. For example, a pillar or vehicle or large piece of furniture can obstruct the airway. Occlusion occurs when there is no airway from the source to the listener, and the sound has to pass through an object “ usually a wall or window (see Figure 7.1).

click to expand
Figure 7.1: Examples of occluded and obstructed sound.

Run the PropertyValues.exe that is found in the AVBook\bin directory. This sample takes just one sound file as input. Load in a simple sound such as  cannon.wav , and press Play. The sound will loop and play until you press Stop or Exit. Try clicking on the radio buttons for different environments and listening to the reverb effects that are produced. Environments with very noticeable reverb effects include the Hangar, Sewer Pipe, Underwater, Bathroom, and the weird but wonderful collection of Drugged, Dizzy, and Psychotic. The 26 environments available in this sample are all those that are predefined for EAX 2.0 (see Figure 7.2).

click to expand
Figure 7.2: Property Values dialog box.

Notice that if you press Stop Source, only the source sound stops; the reverb effects continue until they are silent. This gives you a good method of checking out the reverb. Click Play, and then (after listening to it loop a few times), just when the sound is at its loudest, click Stop Source, and then listen to the reverb sound until it dies off.

The Obstruction and Occlusion check boxes enable you to hear the sound as if it was blocked by a pillar and in another room, respectively. You can select both boxes, although not much additional sensory value will be achieved.

Along with selecting or clearing the Obstruction and Occlusion check boxes, you can also change the environment mid-sound, and the sound will immediately reflect your changes.

Load in different kinds of sounds, and then change the settings to evaluate how the different environments affect the sound that you hear. Try experimenting with high- or low-frequency sound, or some music.

Clearly, this sample will only work if you have a sound card that supports the EAX standard. However, because most sound cards do support the EAX 2.0 standard, it is recommended that you incorporate these extensions into your program.

Before examining the code for the sample, we ll compare the EAX 2.0 environment with the I3DL2 environment that we introduced in Chapter 4.




Fundamentals of Audio and Video Programming for Games
Fundamentals of Audio and Video Programming for Games (Pro-Developer)
ISBN: 073561945X
EAN: 2147483647
Year: 2003
Pages: 120

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net