• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problem creating and using aggregate device
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem creating and using aggregate device


  • Subject: Re: Problem creating and using aggregate device
  • From: Jeff Moore <email@hidden>
  • Date: Tue, 29 Jul 2008 15:40:10 -0700


On Jul 29, 2008, at 3:17 PM, Glenn McCord wrote:

On Wed, Jul 30, 2008 at 7:04 AM, Jeff Moore <email@hidden> wrote:
My first question involves the device. I'm not too familiar with any USB
Audio class compliant devices that allow 6 input and 6 output channels to be
used simultaneously. Wouldn't that require more bandwidth than the bus has
available? Or is this a high speed USB device that has it's own drivers and
what not? The reason I ask is that if IO isn't running, one possible cause
could be that the driver wasn't able to reserve the bandwidth on the USB bus
for that much data. This could also be why AMS is showing the input channels
going away too.

This sound card has it's own drivers. 6in 6out work simultaneously when I use the USB device as the two separate devices (an in and an out device) as seen by OS X. I can also make an aggregate device in AMS and use it so unless there is some code that says I want lots of bandwidth, then I can't see that being the issue. Is there some kind of error flag that can be raised when the bandwidth is exceeded?

If you are able, can you name the actual device? I'd like to take a peek at it if I can track one down around here. It could be that you are running into some odd driver issue.


At any rate, our USB audio driver does the isoch bandwidth reservation as part of starting up the controller when IO is starting. I can't recall if any errors will get returned from AudioDeviceStart() or not, mostly because I can't remember where I fixed the bug that was preventing it. I know that at least with Tiger and earlier systems, the error would get swallowed. I may have fixed this in Leopard but I honestly can't recall =)

I know other devices have crapped out running around 8 channels of uncompressed linear PCM. When we analyzed why, it turned out that there just wasn't enough isoch bandwidth available for that much data on the old, slower USB. When the driver would run out of bandwidth, the device would appear like it is alive but it would be unresponsive to IO requests until the format was changed to require less bandwidth. The catch is that because there has to be two reservations, one for the input side and one for the output side, one reservation might succeed where the other might fail.

You said that this device has it's own drivers, so perhaps they aren't doing the isoch reservations properly...

That said, the other reason why channels disappear from an aggregate device
is that the sub-device that contains them is at a different sample rate from
the aggregate's master sub-device. Although this would not explain why your
IOProc wouldn't get called.

There must be something that I am doing programatically wrong, because I can go to AMS, create the aggregate device there, and then use that in my code instead. For my application though, I need to set it up in the code so that the user doesn't have to do it in AMS.

In regards to setting sample rate, it can be set from the card's
control panel so the in and out should be the same. I've also tried
setting sample rate via the code.

I wouldn't trust that to always be correct. If you really want to be sure that both sides have the same sample rate, you have to set it yourself.


Of course, that runs afoul of some of the other things I've said about apps leaving device settings to the user. I trust that you can balance both requirements for your app =)

Note, as soon as I close my audio application that has created the
aggregate device, AMS switches from seeing the aggregate device as
have 0in 6out to 6in 6out.

That really makes me lean toward the idea that one side of the device is not able to reserve enough isoch bandwidth. The symptoms sound a bit like the input side of the device is actually just dropping off the machine.


At any rate, when AMS is saying the input side lacks any channels, what does AMS say the sample rate is for the singleton devices (that is, the underlying sub-devices)? Also, is the input device even listed by AMS in this circumstance? And if so, how many channels is AMS saying it has?



On Jul 28, 2008, at 10:29 PM, Glenn McCord wrote:

I am trying to aggregate my USB 6 in 6 out sound card so that instead
of being regarded as two separate devices (in and out), it shows up as
one device.


Courtesy of a previous question to the mailing list
(http://lists.apple.com/archives/coreaudio-api/2006/Apr/msg00103.html )
I am able to create an aggregate device in the code so that it shows
up in Audio MIDI Setup, unfortunately though, my input/output
callbacks never start.


I have had some success though.

- I can use the two USB devices (in and out) so that it uses the input
callback and output callback.
- I can create the aggregate device in the code, close my application
so that the aggregate device remains in Audio MIDI setup, then restart
the program using the name of the aggregate device to identify an
input/output device that requires only one callback. This works too.


What I can't do is create my aggregate device in the code, 'then' use it.

Here's the steps I've done:
- Identified the two separate USB devices (in and out) and set the
sample rate and frame size.
- Created a public aggregate device using the input and output ids of
the USB device.
- Tried to start the callbacks using AudioDeviceAddIOProc and
AudioDeviceStart using the id of the newly created aggregate device.


Unfortunately, the callbacks never start and I've noticed that while
running my application, Audio MIDI Setup shows zero input channels but
6 output channels for the device. When I close my application, it
changes to 6 in 6 out, which is what the card is supposed to be.


Is that the problem? Should all 6 in and 6 outs be visible when I
create the aggregate device. I'm assuming there is a problem with the
way I have created the aggregate device, code which is unashamedly
copied from numerous sources. Unfortunately though, I can't identify
why it would drop access to the inputs, if that is indeed the problem.




--

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
  • Follow-Ups:
    • Re: Problem creating and using aggregate device
      • From: "Glenn McCord" <email@hidden>
References: 
 >Problem creating and using aggregate device (From: "Glenn McCord" <email@hidden>)
 >Re: Problem creating and using aggregate device (From: Jeff Moore <email@hidden>)
 >Re: Problem creating and using aggregate device (From: "Glenn McCord" <email@hidden>)

  • Prev by Date: Re: Problem creating and using aggregate device
  • Next by Date: AudioQueueOfflineRender question
  • Previous by thread: Re: Problem creating and using aggregate device
  • Next by thread: Re: Problem creating and using aggregate device
  • Index(es):
    • Date
    • Thread