Share via


Note

Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

Microsoft Speech Platform

CSpStreamFormat::AssignFormat

CSpStreamFormat::AssignFormat assigns (or copies) the instance's current format to a new format (or a new stream).

Converts the instance's stream format into a wave format structure.

<pre IsFakePre="true" xmlns="http://www.w3.org/1999/xhtml"> <strong>HRESULT AssignFormat(</strong> <strong><a runat="server" href="jj127480(v=msdn.10).md">SPSTREAMFORMAT</a></strong> <em>eFormat</em> <strong>);</strong> </pre>

Parameters

  • eFormat
    [in] The requested stream format. Must be a valid SPSTREAMFORMAT value of SPSF_8kHz8BitMono or greater.

Return Values

Value Description
S_OK Function completed successfully.
E_OUTOFMEMORY Exceeded available memory.
E_INVALIDARG Either class member m_guidFormatId or m_pCoMemWaveFormatEx is invalid or bad. Alternatively, the current format is not recognized.
FAILED(hr) Appropriate error message.

Converts instance's stream format into a cached format. Class member m_pCoMemWaveFormatEx will be NULL if an error occurred.

<pre IsFakePre="true" xmlns="http://www.w3.org/1999/xhtml"> <strong>HRESULT AssignFormat(</strong> <strong> <a runat="server" href="jj127807(v=msdn.10).md">ISpStreamFormat</a></strong> *<em>pStream</em> <strong>);</strong> </pre>

Parameters

  • pStream
    [in] An ISpStreamFormat object.

Return Values

Value Description
S_OK Function completed successfully.
E_POINTER Either class member m_guidFormatId or m_pCoMemWaveFormatEx is invalid or bad.

Converts instance's stream format into the specified wave format. Class member m_guidFormatId will be GUID_NULL if an error occurred.

<pre IsFakePre="true" xmlns="http://www.w3.org/1999/xhtml"> <strong>HRESULT AssignFormat(</strong> <strong> const <a runat="server" href="jj127893(v=msdn.10).md">WAVEFORMATEX</a> </strong>*<em>pWaveFormatEx</em> <strong>);</strong> </pre>

Parameters

  • pWaveFormatEx
    [in] Address of the WAVEFORMATEX structure containing the wave file format information.

Return Values

Value Description
S_OK Function completed successfully.
E_OUTOFMEMORY Exceeded available memory.

<pre IsFakePre="true" xmlns="http://www.w3.org/1999/xhtml"> <strong>HRESULT AssignFormat(</strong> <strong>REFGUID</strong> <em>rguidFormatId</em>, <strong> const <a runat="server" href="jj127893(v=msdn.10).md">WAVEFORMATEX</a></strong> *<em>pWaveFormatEx</em> <strong>);</strong> </pre>

Parameters

  • rguidFormatId
    [in] The reference ID. If specified as SPDFID_WaveFormatEx, pWaveFormatEx is a WAVEFORMATEX data structure. Otherwise this is set to GUID_NULL.
  • pWaveFormatEx
    [in] If rguidFormatId is not set to SPDFID_WaveFormatEx, this is passed back as NULL.

Return Values

Value Description
S_OK Function completed successfully.
E_INVALIDARG pWaveFormatEx is invalid or bad.
E_OUTOFMEMORY Exceeded available memory.

<pre IsFakePre="true" xmlns="http://www.w3.org/1999/xhtml"> <strong>HRESULT AssignFormat(</strong> <strong>const CSpStreamFormat</strong> &amp; Src <strong>);</strong> </pre>

Parameters

  • Src
    [out] The stream to copy to.

Return Values

Value Description
S_OK Function completed successfully.
E_OUTOFMEMORY Exceeded available memory.