问题
I am writing an Objective-C++ framework which needs to host Audio Units. Everything works perfectly fine if I attempt to make use of Apple's default units like the DLS Synth and various effects. However, my application seems to be unable to find any third-party Audio Units (in /Library/Audio/Plug-Ins/Components).
For example, the following code snippet...
CAComponentDescription tInstrumentDesc =
CAComponentDescription('aumu','dls ','appl');
AUGraphAddNode(mGraph, &tInstrumentDesc, &mInstrumentNode);
AUGraphOpen(mGraph);
...works just fine. However, if I instead initialize tInstrumentDesc
with 'aumu', 'NiMa', '-Ni-'
(the description for Native Instruments' Massive Synth), then AUGraphOpen()
will return the OSStatus
error badComponentType
and the AUGraph will fail to open. This holds true for all of my third party Audio Units.
The following code, modified from the Audacity source, sheds a little light on the problem. It loops through all of the available Audio Units of a certain type and prints out their name.
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);
}
After running this code, the only output is Apple: DLSMusicDevice
(which is the Audio Unit fitting the description 'aumu', 'dls ', 'appl'
above).
This doesn't seem to be a problem with the units themselves, as Apple's auval
tool lists my third party Units (they validate too).
I've tried running my test application with sudo
, and the custom framework I'm working on is in /Library/Frameworks.
回答1:
Turns out, the issue was due to compiling for 64-bit. After switching to 32-bit, everything began to work as advertised. Not much of a solution I guess, but there you have it.
To clarify, I mean changing the XCode Build Setting ARCHS
to "32-bit Intel" as opposed to the default "Standard 32/64-bit Intel".
回答2:
First of all, I'm going to assume that you initialized mGraph
by calling NewAUGraph(&mGraph)
instead of just declaring it and then trying to open it. Beyond that, I suspect that the problem here is with your AU graph, not the AudioUnits themselves. But to be sure, you should probably try loading the AudioUnit manually (ie, outside of a graph) and see if you get any errors that way.
来源:https://stackoverflow.com/questions/5639815/what-does-an-audio-unit-host-need-to-do-to-make-use-of-non-apple-audio-units