IDirectSound::Compact

[The feature associated with this page, DirectSound, is a legacy feature. It has been superseded by XAudio2 and Audio Graphs. These newer frameworks have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use XAudio2 and Audio Graphs instead of DirectSound, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

This method moves the unused portions of on-board sound memory, if any, to a contiguous block so that the largest portion of free memory will be available.

Syntax

HRESULT Compact();

Parameters

None.

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_PRIOLEVELNEEDED
DSERR_UNINITIALIZED

Remarks

The application's DirectSound object must have at least the DSSCL_PRIORITY cooperative level. See IDirectSound::SetCooperativeLevel.

Requirements

Header: Declared in DSound.h.

Library: Use Dsound.lib.

See Also

IDirectSound::SetCooperativeLevel