docs: 更新 API 文档 - 多模块修复和完善
- audio: 更新 audio-system 方法文档 - components: 新增 audio-listener/audio-source 组件方法文档,新增 remove-component 方法 - core: 更新 filewriter, types 文档 - math: 更新 box 方法文档 - memory: 更新 proxy-allocator 文档 - resources: 更新 loader 和 texture 文档 - rhi: 更新 opengl 设备、shader、swap-chain 文档 - threading: 更新 mutex 和 task-system 文档
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
# GetDopplerLevel
|
||||
|
||||
**所属类**: `AudioListenerComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioListenerComponent.h`
|
||||
|
||||
**描述**: 获取音频监听器的多普勒效应等级。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
float GetDopplerLevel() const;
|
||||
```
|
||||
|
||||
## 返回值
|
||||
|
||||
| 类型 | 描述 |
|
||||
|------|------|
|
||||
| `float` | 当前多普勒等级,1.0 为默认值 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioListenerComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void PrintDopplerLevel(AudioListenerComponent* listener) {
|
||||
float level = listener->GetDopplerLevel();
|
||||
printf("Doppler level: %.2f\n", level);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioListenerComponent](./audio-listener-component.md) - 音频监听器组件
|
||||
- [SetDopplerLevel](./set-doppler-level.md) - 设置多普勒等级
|
||||
37
docs/api/components/audio-listener-component/get-energy.md
Normal file
37
docs/api/components/audio-listener-component/get-energy.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# GetEnergy
|
||||
|
||||
**所属类**: `AudioListenerComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioListenerComponent.h`
|
||||
|
||||
**描述**: 获取音频监听器当前接收到的音频能量值。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
float GetEnergy() const;
|
||||
```
|
||||
|
||||
## 返回值
|
||||
|
||||
| 类型 | 描述 |
|
||||
|------|------|
|
||||
| `float` | 当前音频能量值,通常在 0.0 到 1.0 范围内 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioListenerComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void CheckAudioEnergy(AudioListenerComponent* listener) {
|
||||
float energy = listener->GetEnergy();
|
||||
printf("Current audio energy: %.2f\n", energy);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioListenerComponent](./audio-listener-component.md) - 音频监听器组件
|
||||
- [GetFrequencyData](./get-frequency-data.md) - 获取频谱数据
|
||||
@@ -0,0 +1,37 @@
|
||||
# GetFrequencyDataSize
|
||||
|
||||
**所属类**: `AudioListenerComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioListenerComponent.h`
|
||||
|
||||
**描述**: 获取音频监听器频谱数据的大小。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
size_t GetFrequencyDataSize() const;
|
||||
```
|
||||
|
||||
## 返回值
|
||||
|
||||
| 类型 | 描述 |
|
||||
|------|------|
|
||||
| `size_t` | 频谱数据数组的元素数量 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioListenerComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void CheckSpectrumSize(AudioListenerComponent* listener) {
|
||||
size_t size = listener->GetFrequencyDataSize();
|
||||
printf("Spectrum data size: %zu\n", size);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioListenerComponent](./audio-listener-component.md) - 音频监听器组件
|
||||
- [GetFrequencyData](./get-frequency-data.md) - 获取频谱数据
|
||||
@@ -0,0 +1,43 @@
|
||||
# GetFrequencyData
|
||||
|
||||
**所属类**: `AudioListenerComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioListenerComponent.h`
|
||||
|
||||
**描述**: 获取音频监听器的频谱数据指针。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
const float* GetFrequencyData() const;
|
||||
```
|
||||
|
||||
## 返回值
|
||||
|
||||
| 类型 | 描述 |
|
||||
|------|------|
|
||||
| `const float*` | 频谱数据数组指针,数据为 FFT 变换后的频率幅度 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioListenerComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void ProcessFrequencyData(AudioListenerComponent* listener) {
|
||||
const float* data = listener->GetFrequencyData();
|
||||
size_t size = listener->GetFrequencyDataSize();
|
||||
|
||||
// 打印前几个频率值
|
||||
for (size_t i = 0; i < size && i < 10; ++i) {
|
||||
printf("Freq[%zu]: %.2f\n", i, data[i]);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioListenerComponent](./audio-listener-component.md) - 音频监听器组件
|
||||
- [GetFrequencyDataSize](./get-frequency-data-size.md) - 获取频谱数据大小
|
||||
- [GetEnergy](./get-energy.md) - 获取音频能量
|
||||
@@ -0,0 +1,37 @@
|
||||
# GetReverbLevel
|
||||
|
||||
**所属类**: `AudioListenerComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioListenerComponent.h`
|
||||
|
||||
**描述**: 获取音频监听器的混响等级。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
float GetReverbLevel() const;
|
||||
```
|
||||
|
||||
## 返回值
|
||||
|
||||
| 类型 | 描述 |
|
||||
|------|------|
|
||||
| `float` | 当前混响等级,范围 0.0 到 1.0 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioListenerComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void PrintReverbLevel(AudioListenerComponent* listener) {
|
||||
float level = listener->GetReverbLevel();
|
||||
printf("Reverb level: %.2f\n", level);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioListenerComponent](./audio-listener-component.md) - 音频监听器组件
|
||||
- [SetReverbLevel](./set-reverb-level.md) - 设置混响等级
|
||||
42
docs/api/components/audio-listener-component/get-reverb.md
Normal file
42
docs/api/components/audio-listener-component/get-reverb.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# GetReverb
|
||||
|
||||
**所属类**: `AudioListenerComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioListenerComponent.h`
|
||||
|
||||
**描述**: 获取音频监听器当前的混响效果器。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
Audio::AudioMixer* GetReverb() const;
|
||||
```
|
||||
|
||||
## 返回值
|
||||
|
||||
| 类型 | 描述 |
|
||||
|------|------|
|
||||
| `Audio::AudioMixer*` | 混响效果器指针,如果未设置则返回 nullptr |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioListenerComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
using namespace XCEngine::Audio;
|
||||
|
||||
void CheckReverb(AudioListenerComponent* listener) {
|
||||
AudioMixer* reverb = listener->GetReverb();
|
||||
if (reverb) {
|
||||
printf("Reverb effect is set\n");
|
||||
} else {
|
||||
printf("No reverb effect\n");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioListenerComponent](./audio-listener-component.md) - 音频监听器组件
|
||||
- [SetReverb](./set-reverb.md) - 设置混响效果器
|
||||
@@ -0,0 +1,37 @@
|
||||
# GetSpeedOfSound
|
||||
|
||||
**所属类**: `AudioListenerComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioListenerComponent.h`
|
||||
|
||||
**描述**: 获取声音传播速度。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
float GetSpeedOfSound() const;
|
||||
```
|
||||
|
||||
## 返回值
|
||||
|
||||
| 类型 | 描述 |
|
||||
|------|------|
|
||||
| `float` | 当前声速设置,单位米/秒 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioListenerComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void PrintSpeedOfSound(AudioListenerComponent* listener) {
|
||||
float speed = listener->GetSpeedOfSound();
|
||||
printf("Speed of sound: %.1f m/s\n", speed);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioListenerComponent](./audio-listener-component.md) - 音频监听器组件
|
||||
- [SetSpeedOfSound](./set-speed-of-sound.md) - 设置声速
|
||||
@@ -0,0 +1,44 @@
|
||||
# SetDopplerLevel
|
||||
|
||||
**所属类**: `AudioListenerComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioListenerComponent.h`
|
||||
|
||||
**描述**: 设置音频监听器的多普勒效应等级。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
void SetDopplerLevel(float level);
|
||||
```
|
||||
|
||||
## 参数
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
|------|------|------|
|
||||
| `level` | `float` | 多普勒等级,1.0 为默认值,0.0 禁用多普勒效应 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioListenerComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void SetupDoppler(AudioListenerComponent* listener) {
|
||||
// 设置正常多普勒效应
|
||||
listener->SetDopplerLevel(1.0f);
|
||||
|
||||
// 禁用多普勒效应
|
||||
listener->SetDopplerLevel(0.0f);
|
||||
|
||||
// 增强多普勒效应
|
||||
listener->SetDopplerLevel(2.0f);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioListenerComponent](./audio-listener-component.md) - 音频监听器组件
|
||||
- [GetDopplerLevel](./get-doppler-level.md) - 获取多普勒等级
|
||||
- [SetSpeedOfSound](./set-speed-of-sound.md) - 设置声速
|
||||
37
docs/api/components/audio-listener-component/set-mute.md
Normal file
37
docs/api/components/audio-listener-component/set-mute.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# SetMute
|
||||
|
||||
**所属类**: `AudioListenerComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioListenerComponent.h`
|
||||
|
||||
**描述**: 设置音频监听器的静音状态。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
void SetMute(bool mute);
|
||||
```
|
||||
|
||||
## 参数
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
|------|------|------|
|
||||
| `mute` | `bool` | 静音状态,true 启用静音,false 禁用静音 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioListenerComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void ToggleMute(AudioListenerComponent* listener) {
|
||||
bool currentMute = listener->IsMute();
|
||||
listener->SetMute(!currentMute);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioListenerComponent](./audio-listener-component.md) - 音频监听器组件
|
||||
- [IsMute](./is-mute.md) - 检查静音状态
|
||||
@@ -0,0 +1,44 @@
|
||||
# SetReverbLevel
|
||||
|
||||
**所属类**: `AudioListenerComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioListenerComponent.h`
|
||||
|
||||
**描述**: 设置音频监听器的混响等级。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
void SetReverbLevel(float level);
|
||||
```
|
||||
|
||||
## 参数
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
|------|------|------|
|
||||
| `level` | `float` | 混响等级,0.0 到 1.0,0.0 表示无混响,1.0 表示完全混响 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioListenerComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void SetupReverb(AudioListenerComponent* listener) {
|
||||
// 无混响
|
||||
listener->SetReverbLevel(0.0f);
|
||||
|
||||
// 半混响
|
||||
listener->SetReverbLevel(0.5f);
|
||||
|
||||
// 完全混响
|
||||
listener->SetReverbLevel(1.0f);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioListenerComponent](./audio-listener-component.md) - 音频监听器组件
|
||||
- [GetReverbLevel](./get-reverb-level.md) - 获取混响等级
|
||||
- [SetReverb](./set-reverb.md) - 设置混响效果器
|
||||
40
docs/api/components/audio-listener-component/set-reverb.md
Normal file
40
docs/api/components/audio-listener-component/set-reverb.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# SetReverb
|
||||
|
||||
**所属类**: `AudioListenerComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioListenerComponent.h`
|
||||
|
||||
**描述**: 设置音频监听器的混响效果器。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
void SetReverb(Audio::AudioMixer* reverb);
|
||||
```
|
||||
|
||||
## 参数
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
|------|------|------|
|
||||
| `reverb` | `Audio::AudioMixer*` | 混响效果器指针,设置为 nullptr 则禁用混响 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioListenerComponent.h>
|
||||
#include <XCEngine/Audio/AudioMixer.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
using namespace XCEngine::Audio;
|
||||
|
||||
void SetupReverbEffect(AudioListenerComponent* listener, AudioMixer* reverbMixer) {
|
||||
listener->SetReverb(reverbMixer);
|
||||
listener->SetReverbLevel(0.5f);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioListenerComponent](./audio-listener-component.md) - 音频监听器组件
|
||||
- [GetReverb](./get-reverb.md) - 获取混响效果器
|
||||
- [SetReverbLevel](./set-reverb-level.md) - 设置混响等级
|
||||
@@ -0,0 +1,41 @@
|
||||
# SetSpeedOfSound
|
||||
|
||||
**所属类**: `AudioListenerComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioListenerComponent.h`
|
||||
|
||||
**描述**: 设置声音在空气中的传播速度,用于多普勒效应计算。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
void SetSpeedOfSound(float metersPerSecond);
|
||||
```
|
||||
|
||||
## 参数
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
|------|------|------|
|
||||
| `metersPerSecond` | `float` | 声速,单位米/秒,默认值为 343.0(20度 Celsius 时的声速) |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioListenerComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void SetupSpeedOfSound(AudioListenerComponent* listener) {
|
||||
// 标准声速(20度 Celsius)
|
||||
listener->SetSpeedOfSound(343.0f);
|
||||
|
||||
// 水中的声速
|
||||
listener->SetSpeedOfSound(1480.0f);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioListenerComponent](./audio-listener-component.md) - 音频监听器组件
|
||||
- [GetSpeedOfSound](./get-speed-of-sound.md) - 获取声速
|
||||
- [SetDopplerLevel](./set-doppler-level.md) - 设置多普勒等级
|
||||
38
docs/api/components/audio-source-component/get-3d-params.md
Normal file
38
docs/api/components/audio-source-component/get-3d-params.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# Get3DParams
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 获取音频源的3D音频参数。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
const Audio::Audio3DParams& Get3DParams() const;
|
||||
```
|
||||
|
||||
## 返回值
|
||||
|
||||
| 类型 | 描述 |
|
||||
|------|------|
|
||||
| `const Audio::Audio3DParams&` | 3D音频参数引用 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void Print3DParams(AudioSourceComponent* source) {
|
||||
const auto& params = source->Get3DParams();
|
||||
printf("Doppler: %.2f, Spread: %.2f, ReverbZoneMix: %.2f\n",
|
||||
params.dopplerLevel, params.spread, params.reverbZoneMix);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [Set3DParams](./set-3d-params.md) - 设置3D参数
|
||||
41
docs/api/components/audio-source-component/get-clip.md
Normal file
41
docs/api/components/audio-source-component/get-clip.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# GetClip
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 获取音频源当前播放的音频片段。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
Resources::AudioClip* GetClip() const;
|
||||
```
|
||||
|
||||
## 返回值
|
||||
|
||||
| 类型 | 描述 |
|
||||
|------|------|
|
||||
| `Resources::AudioClip*` | 音频片段指针,如果未设置则返回 nullptr |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void CheckCurrentClip(AudioSourceComponent* source) {
|
||||
auto clip = source->GetClip();
|
||||
if (clip) {
|
||||
printf("Current clip: %s\n", clip->GetName().c_str());
|
||||
} else {
|
||||
printf("No clip set\n");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [SetClip](./set-clip.md) - 设置音频片段
|
||||
@@ -0,0 +1,37 @@
|
||||
# GetDopplerLevel
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 获取音频源的多普勒效应等级。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
float GetDopplerLevel() const;
|
||||
```
|
||||
|
||||
## 返回值
|
||||
|
||||
| 类型 | 描述 |
|
||||
|------|------|
|
||||
| `float` | 当前多普勒等级 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void PrintDopplerLevel(AudioSourceComponent* source) {
|
||||
float level = source->GetDopplerLevel();
|
||||
printf("Doppler level: %.2f\n", level);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [SetDopplerLevel](./set-doppler-level.md) - 设置多普勒等级
|
||||
38
docs/api/components/audio-source-component/get-duration.md
Normal file
38
docs/api/components/audio-source-component/get-duration.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# GetDuration
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 获取音频源当前音频的总时长。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
float GetDuration() const;
|
||||
```
|
||||
|
||||
## 返回值
|
||||
|
||||
| 类型 | 描述 |
|
||||
|------|------|
|
||||
| `float` | 音频总时长,单位秒。如果没有设置音频片段则返回 0.0 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void PrintDuration(AudioSourceComponent* source) {
|
||||
float duration = source->GetDuration();
|
||||
printf("Duration: %.2f seconds\n", duration);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [GetTime](./get-time.md) - 获取当前播放位置
|
||||
- [SetClip](./set-clip.md) - 设置音频片段
|
||||
@@ -0,0 +1,41 @@
|
||||
# GetOutputMixer
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 获取音频源的输出混音器。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
Audio::AudioMixer* GetOutputMixer() const;
|
||||
```
|
||||
|
||||
## 返回值
|
||||
|
||||
| 类型 | 描述 |
|
||||
|------|------|
|
||||
| `Audio::AudioMixer*` | 输出混音器指针,如果未设置则返回 nullptr |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void CheckOutputMixer(AudioSourceComponent* source) {
|
||||
auto* mixer = source->GetOutputMixer();
|
||||
if (mixer) {
|
||||
printf("Output mixer is set\n");
|
||||
} else {
|
||||
printf("Using default output\n");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [SetOutputMixer](./set-output-mixer.md) - 设置输出混音器
|
||||
37
docs/api/components/audio-source-component/get-pan.md
Normal file
37
docs/api/components/audio-source-component/get-pan.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# GetPan
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 获取音频源的平移值。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
float GetPan() const;
|
||||
```
|
||||
|
||||
## 返回值
|
||||
|
||||
| 类型 | 描述 |
|
||||
|------|------|
|
||||
| `float` | 当前平移值,-1.0 到 1.0 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void PrintPan(AudioSourceComponent* source) {
|
||||
float pan = source->GetPan();
|
||||
printf("Pan: %.2f\n", pan);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [SetPan](./set-pan.md) - 设置平移值
|
||||
37
docs/api/components/audio-source-component/get-pitch.md
Normal file
37
docs/api/components/audio-source-component/get-pitch.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# GetPitch
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 获取音频源的音高。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
float GetPitch() const;
|
||||
```
|
||||
|
||||
## 返回值
|
||||
|
||||
| 类型 | 描述 |
|
||||
|------|------|
|
||||
| `float` | 当前音高,1.0 为正常速度 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void PrintPitch(AudioSourceComponent* source) {
|
||||
float pitch = source->GetPitch();
|
||||
printf("Pitch: %.2f\n", pitch);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [SetPitch](./set-pitch.md) - 设置音高
|
||||
@@ -0,0 +1,37 @@
|
||||
# GetReverbZoneMix
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 获取音频源的混响区域混合比例。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
float GetReverbZoneMix() const;
|
||||
```
|
||||
|
||||
## 返回值
|
||||
|
||||
| 类型 | 描述 |
|
||||
|------|------|
|
||||
| `float` | 当前混响混合比例,0.0 到 1.0 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void PrintReverbZoneMix(AudioSourceComponent* source) {
|
||||
float mix = source->GetReverbZoneMix();
|
||||
printf("Reverb zone mix: %.2f\n", mix);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [SetReverbZoneMix](./set-reverb-zone-mix.md) - 设置混响混合比例
|
||||
37
docs/api/components/audio-source-component/get-spread.md
Normal file
37
docs/api/components/audio-source-component/get-spread.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# GetSpread
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 获取音频源的扩散角度。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
float GetSpread() const;
|
||||
```
|
||||
|
||||
## 返回值
|
||||
|
||||
| 类型 | 描述 |
|
||||
|------|------|
|
||||
| `float` | 当前扩散角度(度) |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void PrintSpread(AudioSourceComponent* source) {
|
||||
float spread = source->GetSpread();
|
||||
printf("Spread: %.1f degrees\n", spread);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [SetSpread](./set-spread.md) - 设置扩散角度
|
||||
39
docs/api/components/audio-source-component/get-time.md
Normal file
39
docs/api/components/audio-source-component/get-time.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# GetTime
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 获取音频源当前的播放位置。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
float GetTime() const;
|
||||
```
|
||||
|
||||
## 返回值
|
||||
|
||||
| 类型 | 描述 |
|
||||
|------|------|
|
||||
| `float` | 当前播放位置,单位秒 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void PrintCurrentTime(AudioSourceComponent* source) {
|
||||
float time = source->GetTime();
|
||||
float duration = source->GetDuration();
|
||||
printf("%.1f / %.1f seconds\n", time, duration);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [SetTime](./set-time.md) - 设置播放位置
|
||||
- [GetDuration](./get-duration.md) - 获取总时长
|
||||
37
docs/api/components/audio-source-component/get-volume.md
Normal file
37
docs/api/components/audio-source-component/get-volume.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# GetVolume
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 获取音频源的音量。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
float GetVolume() const;
|
||||
```
|
||||
|
||||
## 返回值
|
||||
|
||||
| 类型 | 描述 |
|
||||
|------|------|
|
||||
| `float` | 当前音量,范围 0.0 到 1.0 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void PrintVolume(AudioSourceComponent* source) {
|
||||
float volume = source->GetVolume();
|
||||
printf("Volume: %.2f\n", volume);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [SetVolume](./set-volume.md) - 设置音量
|
||||
@@ -0,0 +1,41 @@
|
||||
# IsEnergyDetecting
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 检查音频能量检测是否处于活跃状态。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
bool IsEnergyDetecting() const;
|
||||
```
|
||||
|
||||
## 返回值
|
||||
|
||||
| 类型 | 描述 |
|
||||
|------|------|
|
||||
| `bool` | true 表示正在检测能量,false 表示未检测 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void CheckEnergyDetection(AudioSourceComponent* source) {
|
||||
if (source->IsEnergyDetecting()) {
|
||||
float energy = source->GetEnergy();
|
||||
printf("Current energy: %.2f\n", energy);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [StartEnergyDetect](./start-energy-detect.md) - 开始能量检测
|
||||
- [StopEnergyDetect](./stop-energy-detect.md) - 停止能量检测
|
||||
- [GetEnergy](./get-energy.md) - 获取当前能量值
|
||||
38
docs/api/components/audio-source-component/is-looping.md
Normal file
38
docs/api/components/audio-source-component/is-looping.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# IsLooping
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 检查音频源是否设置为循环播放。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
bool IsLooping() const;
|
||||
```
|
||||
|
||||
## 返回值
|
||||
|
||||
| 类型 | 描述 |
|
||||
|------|------|
|
||||
| `bool` | true 表示循环播放,false 表示播放一次后停止 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void CheckLoopingStatus(AudioSourceComponent* source) {
|
||||
if (source->IsLooping()) {
|
||||
printf("Audio is looping\n");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [SetLooping](./set-looping.md) - 设置循环播放
|
||||
38
docs/api/components/audio-source-component/is-paused.md
Normal file
38
docs/api/components/audio-source-component/is-paused.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# IsPaused
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 检查音频源是否处于暂停状态。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
bool IsPaused() const;
|
||||
```
|
||||
|
||||
## 返回值
|
||||
|
||||
| 类型 | 描述 |
|
||||
|------|------|
|
||||
| `bool` | true 表示已暂停,false 表示未暂停 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void CheckPausedStatus(AudioSourceComponent* source) {
|
||||
if (source->IsPaused()) {
|
||||
printf("Audio is paused\n");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [IsPlaying](./is-playing.md) - 检查是否正在播放
|
||||
40
docs/api/components/audio-source-component/is-playing.md
Normal file
40
docs/api/components/audio-source-component/is-playing.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# IsPlaying
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 检查音频源是否正在播放。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
bool IsPlaying() const;
|
||||
```
|
||||
|
||||
## 返回值
|
||||
|
||||
| 类型 | 描述 |
|
||||
|------|------|
|
||||
| `bool` | true 表示正在播放,false 表示未在播放 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void CheckPlayingStatus(AudioSourceComponent* source) {
|
||||
if (source->IsPlaying()) {
|
||||
printf("Audio is playing\n");
|
||||
} else {
|
||||
printf("Audio is not playing\n");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [IsPaused](./is-paused.md) - 检查是否暂停
|
||||
38
docs/api/components/audio-source-component/is-spatialize.md
Normal file
38
docs/api/components/audio-source-component/is-spatialize.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# IsSpatialize
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 检查音频源是否启用3D空间化。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
bool IsSpatialize() const;
|
||||
```
|
||||
|
||||
## 返回值
|
||||
|
||||
| 类型 | 描述 |
|
||||
|------|------|
|
||||
| `bool` | true 表示启用3D空间化,false 表示禁用 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void CheckSpatializeStatus(AudioSourceComponent* source) {
|
||||
if (source->IsSpatialize()) {
|
||||
printf("3D spatialization is enabled\n");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [SetSpatialize](./set-spatialize.md) - 设置空间化
|
||||
31
docs/api/components/audio-source-component/pause.md
Normal file
31
docs/api/components/audio-source-component/pause.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# Pause
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 暂停音频播放。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
void Pause();
|
||||
```
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void PauseAudio(AudioSourceComponent* source) {
|
||||
source->Pause();
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [Play](./play.md) - 开始播放
|
||||
- [Stop](./stop.md) - 停止播放
|
||||
31
docs/api/components/audio-source-component/play.md
Normal file
31
docs/api/components/audio-source-component/play.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# Play
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 开始播放音频。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
void Play();
|
||||
```
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void StartPlayback(AudioSourceComponent* source) {
|
||||
source->Play();
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [Pause](./pause.md) - 暂停播放
|
||||
- [Stop](./stop.md) - 停止播放
|
||||
39
docs/api/components/audio-source-component/set-clip.md
Normal file
39
docs/api/components/audio-source-component/set-clip.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# SetClip
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 设置音频源播放的音频片段。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
void SetClip(Resources::AudioClip* clip);
|
||||
```
|
||||
|
||||
## 参数
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
|------|------|------|
|
||||
| `clip` | `Resources::AudioClip*` | 音频片段指针,设置为 nullptr 则清除当前片段 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
#include <XCEngine/Resources/AudioClip/AudioClip.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void LoadAndPlaySound(AudioSourceComponent* source) {
|
||||
auto clip = Resources::AudioClip::Load("assets/audio/ explosion.wav");
|
||||
source->SetClip(clip);
|
||||
source->Play();
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [GetClip](./get-clip.md) - 获取当前音频片段
|
||||
@@ -0,0 +1,36 @@
|
||||
# SetDopplerLevel
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 设置音频源的多普勒效应等级。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
void SetDopplerLevel(float level);
|
||||
```
|
||||
|
||||
## 参数
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
|------|------|------|
|
||||
| `level` | `float` | 多普勒等级,1.0 为默认值,0.0 禁用 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void SetupDoppler(AudioSourceComponent* source) {
|
||||
source->SetDopplerLevel(1.0f);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [GetDopplerLevel](./get-doppler-level.md) - 获取多普勒等级
|
||||
36
docs/api/components/audio-source-component/set-looping.md
Normal file
36
docs/api/components/audio-source-component/set-looping.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# SetLooping
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 设置音频源是否循环播放。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
void SetLooping(bool loop);
|
||||
```
|
||||
|
||||
## 参数
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
|------|------|------|
|
||||
| `loop` | `bool` | true 启用循环播放,false 播放一次后停止 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void SetupLooping(AudioSourceComponent* source, bool shouldLoop) {
|
||||
source->SetLooping(shouldLoop);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [IsLooping](./is-looping.md) - 检查是否循环播放
|
||||
43
docs/api/components/audio-source-component/set-pan.md
Normal file
43
docs/api/components/audio-source-component/set-pan.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# SetPan
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 设置音频源的平移值(左右声道分布)。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
void SetPan(float pan);
|
||||
```
|
||||
|
||||
## 参数
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
|------|------|------|
|
||||
| `pan` | `float` | 平移值,-1.0 表示完全左声道,0.0 表示居中,1.0 表示完全右声道 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void SetupPan(AudioSourceComponent* source) {
|
||||
// 居中
|
||||
source->SetPan(0.0f);
|
||||
|
||||
// 偏左
|
||||
source->SetPan(-0.5f);
|
||||
|
||||
// 偏右
|
||||
source->SetPan(0.5f);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [GetPan](./get-pan.md) - 获取平移值
|
||||
43
docs/api/components/audio-source-component/set-pitch.md
Normal file
43
docs/api/components/audio-source-component/set-pitch.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# SetPitch
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 设置音频源的音高。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
void SetPitch(float pitch);
|
||||
```
|
||||
|
||||
## 参数
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
|------|------|------|
|
||||
| `pitch` | `float` | 音高,0.5 表示半速,1.0 表示正常速度,2.0 表示双倍速度 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void SetupPitch(AudioSourceComponent* source) {
|
||||
// 正常音高
|
||||
source->SetPitch(1.0f);
|
||||
|
||||
// 低八度
|
||||
source->SetPitch(0.5f);
|
||||
|
||||
// 高八度
|
||||
source->SetPitch(2.0f);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [GetPitch](./get-pitch.md) - 获取音高
|
||||
@@ -0,0 +1,43 @@
|
||||
# SetReverbZoneMix
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 设置混响区域混合比例。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
void SetReverbZoneMix(float mix);
|
||||
```
|
||||
|
||||
## 参数
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
|------|------|------|
|
||||
| `mix` | `float` | 混响混合比例,0.0 到 1.0,0.0 表示干声,1.0 表示完全混响 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void SetupReverbZoneMix(AudioSourceComponent* source) {
|
||||
// 干声(无混响)
|
||||
source->SetReverbZoneMix(0.0f);
|
||||
|
||||
// 半湿声
|
||||
source->SetReverbZoneMix(0.5f);
|
||||
|
||||
// 完全混响
|
||||
source->SetReverbZoneMix(1.0f);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [GetReverbZoneMix](./get-reverb-zone-mix.md) - 获取混响混合比例
|
||||
40
docs/api/components/audio-source-component/set-spatialize.md
Normal file
40
docs/api/components/audio-source-component/set-spatialize.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# SetSpatialize
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 设置音频源是否启用3D空间化。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
void SetSpatialize(bool spatialize);
|
||||
```
|
||||
|
||||
## 参数
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
|------|------|------|
|
||||
| `spatialize` | `bool` | true 启用3D空间化,false 禁用(2D模式) |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void SetupSpatialize(AudioSourceComponent* source) {
|
||||
// 启用3D空间化(环境音)
|
||||
source->SetSpatialize(true);
|
||||
|
||||
// 禁用3D空间化(UI音效)
|
||||
source->SetSpatialize(false);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [IsSpatialize](./is-spatialize.md) - 检查是否启用空间化
|
||||
43
docs/api/components/audio-source-component/set-spread.md
Normal file
43
docs/api/components/audio-source-component/set-spread.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# SetSpread
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 设置音频源的扩散角度。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
void SetSpread(float spread);
|
||||
```
|
||||
|
||||
## 参数
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
|------|------|------|
|
||||
| `spread` | `float` | 扩散角度,0.0 到 360.0 度,0 表示点声源,360 表示全向 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void SetupSpread(AudioSourceComponent* source) {
|
||||
// 点声源
|
||||
source->SetSpread(0.0f);
|
||||
|
||||
// 半全向
|
||||
source->SetSpread(180.0f);
|
||||
|
||||
// 全向
|
||||
source->SetSpread(360.0f);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [GetSpread](./get-spread.md) - 获取扩散角度
|
||||
41
docs/api/components/audio-source-component/set-time.md
Normal file
41
docs/api/components/audio-source-component/set-time.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# SetTime
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 设置音频源的当前播放位置。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
void SetTime(float seconds);
|
||||
```
|
||||
|
||||
## 参数
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
|------|------|------|
|
||||
| `seconds` | `float` | 播放位置,单位秒 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void SeekToPosition(AudioSourceComponent* source, float seconds) {
|
||||
source->SetTime(seconds);
|
||||
}
|
||||
|
||||
void RewindToStart(AudioSourceComponent* source) {
|
||||
source->SetTime(0.0f);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [GetTime](./get-time.md) - 获取当前播放位置
|
||||
- [GetDuration](./get-duration.md) - 获取总时长
|
||||
@@ -0,0 +1,32 @@
|
||||
# StartEnergyDetect
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 开始音频能量检测。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
void StartEnergyDetect();
|
||||
```
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void BeginEnergyDetection(AudioSourceComponent* source) {
|
||||
source->StartEnergyDetect();
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [StopEnergyDetect](./stop-energy-detect.md) - 停止能量检测
|
||||
- [IsEnergyDetecting](./is-energy-detecting.md) - 检查是否正在检测
|
||||
- [GetEnergy](./get-energy.md) - 获取当前能量值
|
||||
@@ -0,0 +1,31 @@
|
||||
# StopEnergyDetect
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 停止音频能量检测。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
void StopEnergyDetect();
|
||||
```
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void EndEnergyDetection(AudioSourceComponent* source) {
|
||||
source->StopEnergyDetect();
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [StartEnergyDetect](./start-energy-detect.md) - 开始能量检测
|
||||
- [IsEnergyDetecting](./is-energy-detecting.md) - 检查是否正在检测
|
||||
42
docs/api/components/audio-source-component/stop.md
Normal file
42
docs/api/components/audio-source-component/stop.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# Stop
|
||||
|
||||
**所属类**: `AudioSourceComponent`
|
||||
|
||||
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
|
||||
|
||||
**描述**: 停止音频播放。
|
||||
|
||||
## 函数签名
|
||||
|
||||
```cpp
|
||||
void Stop(Audio::StopMode mode = Audio::StopMode::Immediate);
|
||||
```
|
||||
|
||||
## 参数
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
|------|------|------|
|
||||
| `mode` | `Audio::StopMode` | 停止模式,默认为 Immediate(立即停止) |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/AudioSourceComponent.h>
|
||||
#include <XCEngine/Audio/AudioTypes.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void StopAudio(AudioSourceComponent* source) {
|
||||
source->Stop(Audio::StopMode::Immediate);
|
||||
}
|
||||
|
||||
void FadeOutAndStop(AudioSourceComponent* source) {
|
||||
source->Stop(Audio::StopMode::FadeOut);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
|
||||
- [Play](./play.md) - 开始播放
|
||||
- [Pause](./pause.md) - 暂停播放
|
||||
@@ -42,6 +42,7 @@ GameObject 是 XCEngine ECS 架构中的实体(Entity)类,代表游戏世
|
||||
| [`GetComponentInChildren`](get-component-in-children.md) | 在子对象中查找组件 |
|
||||
| [`GetComponentInParent`](get-component-in-parent.md) | 在父对象中查找组件 |
|
||||
| [`GetComponentsInChildren`](get-components-in-children.md) | 获取所有子对象的指定组件 |
|
||||
| [`RemoveComponent`](remove-component.md) | 移除组件(模板方法) |
|
||||
|
||||
### 层级结构
|
||||
|
||||
|
||||
26
docs/api/components/game-object/remove-component.md
Normal file
26
docs/api/components/game-object/remove-component.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# GameObject::RemoveComponent
|
||||
|
||||
移除指定类型的组件。
|
||||
|
||||
```cpp
|
||||
template<typename T>
|
||||
void RemoveComponent();
|
||||
|
||||
bool RemoveComponent(Component* component);
|
||||
```
|
||||
|
||||
模板版本根据类型移除组件,参数版本根据指针移除具体组件实例。TransformComponent 无法被移除。
|
||||
|
||||
**模板参数:**
|
||||
- `T` - 组件类型
|
||||
|
||||
**参数:**
|
||||
- `component` - 要移除的组件指针
|
||||
|
||||
**返回:** `bool` - 对于指针版本,如果成功移除则返回 true
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [GameObject 总览](game-object.md)
|
||||
- [AddComponent](add-component.md)
|
||||
- [GetComponent](get-component.md)
|
||||
Reference in New Issue
Block a user