> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XSpeechSynthesizerInstalledVoicesCallback

> XSpeechSynthesizerInstalledVoicesCallback

# XSpeechSynthesizerInstalledVoicesCallback

在调用 [XSpeechSynthesizerEnumerateInstalledVoices](https://docs.xbox.com/zh-CN/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerenumerateinstalledvoices.md) 时接收有关语音信息的客户端实现回调函数。

## 语法

```cpp theme={null}
bool XSpeechSynthesizerInstalledVoicesCallback(  
         const XSpeechSynthesizerVoiceInformation* information,  
         void* context  
)  
```

### 参数

*information*   \_In\_\
类型：[XSpeechSynthesizerVoiceInformation\*](https://docs.xbox.com/zh-CN/reference/system/xspeechsynthesizer/structs/xspeechsynthesizervoiceinformation.md)

指向 [XSpeechSynthesizerVoiceInformation](https://docs.xbox.com/zh-CN/reference/system/xspeechsynthesizer/structs/xspeechsynthesizervoiceinformation.md) 结构的指针，该结构包含当前枚举语音的详细信息。

*context*   \_In\_\
类型：void\*

在初始调用 [XSpeechSynthesizerEnumerateInstalledVoices](https://docs.xbox.com/zh-CN/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerenumerateinstalledvoices.md) 时提供的上下文指针。

### 返回值

类型：bool

如果 [XSpeechSynthesizerEnumerateInstalledVoices](https://docs.xbox.com/zh-CN/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerenumerateinstalledvoices.md) 将继续枚举，则返回 **true**；如果 [XSpeechSynthesizerEnumerateInstalledVoices](https://docs.xbox.com/zh-CN/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerenumerateinstalledvoices.md) 将停止枚举，则返回 **false**。

## 备注

* 当 **XSpeechSynthesizerInstalledVoicesCallback** 函数返回 **true** 时，[XSpeechSynthesizerEnumerateInstalledVoices](https://docs.xbox.com/zh-CN/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerenumerateinstalledvoices.md) 将为每个已安装的语音合成引擎（即*语音*）调用一次 **XSpeechSynthesizerInstalledVoicesCallback** 回调函数。如果 **XSpeechSynthesizerInstalledVoicesCallback** 函数返回 **false**，则 **XSpeechSynthesizerEnumerateInstalledVoices** 将停止枚举任何剩余的已安装语音。

* 要识别并显示当前设备上安装的每个语音的信息，请使用 *information* 中 [XSpeechSynthesizerVoiceInformation](https://docs.xbox.com/zh-CN/reference/system/xspeechsynthesizer/structs/xspeechsynthesizervoiceinformation.md) 结构所提供的数据。

* 有关演示如何使用 **XSpeechSynthesizerInstalledVoicesCallback** 回调函数的示例，请参阅 [XSpeechSynthesizerEnumerateInstalledVoices](https://docs.xbox.com/zh-CN/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerenumerateinstalledvoices.md)。

## 要求

**头文件：** XSpeechSynthesizer.h

**库：** xgameruntime.lib

**支持的平台：** Windows、XBOX One 系列主机和 XBOX Series 主机

## 另请参阅

[XAccessibility](https://docs.xbox.com/zh-CN/reference/system/xaccessibility/xaccessibility_members.md)\
[XSpeechSynthesizerSetCustomVoice](https://docs.xbox.com/zh-CN/reference/system/xspeechsynthesizer/functions/xspeechsynthesizersetcustomvoice.md)\
[XSpeechSynthesizer](https://docs.xbox.com/zh-CN/reference/system/xspeechsynthesizer/xspeechsynthesizer_members.md)


## Related topics

- [XSpeechSynthesizerEnumerateInstalledVoices](https://docs.xbox.com/zh-CN/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerenumerateinstalledvoices.md)
- [XSpeechSynthesizerVoiceGender](https://docs.xbox.com/zh-CN/reference/system/xspeechsynthesizer/enums/xspeechsynthesizervoicegender.md)
- [XSpeechSynthesizerSetCustomVoice](https://docs.xbox.com/zh-CN/reference/system/xspeechsynthesizer/functions/xspeechsynthesizersetcustomvoice.md)
- [XSpeechSynthesizerSetDefaultVoice](https://docs.xbox.com/zh-CN/reference/system/xspeechsynthesizer/functions/xspeechsynthesizersetdefaultvoice.md)
- [XSpeechSynthesizer（API 内容）](https://docs.xbox.com/zh-CN/reference/system/xspeechsynthesizer/xspeechsynthesizer_members.md)
