TextToSpeechService 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
TTS 引擎实现的抽象基类。
[Android.Runtime.Register("android/speech/tts/TextToSpeechService", DoNotGenerateAcw=true)]
public abstract class TextToSpeechService : Android.App.Service
[<Android.Runtime.Register("android/speech/tts/TextToSpeechService", DoNotGenerateAcw=true)>]
type TextToSpeechService = class
inherit Service
- 继承
- 属性
注解
TTS 引擎实现的抽象基类。 需要实现以下方法:<ul<>li>#onIsLanguageAvailable
</li/li<>#onLoadLanguage
></>><#onGetLanguage
<li/<<>#onSynthesizeText
>li/li/li>#onStop
<<>/li></ul> 前三项主要涉及语言管理,用于查询引擎以获取给定语言的支持,并指示给定语言的请求迫在眉睫。
#onSynthesizeText
是引擎实现的核心。 实现应根据请求参数合成文本,并通过提供的回调返回合成的数据。 然后,此类及其帮助程序将使用该数据,这可能意味着排队播放或将其写入文件或类似文件。 对此方法的所有调用都将位于单个线程上,这与服务的主线程不同。 合成必须是同步的,这意味着引擎不得保留回调或在方法返回后对其调用任何方法。
#onStop
告知引擎应停止所有正在进行的合成(如果有)。 将从当前合成中丢弃任何挂起的数据。
#onGetLanguage
不需要JELLYBEAN_MR2(API 18)及更高版本,它仅在早期版本的 Android 上调用。
API 级别 20 添加了对 Voice 对象的支持。 语音是一种抽象,允许 TTS 服务为单个区域设置公开多个后端。 每个功能集可以设置不同的功能。 为了充分利用语音,引擎应实现以下方法:<ul><li#onGetVoices()
<>/li/li>>#onIsValidVoiceName(String)
<</li/><><#onLoadVoice(String)
li<<>#onGetDefaultVoiceNameFor(String, String, String)
>/li/li<>/ul> 前三种方法是同级#onGetLanguage
#onIsLanguageAvailable
#onLoadLanguage
方法和方法。 最后一个是 #onGetDefaultVoiceNameFor(String, String, String)
区域设置和基于语音的方法之间的链接。 由于 API 级别 21 TextToSpeech#setLanguage
是通过使用返回的语音进行调用 TextToSpeech#setVoice
来实现的 #onGetDefaultVoiceNameFor(String, String, String)
。
如果客户端使用语音而不是区域设置, SynthesisRequest
则包含请求的语音名称。
语音相关方法的默认实现使用预先存在的基于区域设置的实现来实现它们。
适用于 . 的 android.speech.tts.TextToSpeechService
Java 文档
本页的某些部分是根据 Android 开放源代码项目创建和共享的工作进行的修改,并根据 Creative Commons 2.5 属性许可证中所述的术语使用。
构造函数
TextToSpeechService() | |
TextToSpeechService(IntPtr, JniHandleOwnership) |
创建 JNI 对象的托管表示形式时使用的构造函数;由运行时调用。 |
字段
AccessibilityService |
|
AccountService |
|
ActivityService |
|
AlarmService |
|
AppOpsService |
用于 |
AppSearchService |
|
AppwidgetService |
|
AudioService |
用于 |
BatteryService |
|
BindAllowActivityStarts |
已过时.
|
BindExternalServiceLong |
的工作方式与 |
BindNotPerceptible |
已过时.
|
BindSharedIsolatedProcess |
已过时.
标志: |
BiometricService |
|
BlobStoreService |
|
BluetoothService |
|
BugreportService |
用于捕获 bug 报告的服务。 (继承自 Context) |
CameraService |
|
CaptioningService |
用于 |
CarrierConfigService |
用于 |
ClipboardService |
|
CompanionDeviceService |
|
ConnectivityDiagnosticsService |
用于 |
ConnectivityService |
用于 |
ConsumerIrService |
用于 |
CredentialService |
|
CrossProfileAppsService |
用于 |
DeviceIdDefault |
默认设备 ID,即主设备(非虚拟)设备的 ID。 (继承自 Context) |
DeviceIdInvalid |
设备 ID 无效。 (继承自 Context) |
DeviceLockService |
|
DevicePolicyService |
|
DisplayHashService |
|
DisplayService |
|
DomainVerificationService |
|
DownloadService |
与 |
DropboxService |
|
EuiccService |
|
FileIntegrityService |
|
FingerprintService |
用于 |
GameService |
|
GrammaticalInflectionService |
|
HardwarePropertiesService |
用于 |
HealthconnectService |
|
InputMethodService |
用于 |
InputService |
|
IpsecService |
|
JobSchedulerService |
|
KeyguardService |
|
LauncherAppsService |
用于 |
LayoutInflaterService |
用于 |
LocaleService |
|
LocationService |
与 |
MediaCommunicationService |
|
MediaMetricsService |
用于 |
MediaProjectionService |
用于 |
MediaRouterService |
|
MediaSessionService |
用于 |
MidiService |
用于 |
NetworkStatsService |
用于 |
NfcService |
|
NotificationService |
与 |
NsdService |
用于 |
OverlayService |
|
PeopleService |
|
PerformanceHintService |
|
PowerService |
|
PrintService |
|
ReceiverExported |
已过时.
|
ReceiverNotExported |
已过时.
|
ReceiverVisibleToInstantApps |
已过时.
标志: |
RestrictionsService |
用于 |
RoleService |
用于 |
SearchService |
|
SensorService |
|
ShortcutService |
|
StatusBarService |
|
StopForegroundDetach |
已过时.
选择器: |
StopForegroundLegacy |
选择器: |
StopForegroundRemove |
已过时.
选择器: |
StorageService |
用于 |
StorageStatsService |
|
SystemHealthService |
|
TelecomService |
|
TelephonyImsService |
|
TelephonyService |
用于 |
TelephonySubscriptionService |
用于 |
TextClassificationService |
|
TextServicesManagerService |
用于 |
TvInputService |
|
TvInteractiveAppService |
|
UiModeService |
用于 |
UsageStatsService |
|
UsbService |
用于 |
UserService |
用于 |
VibratorManagerService |
用于 |
VibratorService |
用于 |
VirtualDeviceService |
用于 |
VpnManagementService |
|
WallpaperService |
用于 |
WifiAwareService |
用于 |
WifiP2pService |
用于 |
WifiRttRangingService |
与 |
WifiService |
用于 |
WindowService |
|
属性
Application |
返回拥有此服务的应用程序。 (继承自 Service) |
ApplicationContext |
返回当前进程的单个全局 Application 对象的上下文。 (继承自 ContextWrapper) |
ApplicationInfo |
返回此上下文包的完整应用程序信息。 (继承自 ContextWrapper) |
Assets |
返回应用程序的包的 AssetManager 实例。 (继承自 ContextWrapper) |
AttributionSource |
TTS 引擎实现的抽象基类。 (继承自 Context) |
AttributionTag |
属性可用于复杂应用中,以逻辑方式分隔应用的各个部分。 (继承自 Context) |
BaseContext | (继承自 ContextWrapper) |
CacheDir |
返回文件系统上特定于应用程序的缓存目录的绝对路径。 (继承自 ContextWrapper) |
Class |
返回此 |
ClassLoader |
返回可用于检索此包中的类的类加载程序。 (继承自 ContextWrapper) |
CodeCacheDir |
返回文件系统上用于存储缓存代码的应用程序特定缓存目录的绝对路径。 (继承自 ContextWrapper) |
ContentResolver |
返回应用程序的包的 ContentResolver 实例。 (继承自 ContextWrapper) |
DataDir |
TTS 引擎实现的抽象基类。 (继承自 ContextWrapper) |
DeviceId |
获取与此上下文关联的设备 ID。 (继承自 Context) |
Display |
获取与此上下文关联的显示。 (继承自 Context) |
ExternalCacheDir |
返回主外部文件系统上目录的绝对路径(位于应用程序可以放置其拥有的缓存文件的某个位置 ExternalStorageDirectory )。 (继承自 ContextWrapper) |
FilesDir |
返回存储使用 OpenFileOutput(String, FileCreationMode) 文件创建的文件系统上的目录的绝对路径。 (继承自 ContextWrapper) |
ForegroundServiceType |
如果服务已通过调用成为前台服务 |
Handle |
基础 Android 实例的句柄。 (继承自 Object) |
IsDeviceProtectedStorage |
TTS 引擎实现的抽象基类。 (继承自 ContextWrapper) |
IsRestricted |
指示此上下文是否受到限制。 (继承自 Context) |
IsUiContext |
如果 |
JniIdentityHashCode |
TTS 引擎实现的抽象基类。 (继承自 Object) |
JniPeerMembers |
TTS 引擎实现的抽象基类。 |
MainExecutor |
|
MainLooper |
返回当前进程的主线程的 Looper。 (继承自 ContextWrapper) |
NoBackupFilesDir |
返回文件系统上目录的绝对路径,类似于 FilesDir. (继承自 ContextWrapper) |
ObbDir |
返回可在其中找到此应用程序的 OBB 文件(如果有)的主外部存储目录。 (继承自 ContextWrapper) |
OpPackageName |
返回应该用于 |
PackageCodePath |
返回此上下文的主要 Android 包的完整路径。 (继承自 ContextWrapper) |
PackageManager |
返回 PackageManager 实例以查找全局包信息。 (继承自 ContextWrapper) |
PackageName |
返回此应用程序的包的名称。 (继承自 ContextWrapper) |
PackageResourcePath |
返回此上下文的主要 Android 包的完整路径。 (继承自 ContextWrapper) |
Params |
返回创建此上下文时所使用的参数集(如果通过该 |
PeerReference |
TTS 引擎实现的抽象基类。 (继承自 Object) |
Resources |
返回应用程序的包的资源实例。 (继承自 ContextWrapper) |
Theme |
返回与此上下文关联的 Theme 对象。 (继承自 ContextWrapper) |
ThresholdClass |
此 API 支持 Mono for Android 基础结构,不打算直接从代码使用。 |
ThresholdType |
此 API 支持 Mono for Android 基础结构,不打算直接从代码使用。 |
Wallpaper | (继承自 ContextWrapper) |
WallpaperDesiredMinimumHeight | (继承自 ContextWrapper) |
WallpaperDesiredMinimumWidth | (继承自 ContextWrapper) |
方法
显式接口实现
IJavaPeerable.Disposed() |
TTS 引擎实现的抽象基类。 (继承自 Object) |
IJavaPeerable.DisposeUnlessReferenced() |
TTS 引擎实现的抽象基类。 (继承自 Object) |
IJavaPeerable.Finalized() |
TTS 引擎实现的抽象基类。 (继承自 Object) |
IJavaPeerable.JniManagedPeerState |
TTS 引擎实现的抽象基类。 (继承自 Object) |
IJavaPeerable.SetJniIdentityHashCode(Int32) |
TTS 引擎实现的抽象基类。 (继承自 Object) |
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) |
TTS 引擎实现的抽象基类。 (继承自 Object) |
IJavaPeerable.SetPeerReference(JniObjectReference) |
TTS 引擎实现的抽象基类。 (继承自 Object) |
扩展方法
JavaCast<TResult>(IJavaObject) |
执行 Android 运行时检查的类型转换。 |
JavaCast<TResult>(IJavaObject) |
TTS 引擎实现的抽象基类。 |
GetJniTypeName(IJavaPeerable) |
TTS 引擎实现的抽象基类。 |