DirectX SDK

IDirectMusicPort::GetFormat

The IDirectMusicPort::GetFormat method retrieves information about the wave format specified in the DMUS_PORTPARAMS structure passed to IDirectMusic::CreatePort, and the recommended size of the buffer to use for wave output. The information can be used to create a compatible IDirectSoundBuffer for the port.

HRESULT GetFormat(
  LPWAVEFORMATEX pWaveFormatEx,
  LPDWORD pdwWaveFormatExSize
  LPDWORD pdwBufferSize
);

Parameters

pWaveFormatEx
Address of the WAVEFORMATEX structure to receive information about the format. This value can be NULL. See Remarks.
pdwWaveFormatExSize
Address of a variable that contains, or is to receive, the size of the structure. See Remarks.
pdwBufferSize
Address of a variable to receive 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.

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 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.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in dmusicc.h.

See Also

IDirectMusicPort::SetDirectSound