DirectSound

Last updated

DirectSound is a deprecated software component of the Microsoft DirectX library for the Windows operating system, superseded by XAudio2. It provides a low-latency interface to sound card drivers written for Windows 95 through Windows XP and can handle the mixing and recording of multiple audio streams. DirectSound was originally written for Microsoft by John Miles. [1]

Contents

Besides providing the essential service of passing audio data to the sound card, DirectSound provides other essential capabilities such as recording and mixing sound, adding effects to sound (e.g., reverb, echo, or flange), using hardware accelerated buffers (if the sound card supports hardware audio acceleration) in Windows 95 through XP, and positioning sounds in 3D space. DirectSound also provides a means to capture sounds from a microphone or other input and controlling capture effects during audio capture. [2]

After many years of development, today DirectSound is a mature API, and supplies many other useful capabilities, such as the ability to play multichannel sounds at high resolution. While DirectSound was designed to be used by games, today it is used to play audio in many audio applications. DirectShow uses DirectSound's hardware audio acceleration capabilities if the sound card's hardware audio acceleration capabilities exist and are exposed by the audio driver. [3]

Features

DirectSound is a user mode API that provides an interface between applications and the sound card driver, enabling applications to produce sounds and play back music.

DirectSound was considered revolutionary when it was introduced in 1995, as it featured multiple simultaneous audio streams and allowed several applications to access the sound card simultaneously. Before that, the game developers were required to implement their own audio rendering engine in software.

DirectSound provides sample rate conversion and sound mixing (volume and pan) for an unlimited number of audio sources; however, the practical limits are the number of hardware audio sources and the performance of software mixers.

The DirectSound architecture features a concept of the "ring buffer" which would be continuously played in a cycle. The application programmer creates the sound buffer then continuously queries its state through the "read cursor" and updates it with the "write cursor". There are two types of buffers - a "streaming" buffer, which holds continuous sounds such as background music, and a "static" buffer which holds short sounds.

On supported sound cards, DirectSound would try to use "hardware accelerated" buffers, i.e. the ones which either can be placed in local sound card memory, or can be accessed by the sound card from the system memory. If hardware acceleration is not available, DirectSound would create audio buffers in the system memory and use purely software mixing.

Some late DOS-era "wavetable" sound cards such as Sound Blaster AWE32 and Gravis Ultrasound featured dedicated DSPs, which were borrowed from the digital music instruments. These cards featured local memory which could be used for buffering multiple audio streams and mixing them on board, thus offloading the CPU and greatly improving the sound quality. However, this was only possible in DOS by directly programming the hardware, and full-featured "hardware acceleration" from the local memory was never implemented on these cards, due to complexities of double buffering. Later cards such as Sound Blaster Live!, Audigy and X-Fi are capable of accessing the system memory buffers directly.

DirectSound3D

DirectSound3D (DS3D) is an extension to DirectSound introduced with DirectX 3 in 1996 with the intention to standardize 3D audio in Windows. DirectSound3D allows software developers to utilize audio by writing once for a single audio API instead of rewriting code numerous times to work for each audio card vendor.

In DirectX 5, DirectSound3D gained the support for sound cards that use third party 3D audio algorithms in order to accelerate DirectSound3D properly, through methods approved by Microsoft.

In DirectX 8, DirectSound and DirectSound3D (DS3D) were officially merged and given the name DirectX Audio, however the API is still commonly referred to as DirectSound.

EAX

EAX is an extension to DirectSound and DirectSound3D which provides sound effects processing to the hardware-accelerated buffers.

OS Support

Windows 95

In Windows 95, 98 and Me, the DirectSound mixer component and the sound card drivers were both implemented as a kernel-mode VxD driver (Dsound.vxd), allowing direct access to the primary buffer used by the audio hardware and thus, providing the lowest possible latency between the user-mode API and the underlying hardware, but in some cases causing instability and blue screen errors.

Windows 98 introduced WDM Audio and the Kernel Audio Mixer driver (KMixer), which enabled digital mixing, routing and processing of simultaneous audio streams with a higher quality sample rate conversion as well as kernel streaming. Under WDM, DirectSound sends data to the software-based KMixer. Windows 98 Second Edition improved WDM audio support by adding DirectSound hardware buffering, DirectSound3D hardware abstraction, KMixer sample-rate conversion (SRC) for capture streams, multichannel audio support and introduction of DirectMusic. If the audio hardware supports hardware mixing (also known as hardware buffering or DirectSound hardware acceleration), DirectSound buffers directly to the rendering device. [4] If DirectSound streams use hardware mixing, KMixer and its latency delay are bypassed. [5] On Windows 98 and Windows Me, WDM audio drivers were preferred but compatibility with VxD driver model was preserved.

