本文整理汇总了C++中CSpEvent::Viseme方法的典型用法代码示例。如果您正苦于以下问题:C++ CSpEvent::Viseme方法的具体用法?C++ CSpEvent::Viseme怎么用?C++ CSpEvent::Viseme使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSpEvent
的用法示例。
在下文中一共展示了CSpEvent::Viseme方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MainHandleSynthEvent
void CTTSApp::MainHandleSynthEvent()
/////////////////////////////////////////////////////////////////
//
// Handles the WM_TTSAPPCUSTOMEVENT application defined message and all
// of it's appropriate SAPI5 events.
//
{
CSpEvent event; // helper class in sphelper.h for events that releases any
// allocated memory in it's destructor - SAFER than SPEVENT
SPVOICESTATUS Stat;
WPARAM nStart;
LPARAM nEnd;
int i = 0;
HRESULT hr = S_OK;
while( event.GetFrom(m_cpVoice) == S_OK )
{
switch( event.eEventId )
{
case SPEI_START_INPUT_STREAM:
if( IsDlgButtonChecked( m_hWnd, IDC_EVENTS ) )
{
TTSAppStatusMessage( m_hWnd, _T("StartStream event\r\n") );
}
break;
case SPEI_END_INPUT_STREAM:
// Set global boolean stop to TRUE when finished speaking
m_bStop = TRUE;
// Highlight entire text
nStart = 0;
nEnd = SendDlgItemMessage( m_hWnd, IDE_EDITBOX, WM_GETTEXTLENGTH, 0, 0 );
SendDlgItemMessage( m_hWnd, IDE_EDITBOX, EM_SETSEL, nStart, nEnd );
// Mouth closed
g_iBmp = 0;
InvalidateRect( m_hChildWnd, NULL, FALSE );
if( IsDlgButtonChecked( m_hWnd, IDC_EVENTS ) )
{
TTSAppStatusMessage( m_hWnd, _T("EndStream event\r\n") );
}
break;
case SPEI_VOICE_CHANGE:
if( IsDlgButtonChecked( m_hWnd, IDC_EVENTS ) )
{
TTSAppStatusMessage( m_hWnd, _T("Voicechange event\r\n") );
}
break;
case SPEI_TTS_BOOKMARK:
if( IsDlgButtonChecked( m_hWnd, IDC_EVENTS ) )
{
// Get the string associated with the bookmark
// and add the null terminator.
TCHAR szBuff2[MAX_PATH] = _T("Bookmark event: ");
size_t cEventString = wcslen( event.String() ) + 1;
WCHAR *pwszEventString = new WCHAR[ cEventString ];
if ( pwszEventString )
{
wcscpy_s( pwszEventString, cEventString, event.String() );
_tcscat_s( szBuff2, _countof(szBuff2), CW2T(pwszEventString) );
delete[] pwszEventString;
}
_tcscat_s( szBuff2, _countof(szBuff2), _T("\r\n") );
TTSAppStatusMessage( m_hWnd, szBuff2 );
}
break;
case SPEI_WORD_BOUNDARY:
hr = m_cpVoice->GetStatus( &Stat, NULL );
if( FAILED( hr ) )
{
TTSAppStatusMessage( m_hWnd, _T("Voice GetStatus error\r\n") );
}
// Highlight word
nStart = (LPARAM)( Stat.ulInputWordPos / sizeof(char) );
nEnd = nStart + Stat.ulInputWordLen;
SendDlgItemMessage( m_hWnd, IDE_EDITBOX, EM_SETSEL, nStart, nEnd );
if( IsDlgButtonChecked( m_hWnd, IDC_EVENTS ) )
{
TTSAppStatusMessage( m_hWnd, _T("Wordboundary event\r\n") );
}
break;
case SPEI_PHONEME:
if( IsDlgButtonChecked( m_hWnd, IDC_EVENTS ) )
{
TTSAppStatusMessage( m_hWnd, _T("Phoneme event\r\n") );
}
break;
case SPEI_VISEME:
// Get the current mouth viseme position and map it to one of the
// 7 mouth bitmaps.
g_iBmp = g_aMapVisemeToImage[event.Viseme()]; // current viseme
//.........这里部分代码省略.........