【问题标题】:What does an Audio Unit Host need to do to make use of non-Apple Audio Units?音频单元主机需要做什么才能使用非 Apple 音频单元?
【发布时间】: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 中。

【问题讨论】:

    标签: macos audiounit


    【解决方案1】:

    原来,问题是由于编译为 64 位。切换到 32 位后,一切都开始像宣传的那样工作。我猜这个解决方案并不多,但你有它。

    澄清一下,我的意思是将 XCode Build Setting ARCHS 更改为“32-bit Intel”,而不是默认的“Standard 32/64-bit Intel”。

    【讨论】:

      【解决方案2】:

      首先,我假设您通过调用NewAUGraph(&mGraph) 来初始化mGraph,而不是仅仅声明它然后尝试打开它。除此之外,我怀疑这里的问题在于您的 AU 图,而不是 AudioUnits 本身。但可以肯定的是,您可能应该尝试手动加载 AudioUnit(即,在图表之外),看看是否有任何错误。

      【讨论】:

      • 感谢您的回复。我正在初始化 mGraph 并在我发布的代码 sn-p 之外做所有适当的工作。原来,问题是由于编译为 64 位。由于是新用户,我还不能发布解决方案。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-07-26
      • 1970-01-01
      • 1970-01-01
      • 2012-07-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多