30 lines
652 B
Markdown
30 lines
652 B
Markdown
|
|
# AudioSystem::RegisterSource
|
||
|
|
|
||
|
|
注册音频源。
|
||
|
|
|
||
|
|
```cpp
|
||
|
|
void RegisterSource(Components::AudioSourceComponent* source);
|
||
|
|
```
|
||
|
|
|
||
|
|
将音频源组件注册到音频系统。已注册的音频源将在每帧 Update 时被处理和混音。
|
||
|
|
|
||
|
|
**参数:**
|
||
|
|
- `source` - 要注册的 AudioSourceComponent 指针
|
||
|
|
|
||
|
|
**示例:**
|
||
|
|
|
||
|
|
```cpp
|
||
|
|
#include <XCEngine/Audio/AudioSystem.h>
|
||
|
|
|
||
|
|
using namespace XCEngine::Audio;
|
||
|
|
|
||
|
|
void RegisterAudioSource(Components::AudioSourceComponent* audioSource) {
|
||
|
|
AudioSystem::Get().RegisterSource(audioSource);
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
## 相关文档
|
||
|
|
|
||
|
|
- [AudioSystem 总览](audio-system.md)
|
||
|
|
- [UnregisterSource](unregister-source.md) - 注销音频源
|