Objective-C:AudioOutputUnitStart需要很长时间才能启动。可能的解决方法? [英] Objective-C: AudioOutputUnitStart takes a long time to start. Possible workaround?

查看:378
本文介绍了Objective-C:AudioOutputUnitStart需要很长时间才能启动。可能的解决方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次我调用AudioOutputUnitStart函数最多需要1-2秒才能启动。我使用AudioOutputUnitStop停止它,是否有类似AudioOutputUnitPause之类的东西,以便第一次启动只花那么多时间?还是我必须一直保持它启动并在停止时输出静音(这似乎不正确)

AudioOutputUnitStart function takes up to 1-2 seconds to start every time I call it. I use AudioOutputUnitStop to stop it, is there something like AudioOutputUnitPause so that it only takes this much to start first time? Or do I have to keep it all the time started and output silence when "stopped" (this doesn't seem right)

谢谢!

编辑:我播放的声音很短(在一秒钟之内,连续不断地播放),所以我不认为是那样,可能不管声音大小,它通常要花费多少。

The sound I play it's pretty short (under a second, streaming continuously ) so I don't think it's that, probably that's how much it usually takes no matter the sound size.

推荐答案

尝试减小音频数据的缓冲区大小。
在第一个缓冲区填充数据之前,iOS不会开始播放。如果此缓冲区很大,则可能需要1-2秒。

Try to decrease your buffer size for your audio data. iOS will not begin playing until the first buffer is filled with data. If this buffer size is quite big, it might take 1-2 seconds.

这篇关于Objective-C:AudioOutputUnitStart需要很长时间才能启动。可能的解决方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