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

# XSpeechSynthesizerGetStreamDataSize

> XSpeechSynthesizerGetStreamDataSize

# XSpeechSynthesizerGetStreamDataSize

获取语音合成流的数据缓冲区的大小。

## 语法

```cpp theme={null}
HRESULT XSpeechSynthesizerGetStreamDataSize(  
         XSpeechSynthesizerStreamHandle speechSynthesisStream,  
         size_t* bufferSize  
)  
```

### 参数

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

包含流数据的语音合成器流。

*bufferSize*   \_Out\_\
类型：size\_t\*

流数据缓冲区的大小（以字节为单位）。

### 返回值

类型：[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) 函数创建的语音合成器流的数据缓冲区中检索合成语音音频数据所需的缓冲区大小。缓冲区的最大数据大小为 0xffffffff 字节：四千兆字节减一字节。

* 若要从语音合成器流中检索音频数据，请使用此函数的值设置 [XSpeechSynthesizerGetStreamData](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizergetstreamdata) 函数的 *bufferSize* 参数值。

* 有关演示如何使用 **XSpeechSynthesizerGetStreamDataSize** 函数的示例，请参阅 [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)

## 另请参阅

[XSpeechSynthesizerCreateStreamFromText](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreatestreamfromtext)\
[XSpeechSynthesizerGetStreamData](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizergetstreamdata)\
[XSpeechSynthesizer](/reference/system/xspeechsynthesizer/xspeechsynthesizer_members)


## Related topics

- [XSpeechSynthesizerGetStreamData](/zh-CN/reference/system/xspeechsynthesizer/functions/xspeechsynthesizergetstreamdata.md)
- [文本转语音](/zh-CN/build/console-features/text-to-speech/text-to-speech.md)
- [XSpeechSynthesizer](/zh-CN/reference/system/xspeechsynthesizer/xspeechsynthesizer_members.md)
- [XSpeechSynthesizerCreate](/zh-CN/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreate.md)
- [XSpeechSynthesizerCreateStreamFromSsml](/zh-CN/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreatestreamfromssml.md)
