Does AUGraph deprecation means no more audio render callbacks?

北城余情 提交于 2020-06-12 08:17:30

问题


I have an app with an elaborated render callback that I doubt could do with AVAudioEngine.

Anyway to use my AUGraph render callback ( with multiple buses ) with AVAudioEngine ?

Any sample code ?


回答1:


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.




回答2:


A (non-deprecated) V3 AUAudioUnit subclass can still return an AUInternalRenderBlock which supports audio render callbacks. The AVAudioEngine API can then connect these Audio Units (for instance, to mixer nodes). Audio Unit V3 render functions still seem to allow short (buffers with less than 500 samples) for near-real-time audio synthesis and analysis on iOS.

See my V3 AU example app on GitHub (mixed Swift and Objective C): https://github.com/hotpaw2/auv3test5



来源:https://stackoverflow.com/questions/56778707/does-augraph-deprecation-means-no-more-audio-render-callbacks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!