Microsoft DirectX 9.0


The GetFormat method retrieves information about the WAV format specified in the DMUS_PORTPARAMS8 structure passed to IDirectMusic8::CreatePort, and the recommended size of the buffer to use for waveform output. The information can be used to create a compatible DirectSound buffer for the port.


HRESULT GetFormat(
  LPDWORD pdwWaveFormatExSize
  LPDWORD pdwBufferSize



Address of the WAVEFORMATEX structure that receives information about the format. This value can be NULL. See Remarks.


Address of a variable that specifies or receives the size of the structure. See Remarks.


Address of a variable that receives the recommended size of the DirectSound buffer.

Return Values

Return values are determined by the implementation. If the method succeeds, it returns S_OK.

If it fails, the method can return E_POINTER.


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 synthesizer object for the size of the format by calling this method and specifying NULL for the pWaveFormatEx parameter. The size of the structure is returned in the variable pointed to by pdwWaveFormatExSize. The application can then allocate sufficient memory and call GetFormat again to retrieve the format description.

If pWaveFormatEx is not NULL, DirectMusic writes, at most, pdwWaveFormatExSize bytes to the structure.


  Header: Declared in dmusicc.h.

See Also