Logo

bool sapi_textless_lipsync::lipsync const std::wstring &  strAudioFile  )  [virtual]
 

start the asyncronous lipsync process given a text file and an audio file

Given an audio file, this method kicks off the SAPI 5.1 DICTATION grammar on it. This is Microsoft's Speaker Independent Speech Recognition.

See also:
run_sapi_textless_lipsync for an example
Results are handled in the sapi_textless_lipsync::callback.
Parameters:
strAudioFile - [in] the source audio file
Return values:
true if lipsync got started
false if it failed to start

Definition at line 737 of file sapi_lipsync.cpp.

00738 {
00739     HRESULT hr;
00740     try
00741     {
00742         
00743         if (!this->initializeObjects())
00744             throw (HRESULT(E_FAIL));
00745         
00746         if (!this->loadAudio(strAudioFile))
00747              throw (HRESULT(E_FAIL));
00748         
00749         // initialize the grammar
00750         hr = m_grammar->LoadDictation(NULL, SPLO_STATIC);
00751         if (hr != S_OK)
00752         {
00753             m_err = L"Error: Cannot load SAPI Dictation Grammar";
00754         }
00755     
00756         hr = m_grammar->SetDictationState(SPRS_ACTIVE);
00757 
00758         if (hr != S_OK)
00759         {
00760             m_err = L"Cannot activate the SAPI Dictation Grammar";
00761             throw (hr);
00762         }
00763         
00764         m_recog->SetRecoState(SPRST_ACTIVE);
00765        
00766 
00767         // now we should be running!
00768 
00769     }
00770     catch (HRESULT _hr)
00771     {
00772         hr = _hr;
00773     }
00774     return (hr == S_OK);
00775 }


Copyright (C) 2002-2005 Annosoft LLC. All Rights Reserved.
Visit us at www.annosoft.com