IDirectSoundBuffer::GetFormat
This method retrieves a description of the format of the sound data in the buffer, or the buffer size needed to retrieve the format description.
HRESULT GetFormat(
LPWAVEFORMATEX lpwfxFormat,
DWORD dwSizeAllocated,
LPDWORD lpdwSizeWritten
);
Parameters
- lpwfxFormat
Address of the WAVEFORMATEX structure to contain a description of the sound data in the buffer. To retrieve the buffer size needed to contain the format description, specify NULL. In this case the DWORD pointed to by the lpdwSizeWritten parameter will receive the size of the structure needed to receive complete format information. - dwSizeAllocated
Size, in bytes, of the WAVEFORMATEX structure. DirectSound writes, at most, dwSizeAllocated bytes to that pointer; if the WAVEFORMATEX structure requires more memory, it is truncated. - lpdwSizeWritten
Address of a variable to contain the number of bytes written to the WAVEFORMATEX structure. This parameter can be NULL.
Return Values
If the method succeeds, the return value is DS_OK.
If the method fails, the return value may be DSERR_INVALIDPARAM.
Remarks
The WAVEFORMATEX structure can have a variable length that depends on the details of the format. Before retrieving the format description, the application should query the DirectSoundBuffer object for the size of the format by calling this method and specifying NULL for the lpwfxFormat parameter. The size of the structure will be returned in the lpdwSizeWritten parameter. The application can then allocate sufficient memory and call IDirectSoundBuffer::GetFormat again to retrieve the format description.
Requirements
OS Versions: Windows CE 2.12 and later. Version 2.12 requires DXPAK 1.0 or later.
Header: Dsound.h.
Link Library: Dsound.lib.
See Also
IDirectSoundBuffer | IDirectSoundBuffer::SetFormat
Last updated on Thursday, April 08, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.