Although Windows Driver Model (WDM) was available starting with Windows 98, few audio card manufacturers used it. Due to internal buffering, KMixer introduced significant processing latency (30 ms on then-current systems). Windows 98 also includes a WDM streaming class driver (Stream.sys) to address these real time multimedia data stream processing requirements. When the sound card uses a custom driver for use with the system supplied port class driver PortCls.sys or implements a mini-driver for use with the streaming class driver, applications can bypass the KMixer completely and use the kernel streaming interfaces instead to reduce latency.

Windows 2000/XP

In Windows 2000, Microsoft also implemented the same WDM-based audio stack on Windows NT by introducing the WDM audio drivers and the kernel mixer component (KMixer). [6] In Windows XP, Microsoft introduced another improved kernel streaming class driver, AVStream. Beginning with Windows XP, hardware acceleration was also added for DirectSound capture effects processing [7] such as Acoustic Echo Cancellation for USB microphones, noise suppression and array microphone support.

Windows Vista/Windows 7

Windows Vista features a completely re-written audio stack based on the Universal Audio Architecture . Because of the architectural changes in the redesigned audio stack, a direct path from DirectSound to the audio drivers does not exist. [8] DirectSound, DirectMusic and other APIs such as MME are emulated as WASAPI Session instances. DirectSound runs in emulation mode on the Microsoft software mixer. The emulator does not have hardware abstraction, so there is no hardware DirectSound acceleration, meaning hardware and software relying on DirectSound acceleration may have degraded performance. It's likely a supposed performance hit might not be noticeable, depending on the application and actual system hardware. In the case of hardware 3D audio effects played using DirectSound3D, they will not be playable; this also breaks compatibility with EAX extensions. [9]

Third-party APIs such as ASIO and OpenAL are not affected by these architectural changes in Windows Vista, as they use IOCtl to interface directly with the audio driver. A solution for applications that wish to take advantage of hardware accelerated high-quality 3D positional audio is to use OpenAL. However, this only works if the manufacturer provides an OpenAL driver for their hardware. [10]

Windows 8

WASAPI audio stack in Windows 8 introduces support for "hardware offloading" of multiple audio streams to the audio card for mixing and effect processing, in addition to the software processing introduced in Vista, [11] [12] however the functionality is only exposed for Windows Runtime apps. [13] DirectSound's and DirectMusic's hardware interfaces to sound card drivers are not implemented.

Windows CE

Although DirectSound support was available in Windows CE versions up to 4.2, it was removed starting 5.0. [14] Windows CE 6.0 also does not support DirectSound, instead favoring that applications be rewritten to use the Waveform Audio API.

Replacement implementations

After the removal of DirectSound in Windows Vista, a few replacement implementations have appeared.

Sound Blaster's Creative ALchemy (2007) provides hardware acceleration of DirectSound3D and Audio Effects, such as EAX. [15] Creative ALchemy intercepts calls to DirectSound3D and translates them into OpenAL calls to be processed by supported hardware such as Sound Blaster X-Fi and Sound Blaster Audigy. For software-based Creative audio solutions, ALchemy utilizes its built-in 3D audio engine without using OpenAL at all.

Realtek, a manufacturer of integrated HD audio codecs, has a product similar to ALchemy called 3D SoundBack. C-Media, a manufacturer of PC sound card chipsets, also has a solution called Xear3D EX, although it works instead by intercepting DirectSound3D calls transparently in the background without any user intervention.

IndirectSound is a freeware library that emulates DirectSound 3D using XAudio2, without using hardware acceleration. [16]

DSOAL is an open source library that emulates DirectSound 3D and EAX using OpenAL. Either a hardware-accelerated OpenAL implementation or OpenAL Soft (which provides HRTF) can be used. [17]

See also

Related Research Articles

<span class="mw-page-title-main">DirectX</span> Collection of multimedia related APIs on Microsoft platforms

Microsoft DirectX is a collection of application programming interfaces (APIs) for handling tasks related to multimedia, especially game programming and video, on Microsoft platforms. Originally, the names of these APIs all began with "Direct", such as Direct3D, DirectDraw, DirectMusic, DirectPlay, DirectSound, and so forth. The name DirectX was coined as a shorthand term for all of these APIs and soon became the name of the collection. When Microsoft later set out to develop a gaming console, the X was used as the basis of the name Xbox to indicate that the console was based on DirectX technology. The X initial has been carried forward in the naming of APIs designed for the Xbox such as XInput and the Cross-platform Audio Creation Tool (XACT), while the DirectX pattern has been continued for Windows APIs such as Direct2D and DirectWrite.

