Partager via


IDirectSoundCapture8::CreateCaptureBuffer Method

[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.]

The CreateCaptureBuffer method creates a buffer for capturing waveform audio.

Syntax

HRESULT CreateCaptureBuffer(
         LPCDSCBUFFERDESC pcDSCBufferDesc,
         LPDIRECTSOUNDCAPTUREBUFFER * ppDSCBuffer,
         LPUNKNOWN pUnkOuter
)

Parameters

  • pcDSCBufferDesc
    Pointer to a DSCBUFFERDESC structure containing values for the capture buffer being created.
  • ppDSCBuffer
    Address of a variable that receives an IDirectSoundCaptureBuffer interface pointer. Use QueryInterface to obtain IDirectSoundCaptureBuffer8. See Remarks.
  • pUnkOuter
    Address of the controlling object's IUnknown interface for COM aggregation. Must be NULL.

Return Value

If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following error values.

Return code
DSERR_INVALIDPARAM
DSERR_BADFORMAT
DSERR_GENERIC
DSERR_NODRIVER
DSERR_OUTOFMEMORY
DSERR_UNINITIALIZED

Remarks

On Microsoft Windows98 and Windows2000, each capture device supports a single buffer.

The IDirectSoundCaptureBuffer8 interface is supported only on buffers created by an object of class CLSID_DirectSoundCapture8. If the IDirectSoundCapture8 interface was obtained from DirectSoundCaptureCreate8, IDirectSoundCaptureBuffer8 is supported. If IDirectSoundCapture8 was obtained from the earlier DirectSoundCaptureCreate function, only IDirectSoundCaptureBuffer is supported.

Requirements

Header: Declared in DSound.h.

Library: Use Dsound3d.dll.

See Also

IDirectSoundCapture8