HRESULT GetFormat(LPWAVEFORMATEX lpwfxFormat,
DWORD dwSizeAllocated, LPDWORD lpdwSizeWritten);
Retrieves a description of the format of the sound data in the buffer, or the buffer size needed to retrieve the format description.
·Returns DS_OK if successful, or DSERR_INVALIDPARAM otherwise.
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.
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.
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.