<span class="mw-page-title-main">Windows 98</span> Microsoft personal computer operating system released in 1998

Windows 98 is a consumer-oriented operating system developed by Microsoft as part of its Windows 9x family of Microsoft Windows operating systems. It is the second operating system in the 9x line, as the successor to Windows 95. It was released to manufacturing on May 15, 1998, and generally to retail on June 25, 1998. Like its predecessor, it is a hybrid 16-bit and 32-bit monolithic product with the boot stage based on MS-DOS.

Direct3D is a graphics application programming interface (API) for Microsoft Windows. Part of DirectX, Direct3D is used to render three-dimensional graphics in applications where performance is important, such as games. Direct3D uses hardware acceleration if it is available on the graphics card, allowing for hardware acceleration of the entire 3D rendering pipeline or even only partial acceleration. Direct3D exposes the advanced graphics capabilities of 3D graphics hardware, including Z-buffering, W-buffering, stencil buffering, spatial anti-aliasing, alpha blending, color blending, mipmapping, texture blending, clipping, culling, atmospheric effects, perspective-correct texture mapping, programmable HLSL shaders and effects. Integration with other DirectX technologies enables Direct3D to deliver such features as video mapping, hardware 3D rendering in 2D overlay planes, and even sprites, providing the use of 2D and 3D graphics in interactive media ties.

<span class="mw-page-title-main">Graphics Device Interface</span> Microsoft Windows API

The Graphics Device Interface (GDI) is a legacy component of Microsoft Windows responsible for representing graphical objects and transmitting them to output devices such as monitors and printers. It was superseded by DirectDraw API and later Direct2D API. Windows apps use Windows API to interact with GDI, for such tasks as drawing lines and curves, rendering fonts, and handling palettes. The Windows USER subsystem uses GDI to render such UI elements as window frames and menus. Other systems have components that are similar to GDI; for example: Mac OS has QuickDraw, and Linux and Unix have X Window System core protocol.

<span class="mw-page-title-main">OpenAL</span> API for rendering audio

OpenAL is a cross-platform audio application programming interface (API). It is designed for efficient rendering of multichannel three-dimensional positional audio. Its API style and conventions deliberately resemble those of OpenGL. OpenAL is an environmental 3D audio library, which can add realism to a game by simulating attenuation, the Doppler effect, and material densities.

The Environmental Audio Extensions are a number of digital signal processing presets for audio, present in Creative Technology Sound Blaster sound cards starting with the Sound Blaster Live and the Creative NOMAD/Creative ZEN product lines. Due to the release of Windows Vista in 2007, which deprecated the DirectSound3D API that EAX was based on, Creative discouraged EAX implementation in favour of its OpenAL-based EFX equivalent – though at that point relatively few games used the API.

DirectMusic is a deprecated component of the Microsoft DirectX API that allows music and sound effects to be composed and played and provides flexible interactive control over the way they are played. Architecturally, DirectMusic is a high-level set of objects, built on top of DirectSound, that allow the programmer to play sound and music without needing to get quite as low-level as DirectSound. DirectSound allows for the capture and playback of digital sound samples, whereas DirectMusic works with message-based musical data. Music can be synthesized either in hardware, in the Microsoft GS Wavetable SW Synth, or in a custom synthesizer.

Direct3D and OpenGL are both application programming interfaces (APIs) that can be used in applications to render 2D and 3D computer graphics. As of 2005, graphics processing units (GPUs) almost always implement one version of both of these APIs. Examples include: DirectX 9 and OpenGL 2 circa 2004; DirectX 10 and OpenGL 3 circa 2008; and most recently, DirectX 11 and OpenGL 4 circa 2011. GPUs that support more recent versions of the standards are backwards compatible with applications that use the older standards; for example, one can run older DirectX 9 games on a more recent DirectX 11-certified GPU.

<span class="mw-page-title-main">Direct Rendering Infrastructure</span> Framework

The Direct Rendering Infrastructure (DRI) is the framework comprising the modern Linux graphics stack which allows unprivileged user-space programs to issue commands to graphics hardware without conflicting with other programs. The main use of DRI is to provide hardware acceleration for the Mesa implementation of OpenGL. DRI has also been adapted to provide OpenGL acceleration on a framebuffer console without a display server running.

DirectX Video Acceleration (DXVA) is a Microsoft API specification for the Microsoft Windows and Xbox 360 platforms that allows video decoding to be hardware-accelerated. The pipeline allows certain CPU-intensive operations such as iDCT, motion compensation and deinterlacing to be offloaded to the GPU. DXVA 2.0 allows more operations, including video capturing and processing operations, to be hardware-accelerated as well.

Desktop Window Manager is the compositing window manager in Microsoft Windows since Windows Vista that enables the use of hardware acceleration to render the graphical user interface of Windows.

<span class="mw-page-title-main">Sound Blaster X-Fi</span> Computer sound card

Sound Blaster X-Fi is a lineup of sound cards in Creative Technology's Sound Blaster series.

<span class="mw-page-title-main">Ensoniq AudioPCI</span> PCI-based sound card

The Ensoniq AudioPCI is a Peripheral Component Interconnect (PCI)-based sound card released in 1997. It was Ensoniq's last sound card product before they were acquired by Creative Technology. The card represented a shift in Ensoniq's market positioning. Whereas the Soundscape line had been made up primarily of low-volume high-end products full of features, the AudioPCI was designed to be a very simple, low-cost product to appeal to system OEMs and thus hopefully sell in mass quantities.

<span class="mw-page-title-main">Sound Blaster Live!</span>

Sound Blaster Live! is a PCI add-on sound card from Creative Technology Limited for PCs. Moving from ISA to PCI allowed the card to dispense with onboard memory, storing digital samples in the computer's main memory and then accessing them in real time over the bus. This allowed for a much wider selection of, and longer playing, samples. It also included higher quality sound output at all levels, quadrophonic output, and a new MIDI synthesizer with 64 sampled voices. The Live! was introduced in August 1998 and variations on the design remained Creative's primary sound card line into the early 2000's.

<span class="mw-page-title-main">Sound Blaster Audigy</span> Computer sound card

Sound Blaster Audigy is a product line of sound cards from Creative Technology. The flagship model of the Audigy family used the EMU10K2 audio DSP, an improved version of the SB-Live's EMU10K1, while the value/SE editions were built with a less-expensive audio controller.

Windows Display Driver Model (WDDM) is the graphic driver architecture for video card drivers running Microsoft Windows versions beginning with Windows Vista.

<span class="mw-page-title-main">PulseAudio</span> Sound server for Unix-like operating systems

PulseAudio is a network-capable sound server program distributed via the freedesktop.org project. It runs mainly on Linux, including Windows Subsystem for Linux on Microsoft Windows and Termux on Android; various BSD distributions such as FreeBSD, OpenBSD, and macOS; as well as Illumos distributions and the Solaris operating system. It serves as a middleware in between applications and hardware and handles raw PCM audio streams.

This article describes audio APIs and components in Microsoft Windows which are now obsolete or deprecated.

Windows Vista has many significant new features compared with previous Microsoft Windows versions, covering most aspects of the operating system.

<span class="mw-page-title-main">Longene</span> Linux distribution

Longene is a Linux-based operating system kernel intended to be binary compatible with application software and device drivers made for Microsoft Windows and Linux. As of 1.0-rc2, it consists of a Linux kernel module implementing aspects of the Windows kernel and a modified Wine distribution designed to take advantage of the more native interface. Longene is written in the C programming language and is free and open source software. It is licensed under the terms of the GNU General Public License version 2 (GPLv2).

References

  1. "The Evolution of DirectX". Maximum PC . 3 (9): B8. October 1998. Retrieved July 21, 2019.
  2. DirectSound Capture Effects: MSDN
  3. DirectShow FAQ
  4. DirectSound Driver Models
  5. Overview of DirectSound Hardware Acceleration
  6. CakeWalk - Windows Pro Audio Roundtable
  7. Exposing Hardware-Accelerated Capture Effects
  8. "Techreport article on Vista-ready soundcards". 15 January 2008. Retrieved 2008-12-23.
  9. Creative Technology - Support - Audio in Windows Vista
  10. "OpenAL and Windows Vista". Archived from the original on 2008-01-02. Retrieved 2008-01-10.
  11. Audio Offloading: Exposing Hardware-Offloaded Audio Processing in Windows
  12. Windows Driver Kit - Windows Developer Preview - New for Audio Drivers
  13. "Implementation Overview - Windows drivers | Microsoft Docs".
  14. Windows CE 5.0 removed functionality
  15. "Creative ALchemy website". Archived from the original on 2008-12-17. Retrieved 2008-12-23.
  16. IndirectSound
  17. "DSOAL: A DirectSound DLL replacer that enables surround sound, HRTF, and EAX support via OpenAL Soft". GitHub. 20 April 2023.