共用方式為


IDirectMusicPort8::GetFormat

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.

Syntax

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

Parameters

pWaveFormatEx

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

pdwWaveFormatExSize

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

pdwBufferSize

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.

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

**  Header:** Dmusicc.h

See Also

© 2004 Microsoft Corporation. All rights reserved.