Note
Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.
Microsoft Speech Platform
ISpRecoContext::GetVoice
ISpRecoContext::GetVoice retrieves a reference to an ISpVoice object that is associated with the ISpRecoContext object.
<pre IsFakePre="true" xmlns="http://www.w3.org/1999/xhtml"> <strong>HRESULT GetVoice(</strong><a runat="server" href="jj127823(v=msdn.10).md"><strong>ISpVoice</strong></a> **<em>ppVoice</em> <strong>);</strong></pre>
Parameters
- ppVoice
[in] Address of the ISpVoice interface. IUnknown::Release must be called on the ISpVoice interface when finished.
Return Values
Value | Description |
---|---|
S_OK | Function completed successfully. |
E_POINTER | Pointer is not valid. |
FAILED(hr) | Appropriate error message. |
Remarks
If an application previously called ISpRecoContext::SetVoice on the same ISpRecoContext object, the Voice interface retrieved from GetVoice will match that of the SetVoice call. Release must still call the ISpVoice reference for each GetVoice call, even though the interface pointer is the same.
The output format of the ISpVoice will be the same format as the associated audio input format of the speech recognition (SR) engine (see ISpRecognizer). 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 down-sampled to the lower quality.
Applications implementing a "barge-in" type functionality will need to tie the Voice object to the SR object. Applications can also use ISpRecoContext::GetVoice (see ISpRecoContext::SetVoicePurgeEvent).