OpenAL:alcOpenDevice() 慢,可以加快速度吗?
运行此功能最多需要 2 秒,这正常吗?大约需要 0.5 到 2.5 秒,但很少超过 1 秒,通常约为 0.6 到 0.9 秒。
只是想知道,我是否可以以某种方式加快速度,也许记住第一次运行时的设备名称或其他什么?
Is it normal to take up to 2 seconds to run this function? It takes about 0.5 to 2.5 seconds, rarely more than 1 second though, usually around 0.6 to 0.9 seconds.
Just wondering, if i could speed this up somehow, perhaps remembering the device name from the first run or something?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这些方法通常很慢,因为它们可能正在处理设备的初始化等。
我的猜测是,这种方法很慢主要是因为操作系统。
这些类型的方法的常见解决方法是异步执行它们(在后台线程中)并显示“正在加载”文本/图像。您还应该缓存 alcOpenDevice() 返回的指针,这样您就不必付出一遍又一遍调用它的代价。
These methods are usually slow since they're probably handling the initialization of the device, etc.
My guess is that this method is slow mostly because of the operating system.
The usual workarounds these types of methods is doing them asynchronously (in a background thread) and displaying a "Loading" text/image. You should also cache the pointer that alcOpenDevice() returns too so you don't pay the price of calling it over and over again.