On second thought, never mind. Since I have an AUGraph, I can get the ComponentDescription from the AUNode, make a new Component from that, and I'm off and running.
ComponentDescription *nodeDesc = malloc (sizeof (ComponentDescription));
nameErr = AUGraphNodeInfo(graph, *node, nodeDesc, NULL);
Component comp = FindNextComponent(NULL, nodeDesc);
// get name from component
Handle unitNameHandle = NewHandle(256);
nameErr = GetComponentInfo(comp, NULL, unitNameHandle, NULL, NULL);
NSString *unitName = @"Unknown";
if (nameErr == noErr) {
unitName = (NSString*) CFStringCreateWithPascalString (kCFAllocatorDefault,
(unsigned char *) *unitNameHandle,
kCFStringEncodingUTF8);
NSLog (@"got name %@", unitName);
} else {
NSLog (@"error getting unit name %d", nameErr);
}
This approach works… don't know if repeatedly finding the component is unduly expensive, though.
On Aug 27, 2010, at 12:48 PM, Chris Adamson wrote:
(except that it doesn't… GetComponentInfo() returns -3000, badComponentId… maybe my code to look up the unit from the node is busted…)