共用方式為


IDirectSoundFullDuplex8::Initialize 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 Initialize method initializes a full-duplex object that was created by using CoCreateInstance.

Syntax

HRESULT Initialize(
         LPCGUID pCaptureGuid,
         LPCGUID pRenderGuid ,
         LPCDSCBUFFERDESC lpDscBufferDesc ,
         LPCDSBUFFERDESC lpDsBufferDesc,
         HWND hWnd ,
         DWORD dwLevel ,
         LPLPDIRECTSOUNDCAPTUREBUFFER8 lplpDirectSoundCaptureBuffer8 ,
         LPLPDIRECTSOUNDBUFFER8 lplpDirectSoundBuffer8
)

Parameters

  • pCaptureGuid
    Address of the GUID that identifies the sound capture device for full duplex input. Must be one of the GUIDs returned by DirectSoundCaptureEnumerate, NULL for the default capture device, or one of the values shown in the following table.

    Value Description
    DSDEVID_DefaultCapture System-wide default audio capture device.
    DSDEVID_DefaultVoiceCapture Default voice capture device.
  • pRenderGuid
    Address of the GUID that identifies the sound rendering device for full-duplex output. Must be one of the GUIDs returned by DirectSoundEnumerate, NULL for the default rendering device, or one of the values shown in the following table.

    Value Description
    DSDEVID_DefaultPlayback System-wide default audio playback device.
    DSDEVID_DefaultVoicePlayback Default voice playback device.
  • lpDscBufferDesc
    Address of a DSCBUFFERDESC structure that specifies the characteristics of the capture buffer.

  • lpDsBufferDesc
    Address of a DSBUFFERDESC structure that specifies the characteristics of the render buffer.

  • hWnd
    Handle to the application window.

  • dwLevel
    Cooperative level for the device. For more information, see SetCooperativeLevel.

  • lplpDirectSoundCaptureBuffer8
    Address of a variable that receives the IDirectSoundCaptureBuffer8 interface of the capture buffer.

  • lplpDirectSoundBuffer8
    Address of a variable that receives the IDirectSoundBuffer8 interface of the render buffer.

Return Value

If the method succeeds, the return value is DS_OK.

If it fails, the return value may be one of the values shown in the following table.

Return code
DSERR_ALREADYINITIALIZED
DSERR_BADFORMAT
DSERR_GENERIC
DSERR_INVALIDPARAM
DSERR_NODRIVER
DSERR_OUTOFMEMORY
DSERR_UNINITIALIZED

Requirements

Header: Declared in DSound.h.

Library: Use Dsound3d.dll.

See Also

IDirectSoundFullDuplex8