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

# SetShapeEqCompRatio

> SetShapeEqCompRatio

# SetShapeEqCompRatio

设置压缩比。

## 语法

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

### 参数

*context*   \_Inout\_\
类型：[SHAPE\_EQCOMP\_CONTEXT\*](https://docs.xbox.com/zh-CN/reference/audio/shapeeqcompcontext/structs/shape_eqcomp_context.md)

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

*ratio*   \
类型：float

压缩比。

### 返回值

类型：HRESULT

HRESULT 成功或错误代码。

## 备注

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

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

## 要求

**头文件：** shapeeqcompcontext.h

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

## 另请参阅

[ShapeEqCompContext](https://docs.xbox.com/zh-CN/reference/audio/shapeeqcompcontext/shapeeqcompcontext_members.md)


## Related topics

- [ShapeEqCompContext](https://docs.xbox.com/zh-CN/reference/audio/shapeeqcompcontext/shapeeqcompcontext_members.md)
- [GetShapeEqCompRatio](https://docs.xbox.com/zh-CN/reference/audio/shapeeqcompcontext/functions/getshapeeqcompratio.md)
- [SetShapeEqCompCommand](https://docs.xbox.com/zh-CN/reference/audio/shapeflowgraph/functions/setshapeeqcompcommand.md)
- [SetShapeEqCompGain](https://docs.xbox.com/zh-CN/reference/audio/shapeeqcompcontext/functions/setshapeeqcompgain.md)
- [SetShapeEqCompAttack](https://docs.xbox.com/zh-CN/reference/audio/shapeeqcompcontext/functions/setshapeeqcompattack.md)
