Logo

bool sapi_lipsync::loadAudio const std::wstring &  audioFile  ) 
 

this method loads the audio file into the ISPStream

This method uses the sapi helpers to create an ISpStream object given an audio file

Parameters:
audioFile - [in] path to audio file
Returns:
true if successful, false if not. Sets an appropriate error code
set the input stream to our newly created audio file

Definition at line 208 of file sapi_lipsync.cpp.

00209 {
00210     HRESULT hr = S_OK;
00211 
00212     this->m_strAudioFile = audioFile;
00213     try
00214     {
00215         m_bDone = false;
00216         
00217         hr = SPBindToFile(audioFile.c_str(), SPFM_OPEN_READONLY, &this->m_audioStream);
00218         if (hr != S_OK)
00219         {
00220             m_err = L"Error: Can't open audio file";
00221             throw(hr);
00222         }
00223         GUID guid; // unused
00224         hr = this->m_audioStream->GetFormat(&guid, &m_pWaveFmt);
00225         if (hr != S_OK)
00226         {
00227             m_err = L"Error: cannot get audio formatting information";
00228             throw (hr);
00229         }
00230         
00232         hr = this->m_recog->SetInput(this->m_audioStream, TRUE);
00233         if (hr != S_OK)
00234         {
00235             m_err = L"Error: cannot set the input stream for ASR";
00236             throw (hr);
00237         }
00238     }
00239     catch (HRESULT& _hr)
00240     {
00241         hr = _hr;
00242     }
00243     return (hr == S_OK);
00244 
00245 }


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