Capturing Waveforms

[The feature associated with this page, DirectSound, is a legacy feature. It has been superseded by WASAPI and Audio Graphs. Media Casting have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use Media Casting instead of DirectSound, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

DirectSound can be used to capture sounds, as an alternative to the Windows Multimedia functions such as waveInOpen. Other than support for acoustic echo cancellation (AEC), DirectSound offers no performance advantages over the Windows Multimedia functions.

The DirectSound capture device object, represented by the IDirectSoundCapture8 interface, is used to query the capabilities of sound capture devices and to create buffers for capturing audio from an input source. Data can be captured in PCM or compressed formats.

The DirectSound capture buffer object, represented by the IDirectSoundCaptureBuffer8 interface, represents a buffer used for receiving data from the input device. Like playback buffers, this buffer is conceptually circular: when input reaches the end of the buffer, it automatically starts again at the beginning.

The methods of IDirectSoundCaptureBuffer8 enable you to retrieve the properties of the buffer, start and stop audio capture, and lock portions of the memory, so that you can safely retrieve data for saving to a file or for playback in a full-duplex implementation. On operating systems that support capture effects, this interface also provides methods for retrieving DMOs and ascertaining the status of effects.

More information about waveform capture is found in the following topics: