Managing Waveform-Audio Recording

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

After you open a waveform-audio input device, you can begin recording waveform-audio data. Waveform-audio data is recorded into application-supplied buffers specified by a WAVEHDR structure. These data blocks must be prepared before they are used; for more information, see Audio Data Blocks.

Windows provides the following functions to manage waveform-audio recording.

Function Description
waveInAddBuffer Sends a buffer to the device driver so it can be filled with recorded waveform-audio data.
waveInReset Stops waveform-audio recording and marks all pending buffers as done.
waveInStart Starts waveform-audio recording.
waveInStop Stops waveform-audio recording.

 

Use the waveInAddBuffer function to send buffers to the device driver. As the buffers are filled with recorded waveform-audio data, the application is notified with a window message, callback message, thread message, or event, depending on the flag specified when the device was opened.

Before you begin recording by using waveInStart, you should send at least one buffer to the driver, or incoming data could be lost.

Before closing the device using waveInClose, call waveInReset to mark any pending data blocks as being done.

Recording Waveform Audio