Note

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

Microsoft Speech Platform

ISpRecoContext::SetVoice

ISpRecoContext::SetVoice sets the associated ISpVoice to an object.

<pre IsFakePre="true" xmlns="http://www.w3.org/1999/xhtml"> <strong>HRESULT SetVoice(</strong><a runat="server" href="jj127823(v=msdn.10).md"><strong>ISpVoice</strong></a> *<em>pVoice</em>, <strong> BOOL</strong> <em>fAllowFormatChanges</em> <strong>);</strong> </pre>

Parameters

  • pVoice
    [in] The voice interface to be associated. If NULL, the currently associated voice is released.
  • fAllowFormatChanges
    [in] Boolean that allows alteration of the voice format by the speech recognition engine. See Remarks section.

Return Values

Value Description
S_OK Function completed successfully.
E_POINTER pVoice is not valid or bad.
FAILED(hr) Appropriate error message.

Remarks

If fAllowFormatChanges is TRUE, the voice's output format will be changed to be the same format as the associated speech recogition (SR) engine's audio input format (see ISpRecognizer). However, if this voice object has already been bound to a stream which has a specific format, the voice's format will not be changed to the SR engine's audio input format even if fAllowFormatChanges is true.

Using the same audio format for input and output source is useful for sound cards that do not support full-duplex audio (that is, the input format must match the output format). If the input format quality is lower than the output format quality, the output format quality will be reduced to equal the input quality.

After calling ISpRecoContext::SetVoice, an application that calls ISpRecoContext::GetVoice will retrieve the ISpVoice interface pointer that was originally set.