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

ISpVoice::SetOutput

ISpVoice::SetOutput sets the current output object.  The object may either be a stream, audio device, or an object token for an output audio device.  If pUnkOutput is NULL the default audio device will be used.

HRESULT SetOutput(
   IUnknown   *pUnkOutput,
   BOOL        fAllowFormatChanges
);

Parameters

pUnkOutput
[in] IUnknown pointer to output object. The pointer must point to an object that implements ISpStreamFormat (a stream or audio device), or an object that implements ISpObjectToken. If a token is provided, this method will create the object described by the token and use it. If pUnkOutput is NULL, the default audio out device will be used.
fAllowFormatChanges
[in] Flag specifying whether the voice is allowed to change the format of the audio output object to match that of the engine, or a wav stream being spoken. If FALSE, the voice will use the SAPI format converter to translate between the data being rendered and the format of the output object. This should be set to TRUE if using the default audio device and the output format is of no consequence. If pUnkOutput is an ISpStreamFormat object, fAllowFormatChanges is ignored. In this case, the voice instance will render the output audio data in the format of the specified stream to the application.

Return values

Value Description
S_OK Function completed successfully.
E_INVALIDARG One or more parameters are invalid.
SPERR_UNINITIALIZED pUnkOutput is an uninitialized ISpStream object.
E_OUTOFMEMORY Exceeded available memory.
Example:

The following is an example of how to enumerate all the available audio output devices registered under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\AudioOutput.

HRESULT                  hr = S_OK;
CComPtr<ISpObjectToken>        cpAudioOutToken;
CComPtr<IEnumSpObjectTokens>        cpEnum;
CComPtr<ISpVoice>        cpVoice;
ULONG          ulCount = 0;

// Create the SAPI voice
if(SUCCEEDED(hr))
    hr = cpVoice.CoCreateInstance( CLSID_SpVoice ); 

//Enumerate the available audio output devices 
if(SUCCEEDED(hr))
    hr = SpEnumTokens( SPCAT_AUDIOOUT, NULL, NULL, &cpEnum );

//Get the number of audio output devices
if(SUCCEEDED(hr))
    hr = cpEnum->GetCount( &ulCount );

// Obtain a list of available audio output tokens, set the output to the token, and call Speak
while ( SUCCEEDED(hr) && ulCount-- )
{
    if(SUCCEEDED(hr))
        hr = cpEnum->Next( 1, &cpAudioOutToken, NULL );

    if(SUCCEEDED(hr))
        hr = cpVoice->SetOutput( cpAudioOutToken, TRUE );

    if(SUCCEEDED(hr))
        hr = cpVoice->Speak( L"How are you?", SPF_DEFAULT, NULL ); 
}


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