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

# SetShapeXmaNumChannels

> SetShapeXmaNumChannels

# SetShapeXmaNumChannels

设置通道数。

## Syntax

```cpp theme={null}
HRESULT SetShapeXmaNumChannels(  
         SHAPE_XMA_CONTEXT* context,  
         UINT32 numChannels  
)  
```

### Parameters

*context*   \_Inout\_\
Type: [SHAPE\_XMA\_CONTEXT](https://docs.xbox.com/zh-CN/reference/audio/shapexmacontext/structs/shape_xma_context.md)\*

指向 [SHAPE\_XMA\_CONTEXT](https://docs.xbox.com/zh-CN/reference/audio/shapexmacontext/structs/shape_xma_context.md) 对象的指针。

*numChannels*   \
Type: UINT32

通道数;取值为 1(单声道)或 2(立体声)。

### Return value

Type: HRESULT

HRESULT 成功或错误代码。

## Remarks

此函数设置上下文中的实际通道数。(在 [SHAPE\_XMA\_CONTEXT](https://docs.xbox.com/zh-CN/reference/audio/shapexmacontext/structs/shape_xma_context.md) 对象中,`numChannels` 成员包含值 0 \[单声道] 或 1 \[立体声]。)

若要获取当前通道数,请使用 [GetShapeXmaNumChannels](https://docs.xbox.com/zh-CN/reference/audio/shapexmacontext/functions/getshapexmanumchannels.md)。

有关详细信息,请参阅 [SHAPE 概述](https://docs.xbox.com/zh-CN/build/console-features/audio/overviews/shape-overview.md)的 [XMA](https://docs.xbox.com/zh-CN/build/console-features/audio/overviews/shape-overview.md#ID4EYD) 部分。

## Requirements

**头文件:** shapexmacontext.h

**支持的平台:** XBOX One 系列主机和 XBOX Series 主机

## See also

[ShapeXmaContext](https://docs.xbox.com/zh-CN/reference/audio/shapexmacontext/shapexmacontext_members.md)


## Related topics

- [GetShapeXmaNumChannels](https://docs.xbox.com/zh-CN/reference/audio/shapexmacontext/functions/getshapexmanumchannels.md)
- [ShapeXmaContext](https://docs.xbox.com/zh-CN/reference/audio/shapexmacontext/shapexmacontext_members.md)
- [SetShapeDmaNumChannels](https://docs.xbox.com/zh-CN/reference/audio/shapedmacontext/functions/setshapedmanumchannels.md)
- [SetShapeXmaNumLoops](https://docs.xbox.com/zh-CN/reference/audio/shapexmacontext/functions/setshapexmanumloops.md)
- [SetShapeXmaNumSubframesToDecode](https://docs.xbox.com/zh-CN/reference/audio/shapexmacontext/functions/setshapexmanumsubframestodecode.md)
