bufferLength | 环形缓冲区中每个缓冲区的长度。 |
numBuffers | 缓冲区数。 |
获取混合器的缓冲区大小,以样本数为单位。
对于移动设备(iOS 设备和 Android),也可以从菜单 Audio Settings > Mobile DSP Buffer size 进行设置。 软件混合器将声音混合到一个环形缓冲区。该环形缓冲区的大小在此确定。它在每个 bufferlength 数量的样本中混合一个声音数据块,共有 numbuffers 个这种声音数据块,它们构成整个环形缓冲区。 调整这些值可能会导致极低的延迟性能(较小的值)或更高的声音输出稳定性(较大的值)。 警告!通常情况下,请勿更改 buffersize。减小粒度只会增加 CPU 使用率(缓存未命中和 DSP 网络开销)。 增大粒度会影响命令更新的频率,例如音量/音高/平移变化。 高于 20ms 的任何声响都会变得明显,声音参数更改将变得突兀、不平滑。 默认情况下,Unity 选择最佳大小来提供最好的稳定性,具体取决于输出类型,以及是否为模拟驱动程序(例如,在 NT 上使用 waveOut 模拟 DirectSound)。 若非实有必要,不建议更改该值。否则,您可能会获得比 Unity 选择的默认设置更差的性能。 从版本 5.0 开始,不再支持通过脚本设置 DSP 缓冲区大小。要进行该项设置,必须在项目设置的 Audio 部分中进行。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.