推荐下载Android实例.docx
《推荐下载Android实例.docx》由会员分享,可在线阅读,更多相关《推荐下载Android实例.docx(18页珍藏版)》请在冰豆网上搜索。
![推荐下载Android实例.docx](https://file1.bdocx.com/fileroot1/2022-11/16/7ab94f5b-408b-4008-b563-0a9949d8622b/7ab94f5b-408b-4008-b563-0a9949d8622b1.gif)
推荐下载Android实例
Android实例
2015/07/090相关资料:
注意:
在手机上必须选安装文字转语音引擎“googleTextToSpeech”地址:
shouji56/soft/GoogleWenZiZhuanYuYinYinQingGoogleTexttoSpeech_3864/
结果总结:
XE10.1+小米手机5=通过测试首先手机上必须安装语音包:
1.“googleTextTo
Speech”(不知为什么我的只发英文)2.“度秘语音引擎3.0”(中英都可以发音)3.“科大讯
飞语音引擎3.0”(中英都可以发音)4.APK发音使用的是当前语音包5.小米手机5-设
置-更多设置-语言和输入法-文字转语音(TTS)输出
1.新建一个单元Androidapi.JNI.TTS
1{*******************************************************}2{}3{
CodeGearDelphiRuntimeLibrary}4{Copyright(c)2013JeffOvercash}5{}6
{*******************************************************}8{Delphi
trnslationforTTSAndroidJavaclassesfrom}9{
developer.android/reference/android/speech/tts/package-summary.html}11unit
Androidapi.JNI.TTS;1213interface15usesAndroidapi.JNIBridge,16
Androidapi.JNI.JavaTypes,17Androidapi.JNI.Os,18Androidapi.JNI.App,19
Androidapi.JNI.GraphicsContentViewText;2021type23{Forwarddeclarations}24
JSynthesisCallback=interface;//android.speech.tts.SynthesisCallback25
JSynthesisRequest=interface;//android.speech.tts.SynthesisRequest26JTextToSpeech=
interface;//android.speech.tts.TextToSpeech27JTextToSpeech_Engine=interface;//
android.speech.tts.TextToSpeech$Engine28JTextToSpeech_EngineInfo=interface;
//android.speech.tts.TextToSpeech$EngineInfo29JTextToSpeech_OnInitListener=
interface;//android.speech.tts.TextToSpeech$OnInitListener30
JTextToSpeech_OnUtteranceCompletedListener=interface;//
android.speech.tts.TextToSpeech$OnUtteranceCompletedListener31
JTextToSpeechService=interface;//android.speech.tts.TextToSpeechService32
JUtteranceProgressListener=interface;//android.speech.tts.UtteranceProgressListener34
JSynthesisCallbackClass=interface(IJavaClass)35[‘{3B30766E-A43B-4005-BE92-
472CD075F325}’]36end;3738
[JavaSignature(‘android/speech/tts/SynthesisCallback’)]39JSynthesisCallback=
interface(IJavaInstance)40[‘{190C13DE-BC7E-44CE-94F6-4AF1A84A4612}’]41
functionaudioAvailable(buffer:
TJavaArraybyteoffset:
Integer;length:
Integer):
Integer;
cdecl;42functiondone:
Integer;cdecl;43procedureerror;cdecl;44function
getMaxBufferSize:
Integer;cdecl;45functionstart(sampleRateInHz:
Integer;
audioFormat:
Integer;channelCount:
Integer):
Integer;cdecl;46end;47
TJSynthesisCallback=class(TJavaGenericImportJSynthesisCallbackClass,
JSynthesisCallback)end;4849JSynthesisRequestClass=interface(JObjectClass)50
[‘{AE41459D-42C6-4E66-B174-F6FA5216A1DA}’]51{Method}52functioninit(text:
JString;params:
JBundle):
JSynthesisRequest;53end;5455
[JavaSignature(‘android/speech/tts/SynthesisRequest’)]56JSynthesisRequest=
interface(JObject)57[‘{1963DAD8-C58F-4868-BF8A-B43AE7A14145}’]58function
getCountry:
JString;cdecl;59functiongetLanguage:
JString;cdecl;60function
getParams:
JBundle;cdecl;61functiongetPitch:
Integer;cdecl;62function
getSpeechRate:
Integer;cdecl;63functiongetText:
JString;cdecl;64functiongetVariant:
JString;cdecl;65end;66TJSynthesisRequest=class(TJavaGenericImport
JSynthesisRequestClass,JSynthesisRequest)end;6768JTextToSpeechClass=
interface(JObjectClass)69[‘{0E2C5E49-95BE-4F19-BCCD-21960D03E957}’]70{
PropertyMethods}71function
_GetACTION_TTS_QUEUE_PROCESSING_COMPLETED:
JString;72function
_GetERROR:
Integer;73function_GetLANG_AVAILABLE:
Integer;74function
_GetLANG_COUNTRY_AVAILABLE:
Integer;75function
_GetLANG_COUNTRY_VAR_AVAILABLE:
Integer;76function
_GetLANG_MISSING_DATA:
Integer;77function_GetLANG_NOT_SUPPORTED:
Integer;78function_GetQUEUE_ADD:
Integer;79function_GetQUEUE_FLUSH:
Integer;80function_GetSUCCESS:
Integer;81{Methods}82functioninit(contect:
JContext;listener:
JTextToSpeech_OnInitListener):
JTextToSpeech;cdecl;overload;83
functioninit(context:
JContext;listener:
JTextToSpeech_OnInitListener;engine:
JString):
JTextToSpeech;overload;84{Properties}85property
ACTION_TTS_QUEUE_PROCESSING_COMPLETED:
JStringread
_GetACTION_TTS_QUEUE_PROCESSING_COMPLETED;86propertyERROR:
Integerread_GetERROR;87propertyLANG_AVAILABLE:
Integerread
_GetLANG_AVAILABLE;88propertyLANG_COUNTRY_AVAILABLE:
Integerread
_GetLANG_COUNTRY_AVAILABLE;89property
LANG_COUNTRY_VAR_AVAILABLE:
Integerread
_GetLANG_COUNTRY_VAR_AVAILABLE;90propertyLANG_MISSING_DATA:
Integerread_GetLANG_MISSING_DATA;91propertyLANG_NOT_SUPPORTED:
Integerread_GetLANG_NOT_SUPPORTED;92propertyQUEUE_ADD:
Integerread
_GetQUEUE_ADD;93propertyQUEUE_FLUSH:
Integerread_GetQUEUE_FLUSH;
94propertySUCCESS:
Integerread_GetSUCCESS;95end;9697
[JavaSignature(‘android/speech/tts/TextToSpeech’)]98JTextToSpeech=
interface(JObject)99[‘{E1D06364-F967-4381-B178-EEDD42C203C7}’]100function
addEarcon(earcon:
JString;filename:
JString):
Integer;cdecl;overload;101function
addEarcon(earcon:
JString;packagename:
JString;resourceID:
I