In the past few years, sound cards have moved from the Industry Standard Architecture (ISA) bus to the Peripheral Component Interconnect (PCI) bus. This design change has fundamentally altered the way Microsoft DirectSound-accelerated cards handle audio data. In addition, DirectSound has introduced voice management, which enables applications to make more efficient use of limited hardware acceleration resources.

This section discusses some considerations in allocating buffers and using voice management on the two kinds of sound cards. The following topics are discussed.

DirectSound Buffers on ISA Cards

When DirectSound was first introduced, all audio devices operated on the ISA bus. The ISA bus was sufficient to stream 16-bit, 22-kHz stereo data from the CPU to the sound card without unduly affecting overall system performance, but attempting to send more data often placed an undue burden on the bus. This limitation had a strong influence on audio hardware design.

To mix DirectSound buffers, a chip on the sound card has two choices: it can reach across the ISA bus into system memory, or it can have dedicated memory on the card itself. Owing to the ISA bus's limited bandwidth, reading audio data from system memory is not practical. Therefore, ISA-based sound cards that do DirectSound acceleration almost always have dedicated on-card RAM.

When such a sound card is used to accelerate DirectSound, the sound data must first be copied from system memory, across the ISA bus, and into the dedicated memory on the card. This copying can take some time. However, once the data is on the card, there is almost no cost to the system for starting, stopping, and mixing sounds; all that work is handled by the audio processor chip accessing its own dedicated memory.

ISA-based DirectSound accelerators support static buffers on the card, but not streaming buffers, because it is impractical to stream data across the slow ISA bus. DirectSound buffers created with the BufferDescription.StaticBuffer property are located in card memory if it is available. Others are created in system memory.

DirectSound Buffers on PCI Cards

Modern audio cards are designed to connect to the PCI bus. With the movement to this bus comes a large increase in the available bandwidth between the system and the audio card. It is now practical to have the audio chip reach directly into system memory to retrieve audio data for hardware mixing. As a result, it is no longer worthwhile to have on-board memory for buffers.

On PCI cards, static buffers and streaming buffers are effectively the same. The BufferDescription.StaticBuffer property does not affect the location of the buffer, because all buffers are located in system memory.

Note: Most sound cards report in the Device.Caps property that they have static buffers, even though they have no on-card RAM. The streaming and static buffers reported by these cards are often the same buffers.

Voice Management on ISA and PCI Cards

By using the BufferDescription.DeferLocation when creating a buffer, you can defer the allocation of buffers to hardware-mixed or software-mixed memory until the moment when they are played. For information, see Dynamic Voice Management.

The effect of deferred allocation on application performance depends on the type of DirectSound accelerator in the user's system.

Consider the case of a PCI accelerator. When a deferred buffer is played, DirectSound first determines if there is hardware available to play the sound. Assuming that there is, DirectSound then ensures that the hardware has access to the sound data, which remains where it is. Finally, DirectSound tells the hardware to start playing. This process is both efficient and fast.

Note: The DirectSound voice manager allocates hardware mixing resources, not memory. On a PCI card, the buffer occupies the same memory before and after it is allocated, regardless of whether it is allocated to the hardware mixer or the software mixer.

If the user has an ISA-based accelerator, the situation is quite different. In this case, the act of getting audio data to a hardware-mixed buffer is very slow, because the data needs to cross the ISA bus and be loaded into memory on the sound card before it can be mixed. For deferred buffers, this can introduce an unacceptable delay between when the play call is made and when the sound starts. For this reason, using voice management is not recommended on ISA-based DirectSound accelerator cards.

It is easy to prevent your application from using voice management on ISA devices. A buffer will not be assigned to on-card memory unless the BufferDescription.StaticBuffer property is set. Therefore, as long as you do not combine StaticBuffer and DeferLocation, there is no danger that buffers will be assigned to on-card memory at play time.

Using StaticBuffer by itself ensures that the buffer will take advantage of any existing memory on an ISA card, but it has no effect on a PCI card. In the absence of other properties, DirectSound will attempt to place the buffer under hardware control but still in system memory. Using DeferLocation by itself has no effect on an ISA card, since the buffer is always placed in system memory and is not managed by the hardware.

The following table summarizes the effects of the StaticBuffer and DeferLocation properties on buffers created for ISA and PCI devices.

Card BufferDescription propertyMemoryHardware acceleration
ISA StaticBuffer Hardware if available.Yes, if in hardware memory.
PCI StaticBuffer System.Yes, if hardware voice available; property setting has no effect.
ISA DeferLocation Hardware if available, if BufferCaps.StaticBuffer set.Yes, if in hardware memory, but latency on first play.
PCI DeferLocation System.Yes, if hardware voice available.

To take advantage of acceleration on ISA cards without running into the dangers presented by deferred allocation, first check the capabilities of the device. If the card reports more than zero static buffers and no streaming buffers, it is probably an older ISA card with on-card memory. You can then use the StaticBuffer property, but do not use DeferLocation. If the card reports more than zero streaming buffers, it is probably a newer PCI-based accelerator card. In this case, you'll want to use DeferLocation, and not StaticBuffer, to make maximum use of the hardware voices.