本文整理汇总了C++中CItemList::GetNext方法的典型用法代码示例。如果您正苦于以下问题:C++ CItemList::GetNext方法的具体用法?C++ CItemList::GetNext怎么用?C++ CItemList::GetNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CItemList
的用法示例。
在下文中一共展示了CItemList::GetNext方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OutputSentence
/*****************************************************************************
* CTTSEngObj::OutputSentence *
*----------------------------*
* This method is used to output an item list.
****************************************************************************/
HRESULT CTTSEngObj::OutputSentence( CItemList& ItemList, ISpTTSEngineSite* pOutputSite )
{
HRESULT hr = S_OK;
ULONG WordIndex;
//--- Lookup words in our voice
SPLISTPOS ListPos = ItemList.GetHeadPosition();
while( ListPos && !(pOutputSite->GetActions() & SPVES_ABORT) )
{
CSentItem& Item = ItemList.GetNext( ListPos );
//--- Process sentence items
switch( Item.pXmlState->eAction )
{
//--- Speak some text ---------------------------------------
case SPVA_Speak:
{
//--- We don't say anything for punctuation or control characters
// in this sample.
if( iswalpha( Item.pItem[0] ) || iswdigit( Item.pItem[0] ) )
{
//--- Lookup the word, if we can't find it just use the first one
for( WordIndex = 0; WordIndex < m_ulNumWords; ++WordIndex )
{
if( ( m_pWordList[WordIndex].ulTextLen == Item.ulItemLen ) &&
( !wcsnicmp( m_pWordList[WordIndex].pText, Item.pItem, Item.ulItemLen )) )
{
break;
}
}
if( WordIndex == m_ulNumWords )
{
WordIndex = 0;
}
//--- Queue the event
CSpEvent Event;
Event.eEventId = SPEI_WORD_BOUNDARY;
Event.elParamType = SPET_LPARAM_IS_UNDEFINED;
Event.ullAudioStreamOffset = m_ullAudioOff;
Event.lParam = Item.ulItemSrcOffset;
Event.wParam = Item.ulItemSrcLen;
hr = pOutputSite->AddEvents( &Event, 1 );
//--- Queue the audio data
hr = pOutputSite->Write( m_pWordList[WordIndex].pAudio,
m_pWordList[WordIndex].ulNumAudioBytes,
NULL );
//--- Update the audio offset
m_ullAudioOff += m_pWordList[WordIndex].ulNumAudioBytes;
}
}
break;
//--- Output some silence for a pause -----------------------
case SPVA_Silence:
{
BYTE Buff[1000];
memset( Buff, 0, 1000 );
ULONG NumSilenceBytes = Item.pXmlState->SilenceMSecs * 22;
//--- Queue the audio data in chunks so that we can get
// interrupted if necessary.
while( !(pOutputSite->GetActions() & SPVES_ABORT) )
{
if( NumSilenceBytes > 1000 )
{
hr = pOutputSite->Write( Buff, 1000, NULL );
NumSilenceBytes -= 1000;
}
else
{
hr = pOutputSite->Write( Buff, NumSilenceBytes, NULL );
break;
}
}
//--- Update the audio offset
m_ullAudioOff += NumSilenceBytes;
}
break;
//--- Fire a bookmark event ---------------------------------
case SPVA_Bookmark:
{
//--- The bookmark is NOT a null terminated string in the Item, but we need
//--- to convert it to one. Allocate enough space for the string.
WCHAR * pszBookmark = (WCHAR *)_alloca((Item.ulItemLen + 1) * sizeof(WCHAR));
memcpy(pszBookmark, Item.pItem, Item.ulItemLen * sizeof(WCHAR));
pszBookmark[Item.ulItemLen] = 0;
//--- Queue the event
SPEVENT Event;
Event.eEventId = SPEI_TTS_BOOKMARK;
Event.elParamType = SPET_LPARAM_IS_STRING;
//.........这里部分代码省略.........