次の方法で共有


DirectSoundCaptureCreate8

[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 DirectSoundCaptureCreate8 function creates and initializes an object that supports the IDirectSoundCapture8 interface. Although the older DirectSoundCaptureCreate function can also be used to obtain the IDirectSoundCapture8 interface, the object created by that function cannot be used to create capture buffers that support the IDirectSoundCaptureBuffer8 interface.

Syntax

HRESULT DirectSoundCaptureCreate8(
         LPCGUID lpcGUID,
         LPDIRECTSOUNDCAPTURE8 * lplpDSC,
         LPUNKNOWN pUnkOuter
)

Parameters

  • lpcGUID
    Address of the GUID that identifies the sound capture device. The value of this parameter must be one of the GUIDs returned by DirectSoundCaptureEnumerate, or NULL for the default device, or one of the following values.

    Value Description
    DSDEVID_DefaultCapture System-wide default audio capture device.
    DSDEVID_DefaultVoiceCapture Default voice capture device.
  • lplpDSC
    Address of a variable to receive an IDirectSoundCapture8 interface pointer.

  • pUnkOuter
    Address of the controlling object's IUnknown interface for COM aggregation. Must be NULL, because aggregation is not supported.

Return Value

If the function succeeds, it returns DS_OK. If it fails, the return value may be one of the following values.

Return Code
DSERR_ALLOCATED
DSERR_INVALIDPARAM
DSERR_NOAGGREGATION
DSERR_OUTOFMEMORY

Remarks

On sound cards that do not support full duplex, this method will fail and return DSERR_ALLOCATED.

Requirements

Header: Declared in DSound.h.

Library: Use Dsound.lib.

See Also

Creating the Capture Device Object