Files
XCEngine/docs/api/components/audio-source-component/set-3d-params.md

41 lines
990 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Set3DParams
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 设置音频源的3D音频参数。
## 函数签名
```cpp
void Set3DParams(const Audio::Audio3DParams& params);
```
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `params` | `const Audio::Audio3DParams&` | 3D音频参数引用包含多普勒等级、扩散角度、混响混合等 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void Setup3DParams(AudioSourceComponent* source) {
Audio::Audio3DParams params;
params.dopplerLevel = 1.0f; // 正常多普勒效应
params.spread = 0.0f; // 点声源
params.reverbZoneMix = 1.0f; // 最大混响混合
source->Set3DParams(params);
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [Get3DParams](./get-3d-params.md) - 获取3D参数