4

我有一个带有详细渲染回调的应用程序,我怀疑它可以与 AVAudioEngine 一起使用。

无论如何要使用我的 AUGraph 渲染回调(带有多个总线)和 AVAudioEngine 吗?

任何示例代码?

4

2 回答 2

6

The Audio Unit API is not deprecated, only AUGraph which is presumably built on top of it.

Make connections using AudioUnitSetProperty with kAudioUnitProperty_MakeConnection with an AudioUnitConnection struct.

Start and stop your output unit with AudioOutputUnitStart and AudioOutputUnitStop.

Set a render callback using AudioUnitSetProperty and kAudioUnitProperty_SetRenderCallback with an AURenderCallbackStruct

There's really not all that much that AUGraph gives you other than a little bookkeeping and a simpler connection syntax.

于 2019-06-27T02:57:18.937 回答
3

(未弃用的)V3 AUAudioUnit子类仍然可以返回支持音频渲染回调的 AUInternalRenderBlock。然后,AVAudioEngine API 可以连接这些音频单元(例如,连接到混音器节点)。Audio Unit V3 渲染函数似乎仍然允许在 iOS 上进行短时间(少于 500 个样本的缓冲区)进行近实时音频合成和分析。

在 GitHub 上查看我的 V3 AU 示例应用程序(混合 Swift 和 Objective C):https ://github.com/hotpaw2/auv3test5

于 2019-06-27T15:31:16.790 回答