> ## 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-CN.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-CN/reference/chat/gamechat2/enums/game_chat_sample_type.md)

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

*is\_interleaved*  \
类型:bool

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

从 Game Chat 2 检索的音频始终标记为交错。此参数仅在 [game\_chat\_audio\_format::channel\_count](https://docs.xbox.com/zh-CN/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-CN/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-CN/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-CN/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-CN/reference/chat/gamechat2/classes/post_decode_audio_sink_stream/methods/post_decode_audio_sink_stream_set_processed_format.md)

有关音频格式的更多信息,请参阅 [实时音频处理](https://docs.xbox.com/zh-CN/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-CN/services/xbox-services/multiplayer/chat/game-chat2/game-chat-2-intro.md)\
[chat\_manager](https://docs.xbox.com/zh-CN/reference/chat/gamechat2/classes/chat_manager/chat_manager.md)\
[pre\_encode\_audio\_stream](https://docs.xbox.com/zh-CN/reference/chat/gamechat2/classes/pre_encode_audio_stream/pre_encode_audio_stream.md)\
[post\_decode\_audio\_sink\_stream](https://docs.xbox.com/zh-CN/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-CN/reference/chat/gamechat2/classes/post_decode_audio_source_stream/post_decode_audio_source_stream.md)\
[GameChat2 members](https://docs.xbox.com/zh-CN/reference/chat/gamechat2/gamechat2_members.md)


## Related topics

- [pre_encode_audio_stream::get_pre_processed_format](https://docs.xbox.com/zh-CN/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-CN/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-CN/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-CN/reference/chat/gamechat2/enums/game_chat_sample_type.md)
- [pre_encode_audio_stream::set_processed_format](https://docs.xbox.com/zh-CN/reference/chat/gamechat2/classes/pre_encode_audio_stream/methods/pre_encode_audio_stream_set_processed_format.md)
