Share via


SPBindToFile

Other versions of this page are also available for the following:

Windows Mobile Not SupportedWindows Embedded CE Supported

8/28/2008

This function binds the audio stream to the specified file.

Syntax

inline HRESULT SPBindToFile(
  LPCWSTR pFileName,
  SPFILEMODE eMode,
  ISpStream** ppStream,
  const GUID* pFormatId = NULL,
  const WAVEFORMATEX* pWaveFormatEx = NULL,
  ULONGLONG* ullEventInterest = SPFEI_ALL_EVENTS
);

Parameters

  • pFileName
    [in] Pointer to a null-terminated string specifying the name of the file to which the stream is bound.
  • eMode
    [in] File opening mode. Possible values are defined for the SPFILEMODE enumeration. When the caller is opening an audio wave file, this value must be SPFM_OPEN_READONLY or SPFM_CREATE_ALWAYS. Otherwise, the call will fail.
  • ppStream
    [in, out] Address of a pointer to an object implementing ISpStream. On input, this object represents the audio stream to bind to the file. On output, If the function succeeds, this parameter indicates the bound stream object.
  • pFormatId
    [in] Pointer to the data format identifier associated with the stream. If the identifier is NULL (default) and the supplied file has the ".wav" extension, the format will be determined from the supplied wave file. If the identifier is NULL (default) and the file is not a wave file, the function assumes a text file.
  • pWaveFormatEx
    [in] Pointer to a valid WAVEFORMATEX structure containing wave file format information if pFormatId specifies SPDFID_WaveFormatEx (wave file). For other formats, this parameter should be set to NULL.
  • ullEventInterest
    [in] Pointer to flags for the events of interest. The default is flags retrieved by the SPFEI_ALL_EVENTS macro. See the Remarks section for the SPFEI macro.

Return Value

The following table shows the possible return values.

Value Description

S_OK

Function completed successfully.

E_INVALIDARG

One or more arguments are invalid.

SPERR_ALREADY_INITIALIZED

The object has already been initialized.

Requirements

Header sphelper.h
Library sapilib.lib
Windows Embedded CE Windows CE .NET 4.1 and later

See Also

Reference

SAPI Functions