Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.


From Wiki
Jump to: navigation, search
Article Metadata

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


  • 开发伙伴平台:

S60 3rd Edition, FP2

  • 详细描述

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



 #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

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

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

5) 停止播放文本

This page was last modified on 15 December 2011, at 06:44.
62 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.