> ## 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.

# XSpeechSynthesizerCloseHandle

> XSpeechSynthesizerCloseHandle

# XSpeechSynthesizerCloseHandle

關閉語音合成器並釋放已配置的系統資源。

## 語法

```cpp theme={null}
HRESULT XSpeechSynthesizerCloseHandle(  
         XSpeechSynthesizerHandle speechSynthesizer  
)  
```

### 參數

*speechSynthesizer*   \_In\_opt\_\
類型：XSpeechSynthesizerHandle

要關閉的語音合成器。

### 傳回值

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

如果成功，則傳回 **S\_OK**；否則傳回錯誤碼。如需錯誤碼的清單，請參閱[錯誤碼](/zh-TW/reference/errorcodes)。

## 備註

<Note>在時間敏感執行緒上呼叫此函式並不安全。如需詳細資訊，請參閱[時間敏感執行緒](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)。</Note>

* 使用此函式來關閉藉由呼叫 [XSpeechSynthesizerCreate](/zh-TW/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreate) 函式所建立的語音合成器。

* 若要防止記憶體流失，請在完成所有使用語音合成器控制代碼的作業之後，呼叫此函式來關閉該控制代碼。

* 如需示範如何使用 **XSpeechSynthesizerCloseHandle** 函式的範例，請參閱 [XSpeechSynthesizerCreate](/zh-TW/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreate)。

## 需求

**標頭：** XSpeechSynthesizer.h

**程式庫：** xgameruntime.lib

**支援的平台：** Windows、XBOX One 系列主機和 XBOX Series 主機

## 概念文件

* [文字轉換語音](/zh-TW/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](/zh-TW/reference/system/xaccessibility/xaccessibility_members)\
[XSpeechSynthesizerCreate](/zh-TW/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreate)\
[XSpeechSynthesizerCloseStreamHandle](/zh-TW/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerclosestreamhandle)\
[XSpeechSynthesizer](/zh-TW/reference/system/xspeechsynthesizer/xspeechsynthesizer_members)


## Related topics

- [XSpeechSynthesizerCloseHandle](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerclosehandle.md)
- [XSpeechSynthesizerCloseStreamHandle](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerclosestreamhandle.md)
