Macros 音频单元动态注册

Macros 音频单元动态注册,macros,core-audio,sandbox,audiounit,Macros,Core Audio,Sandbox,Audiounit,我们开发了一个自定义音频单元和音频单元托管应用程序。我们正在尝试从应用程序中动态注册自定义音频单元。 下面的代码片段用于动态注册音频单元。(此代码段在Apple技术说明TN2247中提到) #包括 外部音频组件插件接口* MyExampleAUFactoryFunction(常量音频组件描述*索引); OSStatus注册表项示例音频单元() { //填写AU的版本号 UInt32版本=0x00010000; //填写AudioComponentDescription 音频成分描述和描述; de

我们开发了一个自定义音频单元和音频单元托管应用程序。我们正在尝试从应用程序中动态注册自定义音频单元。 下面的代码片段用于动态注册音频单元。(此代码段在Apple技术说明TN2247中提到)

#包括
外部音频组件插件接口*
MyExampleAUFactoryFunction(常量音频组件描述*索引);
OSStatus注册表项示例音频单元()
{
//填写AU的版本号
UInt32版本=0x00010000;
//填写AudioComponentDescription
音频成分描述和描述;
description.componentType=kAudioUnitType_效应;
description.componentSubType='EXAU';
description.component制造商='MYCO';
description.component flagsmask=0;
//使用该标志指示此AudioComponent是沙盒安全的
description.componentFlags=kAudioComponentFlag\u SandboxSafe;
//调用AudioComponentRegister()
返回音频组件登记簿(&theDescription,CFSTR(“我的公司:MyExampleAU”),
版本,MyExampleAUFactoryFunction);
在编译音频单元托管应用程序时,我们发现下面的链接器错误

架构i386的未定义符号:
“_MyExampleAUFactoryFunction”,引用自:


谁能帮我解决这个问题。

我也遇到了这个问题,我的项目只有C和Objective-C代码。
创建单个cpp类并将其添加到项目中,这很有帮助。我不知道链接器内部更深层次的原因是什么。

这是在.c或.cpp文件中吗?MyExampleAUFactoryFunction在哪里定义的?函数在音频单元代码中定义。音频单元是插件,工厂函数名称在其info.plist中列出。请参阅此页nk.我不确定是否在宿主应用程序中访问此工厂函数。在沙盒之前,我使用API RegisterComponentFileRef()注册音频单元。10.8中的此API已被弃用。
#include <AudioUnit/AudioComponent.h>
extern AudioComponentPlugInInterface*
                MyExampleAUFactoryFunction(const AudioComponentDescription *inDesc);

OSStatus RegisterMyExampleAudioUnit()
{
    //  fill out the version number for the AU
    UInt32 theVersion = 0x00010000;

    //  fill out the AudioComponentDescription
    AudioComponentDescription theDescription;
    theDescription.componentType = kAudioUnitType_Effect;
    theDescription.componentSubType = 'EXAU';
    theDescription.componentManufacturer = 'MYCO';
    theDescription.componentFlagsMask = 0;

    //  Use the flag to indicate that this AudioComponent is Sandbox Safe
    theDescription.componentFlags = kAudioComponentFlag_SandboxSafe;

    //  call AudioComponentRegister()
    return AudioComponentRegister(&theDescription, CFSTR("My Company: MyExampleAU"),
                            theVersion, MyExampleAUFactoryFunction);