Share via


DirectSoundCreate8

[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 DirectSoundCreate8 function creates and initializes an object that supports the IDirectSound8 interface.

Syntax

HRESULT DirectSoundCreate8(
         LPCGUID lpcGuidDevice,
         LPDIRECTSOUND8 * ppDS8,
         LPUNKNOWN pUnkOuter
)

Parameters

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

    Value Description
    DSDEVID_DefaultPlayback System-wide default audio playback device. Equivalent to NULL.
    DSDEVID_DefaultVoicePlayback Default voice playback device.
  • ppDS8
    Address of a variable to receive an IDirectSound8 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.

Return Code
DSERR_ALLOCATED
DSERR_INVALIDPARAM
DSERR_NOAGGREGATION
DSERR_NODRIVER
DSERR_OUTOFMEMORY

Remarks

The application must call the IDirectSound8::SetCooperativeLevel method immediately after creating a device object.

Requirements

Header: Declared in DSound.h.

Library: Use Dsound.lib.

See Also

IDirectSound8::GetCaps
IDirectSound8::SetCooperativeLevel
Creating the Device Object