Re: "Channel" confusion
Re: "Channel" confusion
- Subject: Re: "Channel" confusion
- From: Bill Stewart <email@hidden>
- Date: Thu, 14 Jun 2001 19:55:11 -0700
on 14/6/01 4:21 PM, Scott Lehman wrote:
>
>> So what is a "device channel"?
>
>
>
> A device channel is the absolute 1-based channel number on a device as
>
> opposed to a stream channel which is the 1-based channel number within a
>
> single stream.
>
>
>
> For instance if you have a device whose stream layout is 4 streams with 2
>
> channels each, the second channel of the third stream would have a device
>
> channel number of 6 but a stream channel number of 2.
>
>
>
> So what this means in terms of the HAL API is that you can address things
>
> like volume and mute at the device level using device channel numbers in the
>
> AudioDeviceXXXPropertyXXX routines.
>
>
So am I getting this correctly?
>
>
-The number of channels in a single stream is equal to the number of
>
AudioBuffers in the AudioBufferList passed to the IOProcs registered for
>
that stream
No - an AudioBuffer is a stream. An Audio Buffer can contain from 1 to N
channels. The number of "streams" that a device has is represented by the
number of Audio Buffers that are contained within the SINGLE AudioBuffer
list that you get in the IO Proc
IOProcs are registered with devices - and you get all the buffers that are
associated with all the streams of a device in the IO Proc.
>
-As far as my app is concerned, the device channel maps to one and only
>
one of the audio buffers in the AudioBufferList passed to my IOProc.
The Device channel == 0 maps to the device itself.
The device channel from 1 -> n maps to the total numbers of channels the
device has (so a stereo device could have Channel-0 for the device,
Channel-1 for L, Channel-2 for R for instance)
>
-It's expected that for a single device (on either the input or output
>
side), no two streams will share the same stream format - rather, there
>
would be one stream of that format with multiple channels. (and maybe
>
this wouldn't hold for advanced cards with hardware that can switch formats?)
Nope - its quite likely that IF a device has multiple streams of data, they
could be the same format, or the could not - it depends on the device.
>
And for a final hypothetical example, so I have a PCI card with a single
>
ADAT output. By probing I might find a single stream with 8 channels,
>
and then by using the corresponding device channel numbers, I might be
>
able to get meaningful names like "ADAT Channel 1", "ADAT Channel 2",
>
etc. to then display to the user, allowing them to make a routing choice?
>
>
Sorry if I'm just an idiot here, but all the APIs I've worked with in
>
the past were much more straightforward. However I do think that I am
>
beginning to appreciate the power of CoreAudio that those other API's lacked.
Sound Manager provides a higher level API than this layer of Core Audio
which is only concerned with representing the raw capabilities of the Device
to an application.
Core Audio has some medium level tier objects as well - primarily the
DefaultOutputUnit that will take care of many of these details for you and
you may want to look at that as well. I suppose it depends on what you need
to do - but the HAL layer is not necessarily the best place to start.
Bill
mailto:email@hidden
tel: +1 408 974 4056
__________________________________________________________________________
Cat: "Leave me alone, I'm trying to nap... Ah, What's that clicking noise?"
__________________________________________________________________________