How do I create an AUAudioUnit that implements multiple audio units?

核能气质少年 提交于 2019-12-07 12:03:49

问题


In Apple's docs for creating an AUAudio Unit (Here: https://developer.apple.com/documentation/audiotoolbox/auaudiounit/1387570-initwithcomponentdescription) they claim that

A single audio unit subclass may implement multiple audio units—for example, an effect that can also function as a generator, or a cluster of related effects.

There are no examples of this online that I can find. Ideally it would be nice if your answer/solution involved using Swift and AVAudioEngine but I'd happily accept any answer that gets me moving in the right direction.

Thanks in advance.


回答1:


I posted some source code to my test app which instantiates an AVAudioUnit generator subclass object using AVAudioEngine, Swift and C, on GitHub here:

https://github.com/hotpaw2/auv3test5

Note that Apple recommends NOT using Swift inside the real-time audio context, so that portion of my source code is written in C, inside an Objective C wrapper class.

If you use initWithComponentDescription:options:error:, you can pass an option to configure your new audio unit subclass object to do whatever (using something like a switch statement on the option).



来源:https://stackoverflow.com/questions/46761477/how-do-i-create-an-auaudiounit-that-implements-multiple-audio-units

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