DirectKS Sample Application

Updated: December 20, 2002

The DirectKS sample application program demonstrates how a user-mode client can achieve direct access to kernel streaming (KS) filters. The sample application plays a wave audio stream through an audio-rendering device. However, with relatively little effort, the application can be modified to record a wave audio stream from an audio-capture device. The classes that are implemented in the sample code support both audio rendering and capture.

The DirectKS approach should be used only by applications with special requirements (such as low latency) that preclude using one of the standard audio APIs to play or record wave audio data. Most audio applications should use Microsoft DirectSound or the waveOut and waveIn APIs instead.

However, for operating systems such as Microsoft Windows 2000, Windows XP, and Windows .NET Server 2003, ISVs must contend with an audio subsystem that adds a minimum of 30 milliseconds of output latency to an audio stream. For these operating systems, the truly latency-focused ISV may find it worthwhile to write extra code to bypass the existing multimedia APIs and communicate directly with the audio driver. The DirectKS sample illustrates a simple application that uses the SetupDi API and KS property IOCTLs to discover and open KS filters and pins on a WDM audio driver, and to stream audio data to the KS pin in a direct manner.

Note:
Using the DirectKS approach results in exclusive access to the audio device, which can break many aspects of the user experience, including disabling warning alert sounds and loss of interoperability with other audio applications. For this reason, the Windows multimedia team actively discourages the direct use of KS properties in applications that do not require such low-level control. For applications that do need this low-level control, the application should relinquish control of the device when the application is not the foreground process and is not actively streaming. The sample code illustrates one possible implementation of this guideline.

The Microsoft Windows audio team is working hard to reduce overall audio latency in future Windows operating systems. An important part of this effort is to provide low-latency implementations of audio APIs in order to eliminate any need to access the KS audio components directly.

The plan for future Windows products is to provide built-in multimedia APIs and core services with very low latency and complete bit-for-bit transparency. These features should eliminate the need for any application program to circumvent the audio subsystem. The IOCTL requests used by the sample application rely on internal aspects of the current architecture that are likely to change in future operating systems. Be forewarned that the DirectKS approach is unlikely to work on operating systems after Windows XP and Windows Server 2003.

*

Please read the license agreement before continuing.


Top of pageTop of page