×
Namespaces

Variants
Actions
Revision as of 09:44, 15 December 2011 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

NSSTTS应用API

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata

文章
huwell 在 16 Dec 2008 创建
最后由 hamishwillee 在 15 Dec 2011 编辑

CS001031

  • 开发伙伴平台:

S60 3rd Edition, FP2


  • 详细描述

注意这个API并非公开SDK的一部分,可以在SDK API Plug-in中找到。


CTtsUtility类是语音合成的主要接口。它提供了各种功能,如打开和播放文本,描述符,URL等。它也提供了API去设置或获取音量,以及metadata和支持语言的列表等。


头文件

 #include <nssttsutility.h>
#include <nssttsutilityobserver.h>


链接库

LIBRARY         nssttsutility.lib


示例代码 1) 从MTtsClientUilityObserver类继承,并完成相关的虚函数

2) 初始化TTs应用

CTtsUtility* iTtsUtility = CTtsUtility::NewL( *this );

3) 增加样式和数据,以便播放

if ( iTtsUtility->NumberOfStyles() > 0 )
{
// Delete style if exists
iTtsUtility->DeleteStyle( iStyleId );
}
if ( iParsedText->NumberOfSegments() > 0 )
{
// Remove existing segment from parsed text structure
iParsedText->DeleteSegmentL( 0 );
}
// Use high quality TTS
iStyle.iQuality = ETtsQualityHighOnly;
// Use language and speaker set in Speech application.
// Also speaking rate and volume is set according to Speech app.
iStyle.iLanguage = KTtsUndefinedLanguage;
// Add style
iStyleId = iTtsUtility->AddStyleL( iStyle );
// Initialise with current text and settings.
iTtsUtility->OpenParsedTextL( *iParsedText );
//The command to start playing
iTtsUtility->Play();

4) 也可获得或设置TtsUtility的音量

TInt volume;
iTtsUtility->GetVolume( volume );
iTtsUtility->SetVolume( volume );


5) 停止播放文本

iTtsUtility->Stop();
This page was last modified on 15 December 2011, at 09:44.
116 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×