Re: aggregate device
Re: aggregate device
- Subject: Re: aggregate device
- From: Jeff Moore <email@hidden>
- Date: Thu, 4 May 2006 12:19:51 -0700
First off, setting the master device should be done after adding the
devices to the aggregate. Setting it before has no effect. Arguably,
the HAL could return an error about this condition. Feel free to file
a bug about it.
Secondly, when you are setting the master device, you are passing
what appears to be the AudioObjectID of the device as a CFString. You
are supposed to pass in it's UID, which is supplied by
kAudioDevicePropertyDeviceUID.
Finally, it appears that the code that is setting the value of
kAudioAggregateDevicePropertyFullSubDeviceList has the same problem.
The CFArray is getting filled with a CFString that contains what
appears to be the device's AudioObjectID rather than it's UID.
My guess is that if you were passing UIDs instead of strings with
AudioObjectIDs in them, things would work better for you.
On May 4, 2006, at 10:42 AM, Christoph Teschner wrote:
yea, I'm iterating through the list of availbale devices and select
the built-in.
the steps I'm doing are: locate the base plug-in, describe the
aggregate I want to create, tell the base plug in to create the
aggregate device. so far I think everything's fine, the newly
created device shows up in AMS.
now, I'm doing the suggested work around. I set the master sub
device to be the built in, still seems to be fine. and finally, I
create an array which contains only the built-in for the sub device
list.
I tried any possible order and variations of those steps, but I
always get the same problem.
whenever, I set the fullsubdevicelist property, two audio devices
show up when I select my aggregate device in AMS. the first one,
doesn't have a name or anything, but its check box is selected and
the second one is the built-in which is not selected. my device
therefore has 0 in and outputs and is unusable, unless I uncheck
this unnamed device (my guess is that this might be the aggreagte
device I've created and it contains itself), then it disappears in
the list of sub devices and then I have to manually set the check
box for the built-in.
is this a bug and if so is there any work around for this ? any
help again much appreciated.
below I have added my code for setting the master sub device as
well as full sub device list. just to make sure that I'm doing
everything right there.
thanks,
christoph
CFStringRef myMasterSubdevice;
for ( x = 0; x < numDevices; x++ ){
if([[self deviceName: deviceList[x]] isEqual:@"Built-in Audio"]){
myMasterSubdevice = CFStringCreateWithFormat(NULL, NULL, CFSTR("%
i"), deviceList[x]);
}
}
theAddress.mSelector = kAudioAggregateDevicePropertyMasterSubDevice;
theAddress.mScope = kAudioObjectPropertyScopeGlobal;
theAddress.mElement = kAudioObjectPropertyElementMaster;
result = AudioObjectSetPropertyData(theID, &theAddress,
0,NULL,sizeof(CFStringRef), &myMasterSubdevice);
// SUB DEVICE LIST
CFArrayRef mySubDeviceList= CFArrayCreate ( NULL, (const void *)
&text, 1, NULL );
CFMutableArrayRef mySubDeviceList = CFArrayCreateMutable(NULL,
0,NULL);
CFStringRef mySubdevice;
for ( x = 0; x < numDevices; x++ ){
if([[self deviceName: deviceList[x]] isEqual: @"Built-in Audio"]){
mySubdevice = CFStringCreateWithFormat(NULL, NULL, CFSTR("%i"),
deviceList[x]);
break;
}
}
CFArrayAppendValue(mySubDeviceList,mySubdevice);
theAddress.mSelector =
kAudioAggregateDevicePropertyFullSubDeviceList;
theAddress.mScope = kAudioObjectPropertyScopeGlobal;
theAddress.mElement = kAudioObjectPropertyElementMaster;
result = AudioObjectSetPropertyData(theID, &theAddress,
0,NULL,sizeof(CFArrayRef), &mySubDeviceList);
// I am not getting errors an any of these calls
From: Jeff Moore <email@hidden>
To: CoreAudio API <email@hidden>
Subject: Re: aggregate device
Date: Wed, 3 May 2006 17:27:49 -0700
The effect of clicking the "Use" checkbox in the AMS UI is
ultimately to set the property,
kAudioAggregateDevicePropertyFullSubDeviceList. This property
tells the aggregate what devices to aggregate.
I thought I saw that you were also setting this property in the
code you had provided earlier. In fact, the complaint I recall
was that you were getting an aggregate that was aggregating some
unknown device. At that point, I saw that you were making the
mistake of assuming that the first device in the device list was
the built-in hardware. This is bad because there is almost always
2 or more devices on the system. You needed to add code to search
through the device list for the built-in device, and then use it
in building the CFArray you pass to
kAudioAggregateDevicePropertyFullSubDeviceList.
Was I mistaken?
On May 3, 2006, at 5:06 PM, Christoph Teschner wrote:
But when you create an aggregate device in AMS it also has 0 in
and outputs and isn't usable either. you also have to set the
check box after having created the aggregate in order to use it.
so my process of creating te aggr. device seems to be identical
to AMS. it's really that final step that can be done manually in
AMS that I need to figure out how to do. what's actually done
when you set that check box in AMS ? do you set a certain
property ?
thanks again,
Christoph
From: Jeff Moore <email@hidden>
To: CoreAudio API <email@hidden>
Subject: Re: aggregate device
Date: Wed, 3 May 2006 16:35:47 -0700
You are using the same API calls that AMS uses, so my guess is
that you still have some issues with your code for creating
the aggregate in the first place. Not that it's your fault,
mind you. This process isn't the best documented thing in the
universe.
On May 3, 2006, at 4:23 PM, Christoph Teschner wrote:
Hi Jeff,
by activate I mean setting the aggregate's sub devices to an
active state. when I create an aggregate device it always has
0 input an 0 outputs and I can neither use it in my app nor
in AULab. the aggregate device editor in AMS has this check
box "use" for each of the subdevices. only after I have
manually set this check box in AMS, I can play sound through
my aggregate device in other applications. now the question
is, how can I programatically do what AMS does when I click
that "use" check box for a subdevice.
thanks,
christoph
From: Jeff Moore <email@hidden>
To: CoreAudio API <email@hidden>
Subject: Re: aggregate device
Date: Tue, 2 May 2006 17:56:40 -0700
What do you mean by "activate"?
On May 2, 2006, at 4:50 PM, Christoph Teschner wrote:
the last thing I am trying to figure out is how can I
actually activate an aggregate device. everything's fine
with its creation and it shows up in AMS. however, I can't
use it in my app unless I manually activate it in AMS. I'd
like to do that programatically. so what's actually done
when you click that check box in AMS for a device in the
aggregate's sub device list. do I have to set a certain
property on the sub device?
--
Jeff Moore
Core Audio
Apple
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden