Microsoft Corporation
January 12, 1999
Summary: This article provides a high-level explanation of Microsoft DirectX and the components that make up the DirectX application programming interface (API). (7 printed pages)
Microsoft® DirectX® is a group of technologies designed by Microsoft to make Microsoft Windows®-based computers an ideal platform for running and displaying applications rich in multimedia elements such as full-color graphics, video, three-dimensional (3-D) animation, interactive music, and surround sound. Built directly into the Windows family of operating systems, DirectX is an integral part of Windows 98 and Windows 2000, as well as Microsoft Internet Explorer. DirectX components may also be automatically installed on your system by advanced multimedia games and applications.
DirectX gives developers a single set of APIs (application programming interfaces) that provides them with improved access to the advanced features of high-performance hardware such as 3-D graphics acceleration chips and sound cards. These APIs control what are called “low-level functions,” including two-dimensional (2-D) graphics acceleration; support for input devices such as joysticks, keyboards, and mice; and control of sound mixing and sound output. The low-level functions are supported by the components that make up DirectX: Microsoft Direct3D®, Microsoft DirectDraw®, Microsoft DirectInput®, Microsoft DirectMusic®, Microsoft DirectPlay®, Microsoft DirectSound®, and Microsoft DirectShow®.
DirectX also provides developers with tools that help them get the best possible performance from the machines they use. It automatically determines the hardware capabilities of your computer and then sets the application’s parameters to match. DirectX also allows you to run multimedia applications that require support for features that a given system doesn’t offer by simulating certain hardware devices through a “hardware emulation layer” (called HEL) that provides software-based drivers that act like hardware. For example, a DirectX game that makes use of 3-D imagery can run on a machine that doesn’t have a 3-D acceleration card because DirectX simulates the services of a 3-D acceleration card.
Before DirectX, developers creating multimedia applications for Windows machines had to customize their products so that the products would work well on the wide variety of hardware devices and configurations available on Windows machines. DirectX provides something called a “hardware abstraction layer” (HAL for short) that uses software drivers to communicate between game software and computer hardware. As a result, developers can write single versions of their products that utilize DirectX without worrying about the wide range of hardware devices and configurations in existence.
Direct3D is designed to enable world-class game and interactive 3-D graphics on a computer running Microsoft Windows. It provides device-dependent access to 3-D video-display hardware in a device-independent manner. Direct3D is a drawing interface for 3-D hardware.
Direct3D is a low-level 3-D API that is ideal for developers who need to port games and other high-performance multimedia applications to the Windows operating system. It is a device-independent way for applications to communicate with accelerator hardware at a low level.
These are some of the advanced features of Direct3D:
DirectDraw is the component of the DirectX API that allows you to directly manipulate display memory, the hardware blitter, hardware overlay support, and flipping surface support. DirectDraw provides this functionality while maintaining compatibility with existing Microsoft Windows-based applications and device drivers.
DirectDraw is a software interface that provides direct access to display devices while maintaining compatibility with the Windows graphics device interface (GDI). It is not a high-level API for graphics. DirectDraw provides a device-independent way for games and Windows subsystem software, such as three-dimensional graphics packages and digital video codecs, to gain access to the features of specific display devices.
DirectDraw works with a wide variety of display hardware, ranging from simple SVGA monitors to advanced hardware implementations that provide clipping, stretching, and non-RGB color format support. The interface is designed so that your applications can enumerate the capabilities of the underlying hardware and then use any supported hardware-accelerated features. Features that are not implemented in hardware are emulated by DirectX.
DirectDraw provides device-dependent access to display memory in a device-independent way. Essentially, DirectDraw manages display memory. Your application need only recognize some basic device dependencies that are standard across hardware implementations, such as RGB and YUV color formats and the pitch between raster lines. You need not call specific procedures to use the blitter or manipulate palette registers. Using DirectDraw, you can manipulate display memory with ease, taking full advantage of the blitting and color decompression capabilities of different types of display hardware without becoming dependent on a particular piece of hardware.
DirectDraw provides world-class game graphics on computers running Windows 95 and later, Microsoft Windows NT® version 4.0, or Windows 2000.
DirectInput provides a state-of-the art interface for a variety of input devices (joysticks, headgear, multi-button mice, and so forth) as well as the new input-output devices known as force-feedback. DirectInput offers two key benefits over the current standard API functions: support for more types of devices and faster responsiveness. By working directly with device drivers, DirectInput bypasses the Windows message system.
New features of DirectInput include support for new devices such as game pads, flight yokes, and virtual-reality headgear, as well as force-feedback devices that provide effects such as kickback when a trigger is fired, vibration, and resistance—making game experiences much more realistic and engaging.
DirectMusic is the musical component of the DirectX API. Unlike the DirectSound API, which is for the capture and playback of digital sound samples, DirectMusic works with message-based musical data, which is converted into wave samples, either in hardware or in a software synthesizer. The default software implementation uses the Microsoft Software Synthesizer to create wave samples that are then streamed to DirectSound. Instrument voices are synthesized from samples according to the downloadable sounds (DLS) standard.
As well as supporting input in Musical Instrument Digital Interface (MIDI) format, DirectMusic can compose music at run time. This music is not algorithmically generated, but is based on elements authored by a human composer using the authoring tool, DirectMusic Producer. Producer is an integrated editor that serves as the single tool for working with all DirectMusic objects including segments, styles, chordmaps, templates, and DLS instruments. The music can be performed with variations and can respond dynamically to program events. DirectMusic can also be used effectively for ambient soundscapes or sound effects. Like other components of DirectX, DirectMusic is based on the Component Object Model (COM).
DirectMusic delivers full functionality on Windows 95, Windows 98, and Windows 2000. However, hardware acceleration is available only on Windows 2000 and Windows 98, Second Edition.
DirectPlay is a high-level software interface between applications and communication services that makes it easy to connect games over the Internet, a modem link, or a network. DirectPlay features a set of tools that provide well-defined, generalized communications capabilities. These tools allow players to find game sessions and sites to manage the flow of information between hosts and players.
A family of technologies that supports all types of gaming applications, DirectPlay provides a way for applications to communicate with each other, regardless of the underlying online service or protocol. DirectPlay also resolves many connectivity issues, leaving developers free to concentrate on producing great applications. DirectPlay provides services for:
The audio component of DirectX, DirectSound, uses features such as low-latency mixing playback, accelerated hardware, and 3-D positioning to achieve professional-quality audio performance. With DirectSound, multiple audio signals can be mixed and played at the same time; sound card features are automatically engaged or emulated in the software if not supported by the existing hardware; and custom mixing engines can directly access the sound hardware. DirectSound also enables applications to change volume, frequency, and panning, and to simulate 3-D effects such as roll off and Doppler shift.
New DirectSound features in DirectX 7.0 include hardware voice management and selectable software 3-D audio processing algorithms. Voice management ensures that advanced audio acceleration features found in today’s sound cards can be used to the maximum extent possible. DirectX 7.0 provides three new software 3-D audio algorithms, a high-speed Pan3D algorithm, and two different VMAx™ Head Related Transfer Function (HRTF) algorithms from Harman Industries. The ability to select the software algorithm on a buffer-by-buffer basis ensures that an application can make an appropriate tradeoff between CPU efficiency and quality of the 3-D audio effect. The fastest Pan3D algorithm enables applications to use the DirectSound3D API and be assured that the CPU utilization will be no more than if they had used a regular DirectSound 2-D buffer.
Essentially a sound mixing engine, DirectSound places sets of sounds in secondary buffers, combines them and writes them into primary buffers. Only the available processing time limits the number of buffers that DirectSound can mix.
DirectShow is a media-streaming architecture for the Microsoft Windows platform that enables the high-quality capture and playback of multimedia streams. The streams can contain video and audio data compressed in a wide variety of formats, including MPEG, audio-video interleaved (AVI), MPEG-1 Layer 3 (MP3), and WAV files. Capture can be based on either Windows Driver Model (WDM) or legacy Video for Windows (VFW) devices. DirectShow is integrated with DirectX technologies so that it automatically takes advantage of any video and audio acceleration hardware to deliver the highest possible performance.
DirectShow is designed to make it as simple as possible to perform basic playback, format conversion, and capture tasks while at the same time providing access to the underlying stream control architecture for those applications that require custom solutions. You can even create your own DirectShow components to support new formats or custom effects.
Examples of the types of applications you can write with DirectShow include: DVD Players, Digital Video Editors, WAV to ASF Converters; MP3 Players; Digital and Analog Video and Audio Capture applications.
Microsoft’s goal in developing DirectX was to provide developers with a common set of instructions and components that would allow developers to be confident that their multimedia applications would run on any Windows-based PC, no matter what the hardware, and at the same time ensure that their products take full advantage of high-performance hardware capabilities to achieve the best possible performance.
DirectX provides developers with new opportunities for creativity and innovation by allowing them to focus on building unique features for their application without worrying about which display adapter, sound card, or 3-D accelerator chip is installed in the user’s PC. Because DirectX was designed to support future innovations in software and hardware, developers and consumers can be confident that they will continue to get the best possible performance from their applications as technology advances.