在CoreAudio中,设置kAudioDevicePropertyBufferFrameSize有什么优点/缺点?

发布于 2024-08-22 21:08:36 字数 432 浏览 4 评论 0原文

在 CoreAudio 中从麦克风录音时,kAudioDevicePropertyBufferFrameSize 有何用途? 文档说它是“一个 UInt32,其值指示 IO 缓冲区中的帧数”。但是,这并没有说明您为什么要设置它。

kAudioDevicePropertyBufferFrameSizeRange 属性为您提供了缓冲区帧大小的有效最小值和最大值。将缓冲区帧大小设置为最大值是否会减慢速度?您什么时候想将其设置为默认值以外的其他值?

When recording from a microphone in CoreAudio, what is kAudioDevicePropertyBufferFrameSize for? The docs say it's "A UInt32 whose value indicates the number of frames in the IO buffers". However, this doesn't give any indication of why you would want to set it.

The kAudioDevicePropertyBufferFrameSizeRange property gives you a valid minimum and maximum for the bufferframe size. Does setting the bufferframe size to the max slow things down? When would you want to set it to something other than the default?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夜雨飘雪 2024-08-29 21:08:36

以下是他们在 CoreAudio 列表上所说的话:

寻找低功耗的应用程序
延迟 IO 应将此值设置为
小到可以跟上。

另一方面,不支持的应用程序
有较大的交互要求或
低延迟的其他原因可以
增加该值以允许数据
被分成更大的块并且
减少每秒的次数
IOProc 被调用。请注意,这
并不一定会降低总量
加载到系统上。实际上,
增加IO缓冲区大小可以有
与缓冲区相反的影响
更大,这使得它们少得多
可能适合缓存以及不适合什么
这确实会降低性能。

最终,价值
应用程序选择它的 IO 大小确实是
依赖于应用程序的东西
以及它的作用。

Here's what they had to say on the CoreAudio list:

An application that is looking for low
latency IO should set this value as
small as it can keep up with.

On the other hand, apps that don't
have large interaction requirements or
other reasons for low latency can
increase this value to allow the data
to be chunked up in larger chunks and
reduce the number of times per second
the IOProc gets called. Note that this
does not necessarily lower the total
load on the system. In fact,
increasing the IO buffer size can have
the opposite impact as the buffers are
larger which makes them much less
likely to fit in caches and what not
which can really sap performance.

At the end of the day, the value an
app chooses for it's IO size is really
something that is dependent on the app
and what it does.

转角预定愛 2024-08-29 21:08:36

通常您会将其保留为默认值,但如果处理链中有一个 AudioUnit 需要或针对特定缓冲区大小进行了优化,您可能需要更改缓冲区大小。

此外,通常,较大的缓冲区大小会导致录制和播放之间的延迟较高,而较小的缓冲区大小会增加正在录制的每个通道的 CPU 负载。

Usually you'd leave it at the default, but you might want to change the buffer size if you have an AudioUnit in the processing chain that expects or is optimized for a certain buffer size.

Also, generally, larger buffer sizes result in higher latency between recording and playback, while smaller buffer sizes increase the CPU load of each channel being recorded.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文