共用方式為


DirectSoundFullDuplexCreate8

[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 DirectSoundFullDuplexCreate8 function creates the DirectSound and DirectSoundCapture objects and returns the IDirectSoundFullDuplex8 interface. This function requires Microsoft Windows XP. Full duplex can be implemented on other operating systems, but the capture and rendering devices must be created separately.

Syntax

HRESULT DirectSoundFullDuplexCreate8(
         LPCGUID pcGuidCaptureDevice,
         LPCGUID pcGuidRenderDevice,
         LPCDSCBUFFERDESC pcDSCBufferDesc,
         LPCDSBUFFERDESC pcDSBufferDesc,
         HWND hWnd,
         DWORD dwLevel,
         LPDIRECTSOUNDFULLDUPLEX * ppDSFD,
         LPDIRECTSOUNDCAPTUREBUFFER8 * ppDSCBuffer8,
         LPDIRECTSOUNDBUFFER8 * ppDSBuffer8,
         LPUNKNOWN pUnkOuter
)

Parameters

  • pcGuidCaptureDevice
    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.
  • pcGuidRenderDevice
    Address of the GUID that identifies the sound render device for full-duplex output. Must be one of the GUIDs returned by DirectSoundEnumerate, or NULL for the default render device, or one of the following values.

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

  • pcDSBufferDesc
    Address of a DSCBUFFERDESC 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 IDirectSound8::SetCooperativeLevel.

  • ppDSFD
    Address of a variable that receives the IDirectSoundFullDuplex8 interface pointer.

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

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

  • 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.

Return Code
DSERR_ALLOCATED
DSERR_INVALIDPARAM
DSERR_NOAGGREGATION
DSERR_NODRIVER
DSERR_OUTOFMEMORY

Remarks

Ee416764.note(en-us,VS.85).gifWindows

Important Note for Windows Vista

Existing applications that access Windows XP Acoustic Echo Cancellation (AEC) features via the DirectSound API will no longer obtain AEC when running on Windows Vista. These applications will still run, but their calls to AEC-specific DirectSound API calls will have no effect on the captured audio.

To learn how to obtain AEC in Windows Vista, See the Windows Vista AEC topics in the Windows SDK.

Requirements

Header: Declared in DSound.h.

Library: Use Dsound.lib.

See Also

Creating the Capture Device Object
Creating the Device Object