The GetFormat method retrieves information about the wave format.
HRESULT
GetFormat(
LPWAVEFORMATEX pWaveFormatEx,
LPDWORD pdwWaveFormatExSize
);
GetFormat returns S_OK if the call was successful. Otherwise, the method returns an appropriate error code. The following table shows some of the possible return status codes.
| Error Code | Description |
|---|---|
| E_POINTER | Indicates that one of the pointers is not valid. |
| DMUS_E_SYNTHNOTCONFIGURED | Indicates that the synth is not open or is not properly configured. |
Declared in dmusics.h. Include dmusics.h.
The WAVEFORMATEX structure can have a variable length that depends on the details of the format. Therefore, before retrieving the format description, an application will first query the IDirectMusicSynth object for the size of the format by calling this method and specifying NULL for the pWaveFormatEx parameter. In this case, the synth should return the size of the structure in the pdwWaveFormatExSize parameter. The application can then allocate sufficient memory and call IDirectMusicSynth::GetFormat again to retrieve the format description.
If the pWaveFormatEx parameter is not NULL, DirectMusic writes, at most, pdwWaveFormatExSize bytes to pWaveFormatEx.
For more information, see the description of the IDirectMusicPort interface and IDirectMusicPort::GetFormat method in the Platform SDK documentation.