【发布时间】:2011-04-12 18:21:03
【问题描述】:
我正在编写一个需要托管音频单元的 Objective-C++ 框架。如果我尝试使用 Apple 的默认单元(如 DLS Synth 和各种效果器),一切都可以正常工作。但是,我的应用程序似乎无法找到任何第三方音频单元(在 /Library/Audio/Plug-Ins/Components 中)。
比如下面的代码sn -p...
CAComponentDescription tInstrumentDesc =
CAComponentDescription('aumu','dls ','appl');
AUGraphAddNode(mGraph, &tInstrumentDesc, &mInstrumentNode);
AUGraphOpen(mGraph);
...工作得很好。但是,如果我改为使用 'aumu', 'NiMa', '-Ni-'(对 Native Instruments 的大规模合成器的描述)初始化 tInstrumentDesc,那么 AUGraphOpen() 将返回 OSStatus 错误 badComponentType 并且 AUGraph 将无法打开。这适用于我所有的第三方音频单元。
以下代码从 Audacity 源代码修改而来,稍微阐明了这个问题。它循环遍历特定类型的所有可用音频单元并打印出它们的名称。
ComponentDescription d;
d.componentType = 'aumu';
d.componentSubType = 0;
d.componentManufacturer = 0;
d.componentFlags = 0;
d.componentFlagsMask = 0;
Component c = FindNextComponent(NULL, &d);
while(c != NULL)
{
ComponentDescription found;
Handle nameHandle = NewHandle(0);
GetComponentInfo(c, &found, nameHandle, 0, 0);
printf((*nameHandle)+1);
printf("\n");
c = FindNextComponent(c, &d);
}
运行此代码后,唯一的输出是Apple: DLSMusicDevice(这是符合上述'aumu', 'dls ', 'appl' 描述的音频单元)。
这似乎不是单位本身的问题,因为 Apple 的 auval 工具列出了我的第三方单位(他们也验证了)。
我尝试使用sudo 运行我的测试应用程序,而我正在处理的自定义框架位于/Library/Frameworks 中。
【问题讨论】: