Non-default output from AUGraph
Non-default output from AUGraph
- Subject: Non-default output from AUGraph
- From: Frank Vernon <email@hidden>
- Date: Mon, 19 Jan 2004 22:18:42 -0700
I have recently resolved a CoreAudio related issue with some off-list help.
As I could not find it explicitly documented anywhere, and since none of the
knowledgeable people I asked knew directly how to do it, I thought I should
share it with the list.
The following is a simplified example for using non-default HAL output
devices from an AUGraph. Many thanks to those on the list who helped with
this: Jim Cocker, Chandrasekhar Ramakrishnan, Kurt Revis, Kurt Bigler, and
others.
//HAL output device
ComponentDescription cd;
cd.componentType = kAudioUnitType_Output;
cd.componentSubType = kAudioUnitSubType_HALOutput;
cd.componentManufacturer = kAudioUnitManufacturer_Apple;
cd.componentFlags = 0;
cd.componentFlagsMask = 0;
//create graph
AUGraph graph;
NewAUGraph(&graph) ;
//create output device node
AUNode outputNode;
AUGraphNewNode(graph, &cd, 0, NULL, &outputNode);
//open graph so that AU for output device is created
AUGraphOpen(graph);
//get the AU output device just created
AudioUnit outputUnit;
AUGraphGetNodeInfo(graph,
outputNode,
NULL,
NULL,
NULL,
&outputUnit);
//set AudioDeviceID of desired device
AudioDeviceID deviceId = (id of your desired output device);
AudioUnitSetProperty(
outputUnit,
kAudioOutputUnitProperty_CurrentDevice,
kAudioUnitScope_Global,
0,
&deviceId,
sizeof(deviceId));
//you can now initialize the graph
AUGraphInitialize(graph);
Thanks-
Frank Vernon
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.