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

# 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**；否則傳回錯誤碼。如需錯誤碼清單，請參閱[錯誤碼](https://docs.xbox.com/zh-TW/reference/errorcodes.md)。

## 備註

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

* 使用此函式來判斷從呼叫 [XSpeechSynthesizerCreateStreamFromText](https://docs.xbox.com/zh-TW/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreatestreamfromtext.md) 函式所建立之語音合成器資料流的資料緩衝區，擷取合成語音音訊資料所需的緩衝區大小。緩衝區的資料大小上限為 0xffffffff 位元組：即 4 GB 減去 1 個位元組。

* 若要從語音合成器資料流擷取音訊資料，請使用此函式的值來設定 [XSpeechSynthesizerGetStreamData](https://docs.xbox.com/zh-TW/reference/system/xspeechsynthesizer/functions/xspeechsynthesizergetstreamdata.md) 函式的 *bufferSize* 參數值。

* 如需示範如何使用 **XSpeechSynthesizerGetStreamDataSize** 函式的範例，請參閱 [XSpeechSynthesizerCreate](https://docs.xbox.com/zh-TW/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreate.md)。

## 需求

**標頭：** XSpeechSynthesizer.h

**程式庫：** xgameruntime.lib

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

## 概念文件

* [文字轉換語音](https://docs.xbox.com/zh-TW/build/console-features/text-to-speech/text-to-speech.md)
* [時間敏感執行緒](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## 另請參閱

[XSpeechSynthesizerCreateStreamFromText](https://docs.xbox.com/zh-TW/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreatestreamfromtext.md)\
[XSpeechSynthesizerGetStreamData](https://docs.xbox.com/zh-TW/reference/system/xspeechsynthesizer/functions/xspeechsynthesizergetstreamdata.md)\
[XSpeechSynthesizer](https://docs.xbox.com/zh-TW/reference/system/xspeechsynthesizer/xspeechsynthesizer_members.md)


## Related topics

- [XSpeechSynthesizerGetStreamData](https://docs.xbox.com/zh-TW/reference/system/xspeechsynthesizer/functions/xspeechsynthesizergetstreamdata.md)
- [文字轉語音](https://docs.xbox.com/zh-TW/build/console-features/text-to-speech/text-to-speech.md)
- [XSpeechSynthesizer (API 內容)](https://docs.xbox.com/zh-TW/reference/system/xspeechsynthesizer/xspeechsynthesizer_members.md)
- [XSpeechSynthesizerCreate](https://docs.xbox.com/zh-TW/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreate.md)
- [XSpeechSynthesizerCreateStreamFromText](https://docs.xbox.com/zh-TW/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreatestreamfromtext.md)
