Files
XCEngine/docs/api/resources/audioclip/release.md

37 lines
589 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.
# AudioClip::Release
```cpp
void Release()
```
释放音频资源,释放存储的音频数据并清除 RHI 资源引用。
## 详细描述
调用此方法后:
1. 清除音频数据(调用 `m_audioData.Clear()`
2. 将 RHI 资源引用置为 `nullptr`
3.`m_isValid` 标记为 `false`
## 参数
## 返回值
## 示例
```cpp
ResourceHandle<AudioClip> sfx = ResourceManager::Get().Load<AudioClip>("sounds/explosion.wav");
sfx->Release();
if (!sfx->IsValid()) {
// 音频已释放
}
```
## 相关文档
- [AudioClip 总览](audioclip.md) - 返回类总览