CHMlib Logo Leading Translation Management System for Translation Agencies, Top Translation Management Software for Freelance Translators, Time Tracking Software, Word Count, Character Count and Line Count Software, Computer Assisted Translation Tool for Easy Word Count, Clipboard Character Count Software, User-Friendly Translation Memory Software, Terminology Management Software, Terminology Management Server, Microsoft Glossary Software, Dictionary of Acronyms, Social Network for Translators and Translation Agencies, Acronyms and Abbreviations Search Engine, Russian Translation Lab, Ukrainian Translation Lab.
You are reading help file online using chmlib.com
CrisisHelper - First Aid in Tough Times of World Economic Crisis


The Microsoft.com Speech website Microsoft Speech SDK

SAPI 5.1

ISpRecoContext::SetVoice

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

HRESULT SetVoice(
   ISpVoice   *pVoice,
   BOOL        fAllowFormatChanges
);

Parameters

pVoice
[in] The voice interface to be associated. If NULL, the currently associated Voice is Released.
fAllowFormatChanges
[in] Boolean allowing the voice format alteration by the engine. See Remarks section.

Return values

Value Description
S_OK Function completed successfully.
E_POINTER pVoice is invalid 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 SR engine's audio input format (see ISpRecognizer and ISpSREngine::GetInputAudioFormat). However, if this voice object has already been bound to a stream which has 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 (i.e., input format must match 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 originally "set" ISpVoice interface pointer.

Example

The following code snippet illustrates the use of ISpRecoContext::SetVoice and "barge-in" setup.

    HRESULT hr = S_OK;

    // create a shared recognition context
    hr = cpRecoContext.CoCreateInstance(CLSID_SpSharedRecoContext);
    // Check hr

    // create a voice
    hr = cpVoice.CoCreateInstance(CLSID_SpVoice);
    // Check hr

    // associate the voice with the context (with same audio format as context)
    hr = cpRecoContext->SetVoice(cpVoice, TRUE);
    // Check hr

    // tell the associated Voice to stop speaking when the SR Engine hears a recognizable sound
    hr = cpRecoContext->SetVoicePurgeEvent(SPFEI(SPEI_SOUND_START));
    // Check hr


You are reading help file online using chmlib.com

If you want your help file to be removed or added please send e-mail to chmlibcom@gmail.com
Partner sites: Logo Design, Simple Anti-Crisis Accounting Software, Voice Search for Web