Microsoft DirectX 8.1 (C++) |
The GetFormat method retrieves a description of the format of the sound data in the buffer, or the buffer size needed to retrieve the format description.
Syntax
HRESULT GetFormat(
LPWAVEFORMATEX pwfxFormat,
DWORD dwSizeAllocated,
LPDWORD pdwSizeWritten
);
Parameters
pwfxFormat
Address of a WAVEFORMATEX structure that receives 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 variable at pdwSizeWritten receives the size of the structure needed to receive the data.
dwSizeAllocated
Size, in bytes, of the structure at pwfxFormat. If pwfxFormat is not NULL, this value must be equal to or greater than the size of the expected data.
pdwSizeWritten
Address of a variable that receives the number of bytes written to the structure at pwfxFormat. 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 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 pwfxFormat parameter. The necessary size of the structure is returned in the pdwSizeWritten parameter. The application can then allocate sufficient memory and call IDirectSoundBuffer8::GetFormat again to retrieve the format description.
Requirements
Header: Declared in dsound.h.
See Also