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

# XSpeechSynthesizerCloseStreamHandle

> XSpeechSynthesizerCloseStreamHandle

# XSpeechSynthesizerCloseStreamHandle

关闭语音合成器流并释放已分配的系统资源。

## 语法

```cpp theme={null}
HRESULT XSpeechSynthesizerCloseStreamHandle(  
         XSpeechSynthesizerStreamHandle speechSynthesisStream  
)  
```

### 参数

*speechSynthesisStream*   \_In\_\
类型：XSpeechSynthesizerStreamHandle

要关闭的语音合成流。

### 返回值

类型：[HRESULT](https://learn.microsoft.com/openspecs/windows_protocols/ms-erref/0642cb2f-2075-4469-918c-4441e69c548a)

如果成功，则返回 **S\_OK**；否则返回错误代码。有关错误代码列表，请参阅[错误代码](/reference/errorcodes)。

## 备注

<Note>此函数在时间敏感型线程上调用不安全。有关详细信息，请参阅[时间敏感型线程](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)。</Note>

使用此函数关闭通过调用 [XSpeechSynthesizerCreateStreamFromText](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreatestreamfromtext) 函数创建的语音合成器流。

为防止内存泄漏，在完成使用该句柄的所有操作后，请调用此函数关闭语音合成器流句柄。在调用此函数之前，必须完成所有未完成的异步操作。

有关演示如何使用 **XSpeechSynthesizerCloseStreamHandle** 函数的示例，请参阅 [XSpeechSynthesizerCreate](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreate)。

## 要求

**头文件：** XSpeechSynthesizer.h

**库：** xgameruntime.lib

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

## 概念文档

* [文本转语音](/build/console-features/text-to-speech/text-to-speech)
* [时间敏感型线程](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## 另请参阅

[XAccessibility](/reference/system/xaccessibility/xaccessibility_members)\
[XSpeechSynthesizerCloseHandle](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerclosehandle)\
[XSpeechSynthesizer](/reference/system/xspeechsynthesizer/xspeechsynthesizer_members)
