如何创建实现多个音频单元的AUAudioUnit? [英] How do I create an AUAudioUnit that implements multiple audio units?

查看:284
本文介绍了如何创建实现多个音频单元的AUAudioUnit?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Apple的用于创建AUAudio单元的文档中(此处: https://developer .apple.com/documentation/audiotoolbox/auaudiounit/1387570-initwithcomponentdescription ) 他们声称

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.

我找不到此在线示例.理想情况下,如果您的答案/解决方案涉及使用Swift和AVAudioEngine,那将是很好的选择,但是我很乐意接受任何使我朝正确方向前进的答案.

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.

谢谢.

推荐答案

我在我的测试应用程序中发布了一些源代码,该代码在GitHub上使用AVAudioEngine,Swift和C实例化了AVAudioUnit生成器子类对象:

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

请注意, Apple建议在实时音频上下文中不要使用Swift ,这样我的部分源代码是用C语言编写的,位于Objective C包装器类中.

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.

如果您使用 initWithComponentDescription:options:error:,您可以传递一个选项来配置新的音频单元子类对象以执行任何操作(在该选项上使用诸如switch语句之类的东西).

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).

这篇关于如何创建实现多个音频单元的AUAudioUnit?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