问题
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