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

# SetShapeEqCompRatio

> SetShapeEqCompRatio

# SetShapeEqCompRatio

设置压缩比。

## 语法

```cpp theme={null}
HRESULT SetShapeEqCompRatio(  
         SHAPE_EQCOMP_CONTEXT* context,  
         float ratio  
)  
```

### 参数

*context*   \_Inout\_\
类型：[SHAPE\_EQCOMP\_CONTEXT\*](/reference/audio/shapeeqcompcontext/structs/shape_eqcomp_context)

指向 SHAPE\_EQCOMP\_CONTEXT 对象的指针。

*ratio*   \
类型：float

压缩比。

### 返回值

类型：HRESULT

HRESULT 成功或错误代码。

## 备注

压缩器根据输入电平与输出电平的比率来改变声音数据。该比率决定了当输入信号超过阈值时应该进行多少衰减。例如，比率为 2:1 时，超过阈值每 2 dB 的输入电平会使压缩器的输出比阈值电平高 1 dB。比率为 1:1 时，压缩器基本上不起作用。

有关详细信息，请参阅 [SHAPE 概述](/build/console-features/audio/overviews/shape-overview) 中的 [均衡与压缩](/build/console-features/audio/overviews/shape-overview#ID4ECF)。

## 要求

**头文件：** shapeeqcompcontext.h

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

## 另请参阅

[ShapeEqCompContext](/reference/audio/shapeeqcompcontext/shapeeqcompcontext_members)


## Related topics

- [ShapeEqCompContext](/zh-CN/reference/audio/shapeeqcompcontext/shapeeqcompcontext_members.md)
- [GetShapeEqCompRatio](/zh-CN/reference/audio/shapeeqcompcontext/functions/getshapeeqcompratio.md)
- [SetShapeEqCompRelease](/zh-CN/reference/audio/shapeeqcompcontext/functions/setshapeeqcomprelease.md)
- [SetShapeEqCompThreshold](/zh-CN/reference/audio/shapeeqcompcontext/functions/setshapeeqcompthreshold.md)
- [SetShapeEqCompAttack](/zh-CN/reference/audio/shapeeqcompcontext/functions/setshapeeqcompattack.md)
