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

# game_chat_audio_format

> game_chat_audio_format

# game\_chat\_audio\_format

描述解譯 Game Chat 2 音訊資料所需的格式資訊。

## 語法

```cpp theme={null}
typedef struct game_chat_audio_format {  
    uint32_t sample_rate;  
    uint32_t channel_mask;  
    uint16_t channel_count;  
    uint16_t bits_per_sample;  
    game_chat_sample_type sample_type;  
    bool is_interleaved;  
} game_chat_audio_format  
```

### 成員

*sample\_rate*  \
類型：uint32\_t

每個聲道應播放或錄製的取樣頻率。

*channel\_mask*  \
類型：uint32\_t

用來覆寫多聲道音訊串流中聲道與喇叭位置指派的聲道遮罩。如需此值的位元與喇叭對應，請參閱 [Microsoft Docs](https://docs.xbox.com/zh-TW.md) 上 [WAVEFORMATEXTENSIBLE](https://learn.microsoft.com/windows-hardware/drivers/ddi/ksmedia/ns-ksmedia-waveformatextensible) 結構之 *dwChannelMask* 成員的描述。若要使用預設對應，請將此值設為 0。

*channel\_count*  \
類型：uint16\_t

音訊資料的聲道數目。

*bits\_per\_sample*  \
類型：uint16\_t

每個樣本的位元數。如果此值無法以位元組整除，則會假設所包含的樣本類型已填補位元，使其可以位元組整除。

*sample\_type*  \
類型：[game\_chat\_sample\_type](https://docs.xbox.com/zh-TW/reference/chat/gamechat2/enums/game_chat_sample_type.md)

指定 Game Chat 2 使用的是以整數 ([game\_chat\_sample\_type::integer](https://docs.xbox.com/zh-TW/reference/chat/gamechat2/enums/game_chat_sample_type.md)) 或浮點數 ([game\_chat\_sample\_type::ieee\_float](https://docs.xbox.com/zh-TW/reference/chat/gamechat2/enums/game_chat_sample_type.md)) 表示的脈衝編碼調變 (PCM) 資料。

*is\_interleaved*  \
類型：bool

旗標，代表多聲道格式的多聲道音訊串流是否為交錯式。

從 Game Chat 2 擷取的音訊一律會標示為交錯式。只有在 [game\_chat\_audio\_format::channel\_count](https://docs.xbox.com/zh-TW/reference/chat/gamechat2/structs/game_chat_audio_format.md) 大於 1 時，此參數才有意義。

## 備註

此結構用於描述 Game Chat 2 中編碼前音訊串流、解碼後音訊來源串流和解碼後音訊接收串流的音訊資料格式。下列函式會取得或設定其對應串流物件所使用的 `game_chat_audio_format`：

* [pre\_encode\_audio\_stream::get\_pre\_processed\_format](https://docs.xbox.com/zh-TW/reference/chat/gamechat2/classes/pre_encode_audio_stream/methods/pre_encode_audio_stream_get_pre_processed_format.md)
* [pre\_encode\_audio\_stream::set\_processed\_format](https://docs.xbox.com/zh-TW/reference/chat/gamechat2/classes/pre_encode_audio_stream/methods/pre_encode_audio_stream_set_processed_format.md)
* [post\_decode\_audio\_source\_stream::get\_pre\_processed\_format](https://docs.xbox.com/zh-TW/reference/chat/gamechat2/classes/post_decode_audio_source_stream/methods/post_decode_audio_source_stream_get_pre_processed_format.md)
* [post\_decode\_audio\_sink\_stream::set\_processed\_format](https://docs.xbox.com/zh-TW/reference/chat/gamechat2/classes/post_decode_audio_sink_stream/methods/post_decode_audio_sink_stream_set_processed_format.md)

如需音訊格式的詳細資訊，請參閱[即時音訊操作](https://docs.xbox.com/zh-TW/services/xbox-services/multiplayer/chat/game-chat2/real-time-audio-manipulation.md)。

## 需求

**標頭：** GameChat2.h

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

## 另請參閱

[Game Chat 2 簡介](https://docs.xbox.com/zh-TW/services/xbox-services/multiplayer/chat/game-chat2/game-chat-2-intro.md)\
[chat\_manager](https://docs.xbox.com/zh-TW/reference/chat/gamechat2/classes/chat_manager/chat_manager.md)\
[pre\_encode\_audio\_stream](https://docs.xbox.com/zh-TW/reference/chat/gamechat2/classes/pre_encode_audio_stream/pre_encode_audio_stream.md)\
[post\_decode\_audio\_sink\_stream](https://docs.xbox.com/zh-TW/reference/chat/gamechat2/classes/post_decode_audio_sink_stream/post_decode_audio_sink_stream.md)\
[post\_decode\_audio\_source\_stream](https://docs.xbox.com/zh-TW/reference/chat/gamechat2/classes/post_decode_audio_source_stream/post_decode_audio_source_stream.md)\
[GameChat2 成員](https://docs.xbox.com/zh-TW/reference/chat/gamechat2/gamechat2_members.md)


## Related topics

- [pre_encode_audio_stream::get_pre_processed_format](https://docs.xbox.com/zh-TW/reference/chat/gamechat2/classes/pre_encode_audio_stream/methods/pre_encode_audio_stream_get_pre_processed_format.md)
- [post_decode_audio_source_stream::get_pre_processed_format](https://docs.xbox.com/zh-TW/reference/chat/gamechat2/classes/post_decode_audio_source_stream/methods/post_decode_audio_source_stream_get_pre_processed_format.md)
- [post_decode_audio_sink_stream::set_processed_format](https://docs.xbox.com/zh-TW/reference/chat/gamechat2/classes/post_decode_audio_sink_stream/methods/post_decode_audio_sink_stream_set_processed_format.md)
- [game_chat_sample_type](https://docs.xbox.com/zh-TW/reference/chat/gamechat2/enums/game_chat_sample_type.md)
- [pre_encode_audio_stream::set_processed_format](https://docs.xbox.com/zh-TW/reference/chat/gamechat2/classes/pre_encode_audio_stream/methods/pre_encode_audio_stream_set_processed_format.md)
