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

# game_chat_audio_format

> game_chat_audio_format

# game\_chat\_audio\_format

描述解释 Game Chat 2 音频数据所需的格式信息。

<a id="syntaxSection" />

## 语法

```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  
```

<a id="membersSection" />

### 成员

*sample\_rate*  \
类型:uint32\_t

每个通道应播放或录制的采样频率。

*channel\_mask*  \
类型:uint32\_t

用于覆盖多通道音频流中通道到扬声器位置分配的通道掩码。有关此值的位到扬声器映射,请参阅 [Microsoft Docs](/) 上 [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](/reference/chat/gamechat2/enums/game_chat_sample_type)

指定 Game Chat 2 是使用由整数表示的脉冲编码调制 (PCM) 数据 ([game\_chat\_sample\_type::integer](/reference/chat/gamechat2/enums/game_chat_sample_type)) 还是由浮点数表示的数据 ([game\_chat\_sample\_type::ieee\_float](/reference/chat/gamechat2/enums/game_chat_sample_type))。

*is\_interleaved*  \
类型:bool

一个标志,表示多通道音频流对于多通道格式是否为交错格式。

从 Game Chat 2 检索的音频始终标记为交错。此参数仅在 [game\_chat\_audio\_format::channel\_count](/reference/chat/gamechat2/structs/game_chat_audio_format) 大于 1 时才有意义。

<a id="remarksSection" />

## 备注

此结构用于描述 Game Chat 2 中编码前音频流、解码后音频源流和解码后音频接收流的音频数据的格式。以下函数用于获取或设置其对应流对象所使用的 `game_chat_audio_format`:

* [pre\_encode\_audio\_stream::get\_pre\_processed\_format](/reference/chat/gamechat2/classes/pre_encode_audio_stream/methods/pre_encode_audio_stream_get_pre_processed_format)
* [pre\_encode\_audio\_stream::set\_processed\_format](/reference/chat/gamechat2/classes/pre_encode_audio_stream/methods/pre_encode_audio_stream_set_processed_format)
* [post\_decode\_audio\_source\_stream::get\_pre\_processed\_format](/reference/chat/gamechat2/classes/post_decode_audio_source_stream/methods/post_decode_audio_source_stream_get_pre_processed_format)
* [post\_decode\_audio\_sink\_stream::set\_processed\_format](/reference/chat/gamechat2/classes/post_decode_audio_sink_stream/methods/post_decode_audio_sink_stream_set_processed_format)

有关音频格式的更多信息,请参阅 [实时音频处理](/services/xbox-services/multiplayer/chat/game-chat2/real-time-audio-manipulation)。

<a id="requirementsSection" />

## 需求

**头文件:** GameChat2.h

**支持的平台:** Windows、XBOX One 家族主机以及 XBOX Series 主机

<a id="seealsoSection" />

## 另请参阅

[Game Chat 2 简介](/services/xbox-services/multiplayer/chat/game-chat2/game-chat-2-intro)\
[chat\_manager](/reference/chat/gamechat2/classes/chat_manager/chat_manager)\
[pre\_encode\_audio\_stream](/reference/chat/gamechat2/classes/pre_encode_audio_stream/pre_encode_audio_stream)\
[post\_decode\_audio\_sink\_stream](/reference/chat/gamechat2/classes/post_decode_audio_sink_stream/post_decode_audio_sink_stream)\
[post\_decode\_audio\_source\_stream](/reference/chat/gamechat2/classes/post_decode_audio_source_stream/post_decode_audio_source_stream)\
[GameChat2 members](/reference/chat/gamechat2/gamechat2_members)


## Related topics

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